Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2363858
change
zijiehe-google-com Mar 12, 2024
bf2d56c
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 12, 2024
c4df2d3
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 12, 2024
1291b01
sound-null-safety
zijiehe-google-com Mar 12, 2024
d1597c2
remove
zijiehe-google-com Mar 12, 2024
634df98
null
zijiehe-google-com Mar 12, 2024
7c1b936
null_safe
zijiehe-google-com Mar 12, 2024
ea80255
?
zijiehe-google-com Mar 12, 2024
ecf696c
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 12, 2024
f566690
remove null_safe
zijiehe-google-com Mar 12, 2024
36451ce
blabla
zijiehe-google-com Mar 12, 2024
148bf3f
always null_safety
zijiehe-google-com Mar 12, 2024
c673d83
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 12, 2024
bfa7abd
vm
zijiehe-google-com Mar 13, 2024
fdaf67d
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 13, 2024
95f545c
undo
zijiehe-google-com Mar 13, 2024
fffc72c
force true
zijiehe-google-com Mar 13, 2024
3cd58c0
remove
zijiehe-google-com Mar 13, 2024
9648892
dart_vm
zijiehe-google-com Mar 13, 2024
17e09b0
vm
zijiehe-google-com Mar 13, 2024
3210758
isolate_flags
zijiehe-google-com Mar 13, 2024
4118fdd
missing
zijiehe-google-com Mar 13, 2024
2c50d4b
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 13, 2024
2998b31
Merge branch 'main' into dart-null-check
zijiehe-google-com Mar 13, 2024
56401e9
address review comments
zijiehe-google-com Mar 13, 2024
e833109
address review comments
zijiehe-google-com Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions shell/platform/fuchsia/dart_runner/dart_component_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;

Expand All @@ -423,9 +399,13 @@ bool DartComponentController::CreateIsolate(
auto state = new std::shared_ptr<tonic::DartState>(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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;

Expand All @@ -352,9 +328,13 @@ bool DartTestComponentController::CreateIsolate(
auto state = new std::shared_ptr<tonic::DartState>(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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 1 addition & 11 deletions shell/platform/fuchsia/dart_runner/service_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<tonic::DartState>(new tonic::DartState());
Dart_Isolate isolate = Dart_CreateIsolateGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand All @@ -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"
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -181,8 +181,8 @@ Future<int> _launchChildView() async {
final message = Int8List.fromList([0x31]);
final completer = new Completer<ByteData>();
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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" ]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -219,8 +219,8 @@ Future<int> _launchChildView() async {
final message = Int8List.fromList([0x31]);
final completer = new Completer<ByteData>();
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 0 additions & 4 deletions tools/fuchsia/dart/dart_component.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,7 +120,6 @@ template("dart_component") {
"build_cfg",
"deps",
"main_dart",
"null_safe",
])
main_package = _main_package
deps = _component_deps
Expand Down
7 changes: 2 additions & 5 deletions tools/fuchsia/dart/dart_library.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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)) {
Expand Down
8 changes: 1 addition & 7 deletions tools/fuchsia/dart/kernel/dart_kernel.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tools/fuchsia/flutter/flutter_component.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading