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
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
2 changes: 1 addition & 1 deletion shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fdio_ns_t* GetNamespace() {
Dart_Handle zircon_lib = Dart_LookupLibrary(ToDart("dart:zircon"));
FML_DCHECK(!tonic::LogIfError(zircon_lib));
Dart_Handle namespace_type =
Dart_GetType(zircon_lib, ToDart("_Namespace"), 0, nullptr);
Dart_GetNonNullableType(zircon_lib, ToDart("_Namespace"), 0, nullptr);
FML_DCHECK(!tonic::LogIfError(namespace_type));
Dart_Handle namespace_field =
Dart_GetField(namespace_type, ToDart("_namespace"));
Expand Down
7 changes: 4 additions & 3 deletions shell/platform/fuchsia/dart_runner/builtin_libraries.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void InitBuiltinLibrariesForIsolate(

// Set up the namespace in dart:io.
Dart_Handle namespace_type =
Dart_GetType(io_lib, ToDart("_Namespace"), 0, nullptr);
Dart_GetNonNullableType(io_lib, ToDart("_Namespace"), 0, nullptr);
FML_CHECK(!tonic::LogIfError(namespace_type));

Dart_Handle namespace_args[1];
Expand All @@ -195,7 +195,8 @@ void InitBuiltinLibrariesForIsolate(
FML_CHECK(!tonic::LogIfError(result));

// Set up the namespace in dart:zircon.
namespace_type = Dart_GetType(zircon_lib, ToDart("_Namespace"), 0, nullptr);
namespace_type =
Dart_GetNonNullableType(zircon_lib, ToDart("_Namespace"), 0, nullptr);
FML_CHECK(!tonic::LogIfError(namespace_type));

result = Dart_SetField(namespace_type, ToDart("_namespace"),
Expand All @@ -212,7 +213,7 @@ void InitBuiltinLibrariesForIsolate(

// Disable some dart:io operations.
Dart_Handle embedder_config_type =
Dart_GetType(io_lib, ToDart("_EmbedderConfig"), 0, nullptr);
Dart_GetNonNullableType(io_lib, ToDart("_EmbedderConfig"), 0, nullptr);
FML_CHECK(!tonic::LogIfError(embedder_config_type));

result =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,13 @@ bool DartComponentController::Main() {
Dart_EnterIsolate(isolate_);
Dart_EnterScope();

Dart_Handle dart_arguments =
Dart_NewListOf(Dart_CoreType_String, arguments.size());
Dart_Handle corelib = Dart_LookupLibrary(ToDart("dart:core"));
Dart_Handle string_type =
Dart_GetNonNullableType(corelib, ToDart("String"), 0, NULL);

Dart_Handle dart_arguments = Dart_NewListOfTypeFilled(
string_type, Dart_EmptyString(), arguments.size());

if (Dart_IsError(dart_arguments)) {
FX_LOGF(ERROR, LOG_TAG, "Failed to allocate Dart arguments list: %s",
Dart_GetError(dart_arguments));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ bool DartComponentControllerV2::RunDartMain() {
// that run in the dart runner are written with main functions that have the
// signature `void main(List<String> args)`. In order to ensure that these
// components do not break we need to have this stub argument list.
Dart_Handle dart_arguments = Dart_NewListOf(Dart_CoreType_String, 0);
Dart_Handle corelib = Dart_LookupLibrary(ToDart("dart:core"));
Dart_Handle string_type =
Dart_GetNonNullableType(corelib, ToDart("String"), 0, NULL);
Dart_Handle dart_arguments =
Dart_NewListOfTypeFilled(string_type, Dart_EmptyString(), 0);

if (Dart_IsError(dart_arguments)) {
FX_LOGF(ERROR, LOG_TAG, "Failed to allocate Dart arguments list: %s",
Expand Down
23 changes: 19 additions & 4 deletions shell/platform/fuchsia/dart_runner/service_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ void EmbedderInformationCallback(Dart_EmbedderInformation* info) {

} // namespace

Dart_Isolate CreateServiceIsolate(const char* uri,
Dart_IsolateFlags* flags,
char** error) {
Dart_Isolate CreateServiceIsolate(
const char* uri,
Dart_IsolateFlags* flags_unused, // These flags are currently unused
char** error) {
Dart_SetEmbedderInformationCallback(EmbedderInformationCallback);

const uint8_t *vmservice_data = nullptr, *vmservice_instructions = nullptr;
Expand Down Expand Up @@ -122,10 +123,24 @@ Dart_Isolate CreateServiceIsolate(const char* uri,
}
#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;

auto state = new std::shared_ptr<tonic::DartState>(new tonic::DartState());
Dart_Isolate isolate = Dart_CreateIsolateGroup(
uri, DART_VM_SERVICE_ISOLATE_NAME, vmservice_data, vmservice_instructions,
nullptr /* flags */, state, state, error);
&flags, state, state, error);
if (!isolate) {
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", *error);
return nullptr;
Expand Down
10 changes: 5 additions & 5 deletions shell/platform/fuchsia/flutter/isolate_configurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ void IsolateConfigurator::BindZircon() {
Dart_Handle zircon_lib = Dart_LookupLibrary(tonic::ToDart("dart:zircon"));
FML_CHECK(!tonic::LogIfError(zircon_lib));

Dart_Handle namespace_type =
Dart_GetType(zircon_lib, tonic::ToDart("_Namespace"), 0, nullptr);
Dart_Handle namespace_type = Dart_GetNonNullableType(
zircon_lib, tonic::ToDart("_Namespace"), 0, nullptr);
FML_CHECK(!tonic::LogIfError(namespace_type));

Dart_Handle result =
Expand All @@ -70,8 +70,8 @@ void IsolateConfigurator::BindDartIO() {
FML_CHECK(!tonic::LogIfError(io_lib));

// Disable dart:io exit()
Dart_Handle embedder_config_type =
Dart_GetType(io_lib, tonic::ToDart("_EmbedderConfig"), 0, nullptr);
Dart_Handle embedder_config_type = Dart_GetNonNullableType(
io_lib, tonic::ToDart("_EmbedderConfig"), 0, nullptr);
FML_CHECK(!tonic::LogIfError(embedder_config_type));

Dart_Handle result = Dart_SetField(embedder_config_type,
Expand All @@ -80,7 +80,7 @@ void IsolateConfigurator::BindDartIO() {

// Tell dart:io about the FDIO namespace configured for this instance.
Dart_Handle namespace_type =
Dart_GetType(io_lib, tonic::ToDart("_Namespace"), 0, nullptr);
Dart_GetNonNullableType(io_lib, tonic::ToDart("_Namespace"), 0, nullptr);
FML_CHECK(!tonic::LogIfError(namespace_type));

Dart_Handle namespace_args[] = {
Expand Down