diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc index c86ff1208cd85..666a29cba63a8 100644 --- a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc +++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc @@ -310,8 +310,6 @@ bool DartComponentController::SetUpFromKernel() { manifest.size()); Dart_Handle library = Dart_Null(); - bool first_library = true; - bool result_sound_null_safety = false; for (size_t start = 0; start < manifest.size();) { size_t end = str.find("\n", start); if (end == std::string::npos) { @@ -330,31 +328,11 @@ bool DartComponentController::SetUpFromKernel() { Dart_ExitScope(); return false; } - bool sound_null_safety = Dart_DetectNullSafety( - /*script_uri=*/nullptr, /*package_config=*/nullptr, - /*original_working_directory=*/nullptr, - isolate_snapshot_data_.address(), - /*isolate_snapshot_instructions=*/nullptr, kernel.address(), - kernel.size()); - - if (first_library) { - result_sound_null_safety = sound_null_safety; - first_library = false; - } else if (sound_null_safety != result_sound_null_safety) { - FML_LOG(ERROR) << "Inconsistent sound null safety"; - return false; - } - kernel_peices_.emplace_back(std::move(kernel)); } - Dart_IsolateFlags isolate_flags; - Dart_IsolateFlagsInitialize(&isolate_flags); - isolate_flags.null_safety = result_sound_null_safety; - if (!CreateIsolate(isolate_snapshot_data_.address(), - /*isolate_snapshot_instructions=*/nullptr, - &isolate_flags)) { + /*isolate_snapshot_instructions=*/nullptr)) { return false; } @@ -404,15 +382,13 @@ bool DartComponentController::SetUpFromAppSnapshot() { isolate_data = isolate_snapshot_data_.address(); isolate_instructions = nullptr; } - return CreateIsolate(isolate_data, isolate_instructions, - /*isolate_flags=*/nullptr); + return CreateIsolate(isolate_data, isolate_instructions); #endif // defined(AOT_RUNTIME) } bool DartComponentController::CreateIsolate( const uint8_t* isolate_snapshot_data, - const uint8_t* isolate_snapshot_instructions, - Dart_IsolateFlags* isolate_flags) { + const uint8_t* isolate_snapshot_instructions) { // Create the isolate from the snapshot. char* error = nullptr; @@ -423,9 +399,13 @@ bool DartComponentController::CreateIsolate( auto state = new std::shared_ptr(new tonic::DartState( namespace_fd, [this](Dart_Handle result) { MessageEpilogue(result); })); + Dart_IsolateFlags isolate_flags; + Dart_IsolateFlagsInitialize(&isolate_flags); + isolate_flags.null_safety = true; + isolate_ = Dart_CreateIsolateGroup( url_.c_str(), label_.c_str(), isolate_snapshot_data, - isolate_snapshot_instructions, isolate_flags, state, state, &error); + isolate_snapshot_instructions, &isolate_flags, state, state, &error); if (!isolate_) { FML_LOG(ERROR) << "Dart_CreateIsolateGroup failed: " << error; return false; diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.h b/shell/platform/fuchsia/dart_runner/dart_component_controller.h index e8c3701a22458..fdc244079217a 100644 --- a/shell/platform/fuchsia/dart_runner/dart_component_controller.h +++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.h @@ -61,8 +61,7 @@ class DartComponentController bool SetUpFromAppSnapshot(); bool CreateIsolate(const uint8_t* isolate_snapshot_data, - const uint8_t* isolate_snapshot_instructions, - Dart_IsolateFlags* isolate_flags); + const uint8_t* isolate_snapshot_instructions); // |Echo| void EchoString(fidl::StringPtr value, EchoStringCallback callback) override; diff --git a/shell/platform/fuchsia/dart_runner/dart_test_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_test_component_controller.cc index d7c6b311820fe..d9d4b07120e2d 100644 --- a/shell/platform/fuchsia/dart_runner/dart_test_component_controller.cc +++ b/shell/platform/fuchsia/dart_runner/dart_test_component_controller.cc @@ -242,8 +242,6 @@ bool DartTestComponentController::SetUpFromKernel() { manifest.size()); Dart_Handle library = Dart_Null(); - bool first_library = true; - bool result_sound_null_safety = false; for (size_t start = 0; start < manifest.size();) { size_t end = str.find("\n", start); if (end == std::string::npos) { @@ -260,31 +258,11 @@ bool DartTestComponentController::SetUpFromKernel() { FML_LOG(ERROR) << "Cannot load kernel from namespace: " << path; return false; } - bool sound_null_safety = Dart_DetectNullSafety( - /*script_uri=*/nullptr, /*package_config=*/nullptr, - /*original_working_directory=*/nullptr, - isolate_snapshot_data_.address(), - /*isolate_snapshot_instructions=*/nullptr, kernel.address(), - kernel.size()); - - if (first_library) { - result_sound_null_safety = sound_null_safety; - first_library = false; - } else if (sound_null_safety != result_sound_null_safety) { - FML_LOG(ERROR) << "Inconsistent sound null safety"; - return false; - } - kernel_peices_.emplace_back(std::move(kernel)); } - Dart_IsolateFlags isolate_flags; - Dart_IsolateFlagsInitialize(&isolate_flags); - isolate_flags.null_safety = result_sound_null_safety; - if (!CreateIsolate(isolate_snapshot_data_.address(), - /*isolate_snapshot_instructions=*/nullptr, - &isolate_flags)) { + /*isolate_snapshot_instructions=*/nullptr)) { return false; } @@ -333,15 +311,13 @@ bool DartTestComponentController::SetUpFromAppSnapshot() { isolate_data = isolate_snapshot_data_.address(); isolate_instructions = nullptr; } - return CreateIsolate(isolate_data, isolate_instructions, - /*isolate_flags=*/nullptr); + return CreateIsolate(isolate_data, isolate_instructions); #endif // defined(AOT_RUNTIME) } bool DartTestComponentController::CreateIsolate( const uint8_t* isolate_snapshot_data, - const uint8_t* isolate_snapshot_instructions, - Dart_IsolateFlags* isolate_flags) { + const uint8_t* isolate_snapshot_instructions) { // Create the isolate from the snapshot. char* error = nullptr; @@ -352,9 +328,13 @@ bool DartTestComponentController::CreateIsolate( auto state = new std::shared_ptr(new tonic::DartState( namespace_fd, [this](Dart_Handle result) { MessageEpilogue(result); })); + Dart_IsolateFlags isolate_flags; + Dart_IsolateFlagsInitialize(&isolate_flags); + isolate_flags.null_safety = true; + isolate_ = Dart_CreateIsolateGroup( url_.c_str(), label_.c_str(), isolate_snapshot_data, - isolate_snapshot_instructions, isolate_flags, state, state, &error); + isolate_snapshot_instructions, &isolate_flags, state, state, &error); if (!isolate_) { FML_LOG(ERROR) << "Dart_CreateIsolateGroup failed: " << error; return false; diff --git a/shell/platform/fuchsia/dart_runner/dart_test_component_controller.h b/shell/platform/fuchsia/dart_runner/dart_test_component_controller.h index 3bf9437f2ef52..81655653342d4 100644 --- a/shell/platform/fuchsia/dart_runner/dart_test_component_controller.h +++ b/shell/platform/fuchsia/dart_runner/dart_test_component_controller.h @@ -77,8 +77,7 @@ class DartTestComponentController bool SetUpFromAppSnapshot(); bool CreateIsolate(const uint8_t* isolate_snapshot_data, - const uint8_t* isolate_snapshot_instructions, - Dart_IsolateFlags* isolate_flags); + const uint8_t* isolate_snapshot_instructions); // |ComponentController| void Kill() override; diff --git a/shell/platform/fuchsia/dart_runner/service_isolate.cc b/shell/platform/fuchsia/dart_runner/service_isolate.cc index c9af7409a8398..59d9cb8fbf999 100644 --- a/shell/platform/fuchsia/dart_runner/service_isolate.cc +++ b/shell/platform/fuchsia/dart_runner/service_isolate.cc @@ -122,19 +122,9 @@ Dart_Isolate CreateServiceIsolate( } #endif - bool is_null_safe = - Dart_DetectNullSafety(nullptr, // script_uri - nullptr, // package_config - nullptr, // original_working_directory - vmservice_data, // snapshot_data - vmservice_instructions, // snapshot_instructions - nullptr, // kernel_buffer - 0u // kernel_buffer_size - ); - Dart_IsolateFlags flags; Dart_IsolateFlagsInitialize(&flags); - flags.null_safety = is_null_safe; + flags.null_safety = true; auto state = new std::shared_ptr(new tonic::DartState()); Dart_Isolate isolate = Dart_CreateIsolateGroup( diff --git a/shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_echo_server/BUILD.gn b/shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_echo_server/BUILD.gn index 100b1d04ff724..87db0a6fcb46f 100644 --- a/shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_echo_server/BUILD.gn +++ b/shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_echo_server/BUILD.gn @@ -11,7 +11,6 @@ import("//flutter/tools/fuchsia/gn-sdk/src/package.gni") dart_library("lib") { testonly = true package_name = "dart_echo_server" - null_safe = true source_dir = "." sources = [ "main.dart" ] @@ -20,7 +19,6 @@ dart_library("lib") { # Dart component that serves the test Echo FIDL protocol, built using the Dart AOT runner dart_component("aot_component") { testonly = true - null_safe = true main_package = "dart_echo_server" manifest = "meta/dart-aot-echo-server.cml" @@ -32,7 +30,6 @@ dart_component("aot_component") { # Dart component that serves the test Echo FIDL protocol, built using the Dart AOT runner dart_component("jit_component") { testonly = true - null_safe = true main_package = "dart_echo_server" manifest = "meta/dart-jit-echo-server.cml" diff --git a/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view/lib/parent_view.dart b/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view/lib/parent_view.dart index 8cb272e34d91b..918bef8260b54 100644 --- a/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view/lib/parent_view.dart +++ b/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view/lib/parent_view.dart @@ -50,7 +50,7 @@ class TestApp { this.focusable = true}) {} void run() { - childView.create(focusable, (ByteData reply) { + childView.create(focusable, (ByteData? reply) { // Set up window allbacks. window.onPointerDataPacket = (PointerDataPacket packet) { for (final data in packet.data) { @@ -181,8 +181,8 @@ Future _launchChildView() async { final message = Int8List.fromList([0x31]); final completer = new Completer(); PlatformDispatcher.instance.sendPlatformMessage( - 'fuchsia/child_view', ByteData.sublistView(message), (ByteData reply) { - completer.complete(reply); + 'fuchsia/child_view', ByteData.sublistView(message), (ByteData? reply) { + completer.complete(reply!); }); return int.parse( diff --git a/shell/platform/fuchsia/flutter/tests/integration/mouse-input/mouse-input-view/lib/mouse-input-view.dart b/shell/platform/fuchsia/flutter/tests/integration/mouse-input/mouse-input-view/lib/mouse-input-view.dart index 9e990890ee6af..b3f2104c5747c 100644 --- a/shell/platform/fuchsia/flutter/tests/integration/mouse-input/mouse-input-view/lib/mouse-input-view.dart +++ b/shell/platform/fuchsia/flutter/tests/integration/mouse-input/mouse-input-view/lib/mouse-input-view.dart @@ -100,13 +100,13 @@ class MyApp { } void _reportMouseInput( - {double localX, - double localY, - int timeReceived, - int buttons, - String phase, - double wheelXPhysicalPixel, - double wheelYPhysicalPixel}) { + {required double localX, + required double localY, + required int timeReceived, + required int buttons, + required String phase, + required double wheelXPhysicalPixel, + required double wheelYPhysicalPixel}) { print('mouse-input-view reporting mouse input to MouseInputListener'); final message = ByteData.sublistView(utf8.encode(json.encode({ 'method': 'MouseInputListener.ReportMouseInput', @@ -115,7 +115,7 @@ class MyApp { 'time_received': timeReceived, 'component_name': 'touch-input-view', 'buttons': buttons, - 'phase': 'asdf', + 'phase': phase, 'wheel_x_physical_pixel': wheelXPhysicalPixel, 'wheel_y_physical_pixel': wheelYPhysicalPixel, }))); diff --git a/shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/BUILD.gn b/shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/BUILD.gn index 38d8760bdbd9a..c2c289ce22a73 100644 --- a/shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/BUILD.gn +++ b/shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/BUILD.gn @@ -13,7 +13,6 @@ dart_library("lib") { package_name = "text-input-view" sources = [ "text_input_view.dart" ] deps = [ "//flutter/shell/platform/fuchsia/dart:args" ] - null_safe = true } flutter_component("component") { @@ -22,7 +21,6 @@ flutter_component("component") { manifest = rebase_path("meta/text-input-view.cml") main_package = "text-input-view" main_dart = "text_input_view.dart" - sound_null_safety = true deps = [ ":lib" ] } diff --git a/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart b/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart index 4f3613427818b..39a161a05ee44 100644 --- a/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart +++ b/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/lib/embedding-flutter-view.dart @@ -53,7 +53,7 @@ class TestApp { } void run() { - childView.create(focusable, (ByteData reply) { + childView.create(focusable, (ByteData? reply) { // Set up window callbacks. window.onPointerDataPacket = (PointerDataPacket packet) { this.pointerDataPacket(packet); @@ -161,7 +161,7 @@ class TestApp { window.scheduleFrame(); } - void _reportTouchInput({double localX, double localY, int timeReceived}) { + void _reportTouchInput({required double localX, required double localY, required int timeReceived}) { print('embedding-flutter-view reporting touch input to TouchInputListener'); final message = utf8.encode(json.encode({ 'method': 'TouchInputListener.ReportTouchInput', @@ -219,8 +219,8 @@ Future _launchChildView() async { final message = Int8List.fromList([0x31]); final completer = new Completer(); PlatformDispatcher.instance.sendPlatformMessage( - 'fuchsia/child_view', ByteData.sublistView(message), (ByteData reply) { - completer.complete(reply); + 'fuchsia/child_view', ByteData.sublistView(message), (ByteData? reply) { + completer.complete(reply!); }); return int.parse( diff --git a/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/lib/touch-input-view.dart b/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/lib/touch-input-view.dart index b8cb1c98c985a..8032b1e4ba20b 100644 --- a/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/lib/touch-input-view.dart +++ b/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/lib/touch-input-view.dart @@ -80,7 +80,7 @@ class TestApp { window.scheduleFrame(); } - void _reportTouchInput({double localX, double localY, int timeReceived}) { + void _reportTouchInput({required double localX, required double localY, required int timeReceived}) { print('touch-input-view reporting touch input to TouchInputListener'); final message = utf8.encode(json.encode({ 'method': 'TouchInputListener.ReportTouchInput', diff --git a/tools/fuchsia/dart/dart_component.gni b/tools/fuchsia/dart/dart_component.gni index 7e76ebf80e349..8cf19ba8a3f87 100644 --- a/tools/fuchsia/dart/dart_component.gni +++ b/tools/fuchsia/dart/dart_component.gni @@ -81,9 +81,6 @@ import("//flutter/tools/fuchsia/flutter/internal/flutter_dart_component.gni") # Specifies the parameters for building the component. # See //build/dart/dart_build_config.gni for predefined configs. # -# null_safe (optional) -# If true, this component will be compiled with --sound-null-safety -# # deps # testonly # visibility @@ -123,7 +120,6 @@ template("dart_component") { "build_cfg", "deps", "main_dart", - "null_safe", ]) main_package = _main_package deps = _component_deps diff --git a/tools/fuchsia/dart/dart_library.gni b/tools/fuchsia/dart/dart_library.gni index 5eea0fe04e991..ed3ded2cc930f 100644 --- a/tools/fuchsia/dart/dart_library.gni +++ b/tools/fuchsia/dart/dart_library.gni @@ -76,9 +76,6 @@ import("//flutter/tools/fuchsia/dart/toolchain.gni") # disable_metadata_entry (optional) # Prevents metedata entry from being written to the dart_packag_config json file. # -# null_safe (optional) -# A flag that enables null safety check in dart libraries. -# # Example of usage: # # dart_library("baz") { @@ -183,10 +180,10 @@ if (current_toolchain == dart_toolchain) { name = package_name if (defined(invoker.language_version)) { language_version = invoker.language_version - } else if (defined(invoker.null_safe) && invoker.null_safe) { - language_version = "2.12" } else if (defined(invoker.pubspec)) { pubspec_path = rebase_path(invoker.pubspec, root_build_dir) + } else { + language_version = "2.12" } root_uri = rebase_path(package_root, root_build_dir) if (defined(invoker.source_dir)) { diff --git a/tools/fuchsia/dart/kernel/dart_kernel.gni b/tools/fuchsia/dart/kernel/dart_kernel.gni index aa7c908cc50f6..6053eb5f1e504 100644 --- a/tools/fuchsia/dart/kernel/dart_kernel.gni +++ b/tools/fuchsia/dart/kernel/dart_kernel.gni @@ -135,9 +135,6 @@ template("_convert_kernel_manifest") { # Whether the kernel compiler should link the current platform.dill into # the build. If false, the --no-link-platform flag will be passed to the # compiler. Defaults to false. -# -# sound_null_safety (optional) -# Whether to generate sound null safe kernel. template("dart_kernel") { assert(defined(invoker.platform_name), "dart_kernel() requires platform_name") assert(defined(invoker.packages_path), @@ -278,12 +275,9 @@ template("dart_kernel") { rebase_path(depfile, root_build_dir), "--output", rebase_path(_kernel_path, root_build_dir), + "--sound-null-safety", ] - if (!defined(invoker.sound_null_safety) || !invoker.sound_null_safety) { - args += [ "--no-sound-null-safety" ] - } - # TODO(richkadel): It should be possible to remove all of the build rules # related to `generate_manifest`. Without the following two flags, the # `gen_kernel` step will produce one large `.dil` file, instead of multiple diff --git a/tools/fuchsia/flutter/flutter_component.gni b/tools/fuchsia/flutter/flutter_component.gni index 3932ddf354852..8fd99842cbba0 100644 --- a/tools/fuchsia/flutter/flutter_component.gni +++ b/tools/fuchsia/flutter/flutter_component.gni @@ -84,9 +84,6 @@ import("//flutter/tools/fuchsia/flutter/internal/flutter_dart_component.gni") # Specifies the parameters for building the component. # See //flutter/tools/fuchsia/flutter/flutter_build_config.gni for predefined configs. # -# sound_null_safety (optional) -# Whether to generate sound null safe Dart kernel. -# # deps # testonly # visibility diff --git a/tools/fuchsia/flutter/internal/flutter_dart_component.gni b/tools/fuchsia/flutter/internal/flutter_dart_component.gni index d43d6f753fbc8..72cd952b8418b 100644 --- a/tools/fuchsia/flutter/internal/flutter_dart_component.gni +++ b/tools/fuchsia/flutter/internal/flutter_dart_component.gni @@ -48,9 +48,6 @@ import("//flutter/tools/fuchsia/gn-sdk/src/component.gni") # Type: boolean # Default: false # -# sound_null_safety (optional) -# If true, generate sound null safe Dart kernel. -# # deps # testonly # visibility @@ -147,7 +144,6 @@ template("flutter_dart_component") { "visibility", "main_dart", "main_package", - "sound_null_safety", ]) deps = [ ":$_dart_package_config_target_name" ] diff --git a/tools/fuchsia/sdk/sdk_targets.gni b/tools/fuchsia/sdk/sdk_targets.gni index 159ce98c2ce36..f0b5c8a6490e8 100644 --- a/tools/fuchsia/sdk/sdk_targets.gni +++ b/tools/fuchsia/sdk/sdk_targets.gni @@ -17,11 +17,7 @@ template("_fuchsia_dart_library") { _sources = [] _deps = [] - if (defined(meta.dart_library_null_safe) && meta.dart_library_null_safe) { - _dart_language_version = "2.12" - } else { - _dart_language_version = "2.0" - } + _dart_language_version = "2.12" foreach(source, meta.sources) { _sources += [ string_replace("$source", "${meta.root}/lib/", "") ]