Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions shell/platform/fuchsia/dart_runner/dart_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ const char* kDartVMArgs[] = {
#if !defined(DART_PRODUCT) && (!defined(FLUTTER_PROFILE) || !defined(NDEBUG))
"--enable_asserts",
#endif
// Run in unsound null safety mode as some packages used in Integration
// testing have not been migrated yet.
"--no-sound-null-safety",
// // Run in unsound null safety mode as some packages used in Integration
// // testing have not been migrated yet.
// "--no-sound-null-safety",
// clang-format on
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,18 @@ bool DartTestComponentController::CreateIsolate(
auto state = new std::shared_ptr<tonic::DartState>(new tonic::DartState(
namespace_fd, [this](Dart_Handle result) { MessageEpilogue(result); }));

Dart_IsolateFlags flags;
flags.null_safety = Dart_DetectNullSafety(
/*script_uri=*/nullptr, /*package_config=*/nullptr,
/*original_working_directory=*/nullptr,
/*snapshot_data=*/isolate_snapshot_data,
/*snapshot_instructions=*/isolate_snapshot_instructions,
/*kernel_buffer=*/nullptr,
/*kernel_buffer_size=*/0);

isolate_ = Dart_CreateIsolateGroup(
url_.c_str(), label_.c_str(), isolate_snapshot_data,
isolate_snapshot_instructions, nullptr /* flags */, state, state, &error);
isolate_snapshot_instructions, &flags, state, state, &error);
if (!isolate_) {
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", error);
return false;
Expand Down
5 changes: 1 addition & 4 deletions shell/platform/fuchsia/flutter/component_v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,7 @@ ComponentV2::ComponentV2(
};

settings_.dart_flags = {};

// Run in unsound null safety mode as some packages used in Integration
// testing have not been migrated yet.
settings_.dart_flags.push_back("--no-sound-null-safety");
// settings_.dart_flags.push_back("--sound-null-safety");

// Don't collect CPU samples from Dart VM C++ code.
settings_.dart_flags.push_back("--no_profile_vm");
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/fuchsia/flutter/kernel/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compile_platform("kernel_platform_files") {
]

args = [
"--nnbd-agnostic",
"--nnbd-strong",
"--target=flutter_runner",
"dart:core",
]
Expand Down Expand Up @@ -78,6 +78,7 @@ template("core_snapshot") {
rebase_path(isolate_snapshot_instructions, root_build_dir),
"--write_v8_snapshot_profile_to=" +
rebase_path(snapshot_profile, root_build_dir),
"--sound_null_safety",
]

# No asserts in debug or release product.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import("//flutter/tools/fuchsia/gn-sdk/package.gni")
dart_library("lib") {
package_name = "child-view"
sources = [ "child_view.dart" ]
null_safe = true
}

flutter_component("component") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import("//flutter/tools/fuchsia/gn-sdk/package.gni")
dart_library("lib") {
package_name = "parent-view"
sources = [ "parent_view.dart" ]

deps = [
"//flutter/shell/platform/fuchsia/dart:args",
"//flutter/shell/platform/fuchsia/dart:vector_math",
]
null_safe = true
}

flutter_component("component") {
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 @@ -11,7 +11,7 @@ import("//flutter/tools/fuchsia/gn-sdk/package.gni")
dart_library("lib") {
package_name = "mouse-input-view"
sources = [ "mouse-input-view.dart" ]

null_safe = true
deps = [ "//flutter/shell/platform/fuchsia/dart:args" ]
}

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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ final Map<int, String> hidToKey = {
458759: 'D', // Keyboard d and D
};

int main() {
void main() {
print('Launching text-input-view');
if (<int?>[null, 1 , 2] is List<int>) {
throw Exception('Unsound mode!');
}
TestApp app = TestApp();
app.run();
}
Expand All @@ -37,7 +40,7 @@ class TestApp {

void run() {
// Set up window callbacks
window.onPlatformMessage = (String name, ByteData data, PlatformMessageResponseCallback callback) {
window.onPlatformMessage = (String name, ByteData? data, PlatformMessageResponseCallback? callback) {
this.decodeAndReportPlatformMessage(name, data);
};
window.onMetricsChanged = () {
Expand Down Expand Up @@ -72,16 +75,16 @@ class TestApp {
window.render(sceneBuilder.build());
}

void decodeAndReportPlatformMessage(String name, ByteData data) async {
final buffer = data.buffer;
void decodeAndReportPlatformMessage(String name, ByteData? data) async {
final buffer = data!.buffer;
var list = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
var decoded = utf8.decode(list);
var decodedJson = json.decode(decoded);
print('received ${name} platform message: ${decodedJson}');

if (name == "flutter/keyevent" && decodedJson["type"] == "keydown") {
if (hidToKey[decodedJson["hidUsage"]] != null) {
_reportTextInput(hidToKey[decodedJson["hidUsage"]]);
_reportTextInput(hidToKey[decodedJson["hidUsage"]]!);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dart_library("lib") {
"//flutter/shell/platform/fuchsia/dart:args",
"//flutter/shell/platform/fuchsia/dart:vector_math",
]
null_safe = true
}

flutter_component("component") {
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 @@ -11,8 +11,8 @@ import("//flutter/tools/fuchsia/gn-sdk/package.gni")
dart_library("lib") {
package_name = "touch-input-view"
sources = [ "touch-input-view.dart" ]

deps = [ "//flutter/shell/platform/fuchsia/dart:args" ]
null_safe = true
}

flutter_component("component") {
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
3 changes: 2 additions & 1 deletion tools/fuchsia/dart/kernel/dart_kernel.gni
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ template("dart_kernel") {
}
args += [
"--verbosity=warning",
"--no-sound-null-safety",

# "--no-sound-null-safety",
"--target",
invoker.platform_name,
"--platform",
Expand Down