From de4db7fbb094568f9d716487009d05115dc58f15 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 17 Jul 2019 10:45:45 -0700 Subject: [PATCH 1/9] Provide dart vm initalize isolate callback so that children isolates belong to parent's isolate group. Without this callback each child isolate is created as a separate isolate group, and Dart VM won't be able to provide performance savings for spawning of those. --- runtime/dart_isolate.cc | 100 ++++++++++++++++++++++++++++++++-------- runtime/dart_isolate.h | 11 +++++ runtime/dart_vm.cc | 2 + 3 files changed, 93 insertions(+), 20 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 55ac852edacd3..90c6f896d846a 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -162,12 +162,6 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { return false; } - auto* isolate_data = static_cast*>( - Dart_IsolateGroupData(dart_isolate)); - if (isolate_data->get() != this) { - return false; - } - // After this point, isolate scopes can be safely used. SetIsolate(dart_isolate); @@ -672,6 +666,53 @@ Dart_Isolate DartIsolate::DartIsolateGroupCreateCallback( .first; } +// |Dart_IsolateInitializeCallback| +bool DartIsolate::DartIsolateInitializeCallback( + void** child_callback_data, + char** error) { + Dart_Isolate isolate = Dart_CurrentIsolate(); + if (isolate == nullptr) { + *error = strdup("Isolate should be available in initialize callback."); + FML_DLOG(ERROR) << *error; + return false; + } + + auto* raw_embedder_isolate = reinterpret_cast*>( + Dart_CurrentIsolateGroupData()); + + TaskRunners null_task_runners((*raw_embedder_isolate)->GetAdvisoryScriptURI(), + /* platform= */ nullptr, /* gpu= */ nullptr, /* ui= */ nullptr, + /* io= */ nullptr); + + std::unique_ptr> embedder_isolate = + std::make_unique>( + std::make_shared( + (*raw_embedder_isolate)->GetSettings(), // settings + (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot + (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot + null_task_runners, // task_runners + fml::WeakPtr{}, // io_manager + fml::WeakPtr{}, // io_manager + (*raw_embedder_isolate)->GetAdvisoryScriptURI(), // advisory_script_uri + (*raw_embedder_isolate)->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint + (*raw_embedder_isolate)->child_isolate_preparer_, // preparer + (*raw_embedder_isolate)->isolate_create_callback_, // on create + (*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown + ) + ); + + // root isolate should have been created via CreateRootIsolate and CreateDartVMAndEmbedderObjectPair + if (!InitializeIsolate(*embedder_isolate, isolate, /*is_root_isolate=*/ false, + error)) { + return false; + } + + *child_callback_data = embedder_isolate.release(); + + Dart_EnterIsolate(isolate); + return true; +} + std::pair> DartIsolate::CreateDartVMAndEmbedderObjectPair( const char* advisory_script_uri, @@ -736,38 +777,57 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( return {nullptr, {}}; } - if (!(*embedder_isolate)->Initialize(isolate, is_root_isolate)) { - *error = strdup("Embedder could not initialize the Dart isolate."); - FML_DLOG(ERROR) << *error; + if (!InitializeIsolate(*embedder_isolate, isolate, is_root_isolate, error)) { return {nullptr, {}}; } - if (!(*embedder_isolate)->LoadLibraries(is_root_isolate)) { - *error = - strdup("Embedder could not load libraries in the new Dart isolate."); + auto* isolate_data = static_cast*>( + Dart_IsolateGroupData(isolate)); + if (isolate_data->get() != embedder_isolate->get()) { + *error = strdup("Unexpected isolate data during initialization."); FML_DLOG(ERROR) << *error; return {nullptr, {}}; } auto weak_embedder_isolate = (*embedder_isolate)->GetWeakIsolatePtr(); + // The ownership of the embedder object is controlled by the Dart VM. So the + // only reference returned to the caller is weak. + embedder_isolate.release(); + return {isolate, weak_embedder_isolate}; +} + +bool DartIsolate::InitializeIsolate( + std::shared_ptr embedder_isolate, + Dart_Isolate& isolate, + bool is_root_isolate, + char** error) { + if (!embedder_isolate->Initialize(isolate, is_root_isolate)) { + *error = strdup("Embedder could not initialize the Dart isolate."); + FML_DLOG(ERROR) << *error; + return false; + } + + if (!embedder_isolate->LoadLibraries(is_root_isolate)) { + *error = + strdup("Embedder could not load libraries in the new Dart isolate."); + FML_DLOG(ERROR) << *error; + return false; + } + // Root isolates will be setup by the engine and the service isolate (which is // also a root isolate) by the utility routines in the VM. However, secondary // isolates will be run by the VM if they are marked as runnable. if (!is_root_isolate) { - FML_DCHECK((*embedder_isolate)->child_isolate_preparer_); - if (!(*embedder_isolate) - ->child_isolate_preparer_((*embedder_isolate).get())) { + FML_DCHECK(embedder_isolate->child_isolate_preparer_); + if (!embedder_isolate->child_isolate_preparer_(embedder_isolate.get())) { *error = strdup("Could not prepare the child isolate to run."); FML_DLOG(ERROR) << *error; - return {nullptr, {}}; + return false; } } - // The ownership of the embedder object is controlled by the Dart VM. So the - // only reference returned to the caller is weak. - embedder_isolate.release(); - return {isolate, weak_embedder_isolate}; + return true; } // |Dart_IsolateShutdownCallback| diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 5689367283a8d..0d1eb2ec514ee 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -165,6 +165,11 @@ class DartIsolate : public UIDartState { std::shared_ptr* embedder_isolate, char** error); + // |Dart_IsolateInitializeCallback| + static bool DartIsolateInitializeCallback( + void** child_callback_data, + char** error); + static Dart_Isolate DartCreateAndStartServiceIsolate( const char* package_root, const char* package_config, @@ -183,6 +188,12 @@ class DartIsolate : public UIDartState { bool is_root_isolate, char** error); + static bool InitializeIsolate( + std::shared_ptr embedder_isolate, + Dart_Isolate& isolate, + bool is_root_isolate, + char** error); + // |Dart_IsolateShutdownCallback| static void DartIsolateShutdownCallback( std::shared_ptr* isolate_group_data, diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 78d8cb42f9a5e..bbc0d56fda9ee 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -369,6 +369,8 @@ DartVM::DartVM(std::shared_ptr vm_data, vm_data_->GetVMSnapshot().GetInstructionsMapping(); params.create_group = reinterpret_cast( DartIsolate::DartIsolateGroupCreateCallback); + params.initialize_isolate = reinterpret_cast( + DartIsolate::DartIsolateInitializeCallback); params.shutdown_isolate = reinterpret_cast( DartIsolate::DartIsolateShutdownCallback); From 5a545f8bfa62552d0126dd9faf7d7039f44c4803 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 17 Jul 2019 12:15:50 -0700 Subject: [PATCH 2/9] Fix formatting, add traces --- runtime/dart_isolate.cc | 51 ++++++++++++++++++++++------------------- runtime/dart_isolate.h | 14 +++++------ runtime/dart_vm.cc | 5 ++-- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 90c6f896d846a..09cd7e7724c83 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -639,6 +639,7 @@ Dart_Isolate DartIsolate::DartIsolateGroupCreateCallback( Dart_IsolateFlags* flags, std::shared_ptr* parent_embedder_isolate, char** error) { + TRACE_EVENT0("flutter", "DartIsolate::DartIsolateGroupCreateCallback"); if (parent_embedder_isolate == nullptr && strcmp(advisory_script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0) { // The VM attempts to start the VM service for us on |Dart_Initialize|. In @@ -667,9 +668,9 @@ Dart_Isolate DartIsolate::DartIsolateGroupCreateCallback( } // |Dart_IsolateInitializeCallback| -bool DartIsolate::DartIsolateInitializeCallback( - void** child_callback_data, - char** error) { +bool DartIsolate::DartIsolateInitializeCallback(void** child_callback_data, + char** error) { + TRACE_EVENT0("flutter", "DartIsolate::DartIsolateInitializeCallback"); Dart_Isolate isolate = Dart_CurrentIsolate(); if (isolate == nullptr) { *error = strdup("Isolate should be available in initialize callback."); @@ -681,29 +682,32 @@ bool DartIsolate::DartIsolateInitializeCallback( Dart_CurrentIsolateGroupData()); TaskRunners null_task_runners((*raw_embedder_isolate)->GetAdvisoryScriptURI(), - /* platform= */ nullptr, /* gpu= */ nullptr, /* ui= */ nullptr, - /* io= */ nullptr); + /* platform= */ nullptr, /* gpu= */ nullptr, + /* ui= */ nullptr, + /* io= */ nullptr); std::unique_ptr> embedder_isolate = - std::make_unique>( - std::make_shared( - (*raw_embedder_isolate)->GetSettings(), // settings - (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot - (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot - null_task_runners, // task_runners - fml::WeakPtr{}, // io_manager - fml::WeakPtr{}, // io_manager - (*raw_embedder_isolate)->GetAdvisoryScriptURI(), // advisory_script_uri - (*raw_embedder_isolate)->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint - (*raw_embedder_isolate)->child_isolate_preparer_, // preparer - (*raw_embedder_isolate)->isolate_create_callback_, // on create - (*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown - ) - ); + std::make_unique< + std::shared_ptr>(std::make_shared( + (*raw_embedder_isolate)->GetSettings(), // settings + (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot + (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot + null_task_runners, // task_runners + fml::WeakPtr{}, // io_manager + fml::WeakPtr{}, // io_manager + (*raw_embedder_isolate) + ->GetAdvisoryScriptURI(), // advisory_script_uri + (*raw_embedder_isolate) + ->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint + (*raw_embedder_isolate)->child_isolate_preparer_, // preparer + (*raw_embedder_isolate)->isolate_create_callback_, // on create + (*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown + )); - // root isolate should have been created via CreateRootIsolate and CreateDartVMAndEmbedderObjectPair - if (!InitializeIsolate(*embedder_isolate, isolate, /*is_root_isolate=*/ false, - error)) { + // root isolate should have been created via CreateRootIsolate and + // CreateDartVMAndEmbedderObjectPair + if (!InitializeIsolate(*embedder_isolate, isolate, /*is_root_isolate=*/false, + error)) { return false; } @@ -802,6 +806,7 @@ bool DartIsolate::InitializeIsolate( Dart_Isolate& isolate, bool is_root_isolate, char** error) { + TRACE_EVENT0("flutter", "DartIsolate::InitializeIsolate"); if (!embedder_isolate->Initialize(isolate, is_root_isolate)) { *error = strdup("Embedder could not initialize the Dart isolate."); FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 0d1eb2ec514ee..4958af9708676 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -166,9 +166,8 @@ class DartIsolate : public UIDartState { char** error); // |Dart_IsolateInitializeCallback| - static bool DartIsolateInitializeCallback( - void** child_callback_data, - char** error); + static bool DartIsolateInitializeCallback(void** child_callback_data, + char** error); static Dart_Isolate DartCreateAndStartServiceIsolate( const char* package_root, @@ -188,11 +187,10 @@ class DartIsolate : public UIDartState { bool is_root_isolate, char** error); - static bool InitializeIsolate( - std::shared_ptr embedder_isolate, - Dart_Isolate& isolate, - bool is_root_isolate, - char** error); + static bool InitializeIsolate(std::shared_ptr embedder_isolate, + Dart_Isolate& isolate, + bool is_root_isolate, + char** error); // |Dart_IsolateShutdownCallback| static void DartIsolateShutdownCallback( diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index bbc0d56fda9ee..f86de1098b24c 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -369,8 +369,9 @@ DartVM::DartVM(std::shared_ptr vm_data, vm_data_->GetVMSnapshot().GetInstructionsMapping(); params.create_group = reinterpret_cast( DartIsolate::DartIsolateGroupCreateCallback); - params.initialize_isolate = reinterpret_cast( - DartIsolate::DartIsolateInitializeCallback); + params.initialize_isolate = + reinterpret_cast( + DartIsolate::DartIsolateInitializeCallback); params.shutdown_isolate = reinterpret_cast( DartIsolate::DartIsolateShutdownCallback); From 5a8ea6d20b0130e3194e5454150c0ffed2827077 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Mon, 12 Aug 2019 07:40:46 -0700 Subject: [PATCH 3/9] Cleanup isolate data --- runtime/dart_isolate.cc | 10 ++++++++++ runtime/dart_isolate.h | 4 ++++ runtime/dart_vm.cc | 3 +++ 3 files changed, 17 insertions(+) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 09cd7e7724c83..8e46243c6ca18 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -848,6 +848,16 @@ void DartIsolate::DartIsolateGroupCleanupCallback( delete isolate_data; } +// |Dart_IsolateCleanupCallback| +void DartIsolate::DartIsolateCleanupCallback( + std::shared_ptr* isolate_data) { + if (!isolate_data->get()->window()) { + // Main/UI-isolate's data will be cleaned up as part of IsolateGroup + // cleanup. + delete isolate_data; + } +} + fml::RefPtr DartIsolate::GetIsolateSnapshot() const { return isolate_snapshot_; } diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 4958af9708676..26bf380ec66b9 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -197,6 +197,10 @@ class DartIsolate : public UIDartState { std::shared_ptr* isolate_group_data, std::shared_ptr* isolate_data); + // |Dart_IsolateCleanupCallback| + static void DartIsolateCleanupCallback( + std::shared_ptr* isolate_group_data); + // |Dart_IsolateGroupCleanupCallback| static void DartIsolateGroupCleanupCallback( std::shared_ptr* isolate_group_data); diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index a253e3c1ecd26..5576f45077def 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -388,6 +388,9 @@ DartVM::DartVM(std::shared_ptr vm_data, params.shutdown_isolate = reinterpret_cast( DartIsolate::DartIsolateShutdownCallback); + params.cleanup_isolate = + reinterpret_cast( + DartIsolate::DartIsolateCleanupCallback); params.cleanup_group = reinterpret_cast( DartIsolate::DartIsolateGroupCleanupCallback); params.thread_exit = ThreadExitCallback; From 4905403639bb18a4b693660d3e9b2b02c7f3fa79 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Mon, 12 Aug 2019 08:44:40 -0700 Subject: [PATCH 4/9] Igore isolate shutdown for service isolate --- runtime/dart_isolate.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 8e46243c6ca18..8c2ebd4d002f6 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -839,6 +839,7 @@ bool DartIsolate::InitializeIsolate( void DartIsolate::DartIsolateShutdownCallback( std::shared_ptr* isolate_group_data, std::shared_ptr* isolate_data) { + TRACE_EVENT0("flutter", "DartIsolate::DartIsolateShutdownCallback"); isolate_group_data->get()->OnShutdownCallback(); } @@ -851,8 +852,11 @@ void DartIsolate::DartIsolateGroupCleanupCallback( // |Dart_IsolateCleanupCallback| void DartIsolate::DartIsolateCleanupCallback( std::shared_ptr* isolate_data) { - if (!isolate_data->get()->window()) { - // Main/UI-isolate's data will be cleaned up as part of IsolateGroup + TRACE_EVENT0("flutter", "DartIsolate::DartIsolateCleanupCallback"); + + if (isolate_data->get()->window() == nullptr && + isolate_data->get()->GetAdvisoryScriptURI().compare(DART_VM_SERVICE_ISOLATE_NAME) != 0) { + // Main/UI-isolate's and service isolate data will be cleaned up as part of IsolateGroup // cleanup. delete isolate_data; } From 8553cbf4df6a9677a27b703f750a9dd6b6541e20 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Mon, 12 Aug 2019 08:53:01 -0700 Subject: [PATCH 5/9] Reformat --- runtime/dart_isolate.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 8c2ebd4d002f6..970ded872711d 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -855,9 +855,10 @@ void DartIsolate::DartIsolateCleanupCallback( TRACE_EVENT0("flutter", "DartIsolate::DartIsolateCleanupCallback"); if (isolate_data->get()->window() == nullptr && - isolate_data->get()->GetAdvisoryScriptURI().compare(DART_VM_SERVICE_ISOLATE_NAME) != 0) { - // Main/UI-isolate's and service isolate data will be cleaned up as part of IsolateGroup - // cleanup. + isolate_data->get()->GetAdvisoryScriptURI().compare( + DART_VM_SERVICE_ISOLATE_NAME) != 0) { + // Main/UI-isolate's and service isolate data will be cleaned up as part of + // IsolateGroup cleanup. delete isolate_data; } } From e40a253bcf0c33d310156b01bf27da0c38597d03 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Mon, 12 Aug 2019 09:59:56 -0700 Subject: [PATCH 6/9] window() check is not reliable, introduce is_root_isolate property --- runtime/dart_isolate.cc | 60 +++++++++++++++++++++-------------------- runtime/dart_isolate.h | 16 ++++++----- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 970ded872711d..9ca452dbc4c6f 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -66,7 +66,8 @@ std::weak_ptr DartIsolate::CreateRootIsolate( advisory_script_entrypoint, // advisory entrypoint nullptr, // child isolate preparer isolate_create_callback, // isolate create callback - isolate_shutdown_callback // isolate shutdown callback + isolate_shutdown_callback, // isolate shutdown callback, + true // is_root_isolate )); std::tie(vm_isolate, embedder_isolate) = CreateDartVMAndEmbedderObjectPair( @@ -110,7 +111,8 @@ DartIsolate::DartIsolate(const Settings& settings, std::string advisory_script_entrypoint, ChildIsolatePreparer child_isolate_preparer, fml::closure isolate_create_callback, - fml::closure isolate_shutdown_callback) + fml::closure isolate_shutdown_callback, + const bool is_root_isolate) : UIDartState(std::move(task_runners), settings.task_observer_add, settings.task_observer_remove, @@ -126,7 +128,8 @@ DartIsolate::DartIsolate(const Settings& settings, shared_snapshot_(std::move(shared_snapshot)), child_isolate_preparer_(std::move(child_isolate_preparer)), isolate_create_callback_(isolate_create_callback), - isolate_shutdown_callback_(isolate_shutdown_callback) { + isolate_shutdown_callback_(isolate_shutdown_callback), + is_root_isolate_(is_root_isolate) { FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot."; phase_ = Phase::Uninitialized; } @@ -148,7 +151,7 @@ std::string DartIsolate::GetServiceId() { return service_id; } -bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { +bool DartIsolate::Initialize(Dart_Isolate dart_isolate) { TRACE_EVENT0("flutter", "DartIsolate::Initialize"); if (phase_ != Phase::Uninitialized) { return false; @@ -173,8 +176,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { tonic::DartIsolateScope scope(isolate()); - SetMessageHandlingTaskRunner(GetTaskRunners().GetUITaskRunner(), - is_root_isolate); + SetMessageHandlingTaskRunner(GetTaskRunners().GetUITaskRunner()); if (tonic::LogIfError( Dart_SetLibraryTagHandler(tonic::DartState::HandleLibraryTag))) { @@ -194,9 +196,8 @@ fml::RefPtr DartIsolate::GetMessageHandlingTaskRunner() const { } void DartIsolate::SetMessageHandlingTaskRunner( - fml::RefPtr runner, - bool is_root_isolate) { - if (!is_root_isolate || !runner) { + fml::RefPtr runner) { + if (!IsRootIsolate() || !runner) { return; } @@ -245,7 +246,7 @@ bool DartIsolate::UpdateThreadPoolNames() const { return true; } -bool DartIsolate::LoadLibraries(bool is_root_isolate) { +bool DartIsolate::LoadLibraries() { TRACE_EVENT0("flutter", "DartIsolate::LoadLibraries"); if (phase_ != Phase::Initialized) { return false; @@ -255,11 +256,11 @@ bool DartIsolate::LoadLibraries(bool is_root_isolate) { DartIO::InitForIsolate(); - DartUI::InitForIsolate(is_root_isolate); + DartUI::InitForIsolate(IsRootIsolate()); const bool is_service_isolate = Dart_IsServiceIsolate(isolate()); - DartRuntimeHooks::Install(is_root_isolate && !is_service_isolate, + DartRuntimeHooks::Install(IsRootIsolate() && !is_service_isolate, GetAdvisoryScriptURI()); if (!is_service_isolate) { @@ -699,15 +700,15 @@ bool DartIsolate::DartIsolateInitializeCallback(void** child_callback_data, ->GetAdvisoryScriptURI(), // advisory_script_uri (*raw_embedder_isolate) ->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint - (*raw_embedder_isolate)->child_isolate_preparer_, // preparer - (*raw_embedder_isolate)->isolate_create_callback_, // on create - (*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown + (*raw_embedder_isolate)->child_isolate_preparer_, // preparer + (*raw_embedder_isolate)->isolate_create_callback_, // on create + (*raw_embedder_isolate)->isolate_shutdown_callback_, // on shutdown + false // is_root_isolate )); // root isolate should have been created via CreateRootIsolate and // CreateDartVMAndEmbedderObjectPair - if (!InitializeIsolate(*embedder_isolate, isolate, /*is_root_isolate=*/false, - error)) { + if (!InitializeIsolate(*embedder_isolate, isolate, error)) { return false; } @@ -756,10 +757,10 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( fml::WeakPtr{}, // io_manager advisory_script_uri, // advisory_script_uri advisory_script_entrypoint, // advisory_script_entrypoint - (*raw_embedder_isolate)->child_isolate_preparer_, // preparer - (*raw_embedder_isolate)->isolate_create_callback_, // on create - (*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown - ) + (*raw_embedder_isolate)->child_isolate_preparer_, // preparer + (*raw_embedder_isolate)->isolate_create_callback_, // on create + (*raw_embedder_isolate)->isolate_shutdown_callback_, // on shutdown + is_root_isolate) ); } @@ -781,7 +782,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( return {nullptr, {}}; } - if (!InitializeIsolate(*embedder_isolate, isolate, is_root_isolate, error)) { + if (!InitializeIsolate(*embedder_isolate, isolate, error)) { return {nullptr, {}}; } @@ -804,16 +805,15 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( bool DartIsolate::InitializeIsolate( std::shared_ptr embedder_isolate, Dart_Isolate& isolate, - bool is_root_isolate, char** error) { TRACE_EVENT0("flutter", "DartIsolate::InitializeIsolate"); - if (!embedder_isolate->Initialize(isolate, is_root_isolate)) { + if (!embedder_isolate->Initialize(isolate)) { *error = strdup("Embedder could not initialize the Dart isolate."); FML_DLOG(ERROR) << *error; return false; } - if (!embedder_isolate->LoadLibraries(is_root_isolate)) { + if (!embedder_isolate->LoadLibraries()) { *error = strdup("Embedder could not load libraries in the new Dart isolate."); FML_DLOG(ERROR) << *error; @@ -823,7 +823,7 @@ bool DartIsolate::InitializeIsolate( // Root isolates will be setup by the engine and the service isolate (which is // also a root isolate) by the utility routines in the VM. However, secondary // isolates will be run by the VM if they are marked as runnable. - if (!is_root_isolate) { + if (!embedder_isolate->IsRootIsolate()) { FML_DCHECK(embedder_isolate->child_isolate_preparer_); if (!embedder_isolate->child_isolate_preparer_(embedder_isolate.get())) { *error = strdup("Could not prepare the child isolate to run."); @@ -846,6 +846,8 @@ void DartIsolate::DartIsolateShutdownCallback( // |Dart_IsolateGroupCleanupCallback| void DartIsolate::DartIsolateGroupCleanupCallback( std::shared_ptr* isolate_data) { + FML_DLOG(ERROR) << "DartIsolateGroupCleanupCallback isolate_data:" + << isolate_data << "\n"; delete isolate_data; } @@ -854,9 +856,9 @@ void DartIsolate::DartIsolateCleanupCallback( std::shared_ptr* isolate_data) { TRACE_EVENT0("flutter", "DartIsolate::DartIsolateCleanupCallback"); - if (isolate_data->get()->window() == nullptr && - isolate_data->get()->GetAdvisoryScriptURI().compare( - DART_VM_SERVICE_ISOLATE_NAME) != 0) { + if (!isolate_data->get()->IsRootIsolate()) { + FML_DLOG(ERROR) << "DartIsolateCleanupCallback isolate_data:" + << isolate_data << "\n"; // Main/UI-isolate's and service isolate data will be cleaned up as part of // IsolateGroup cleanup. delete isolate_data; diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 26bf380ec66b9..e29ed651c7409 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -64,7 +64,8 @@ class DartIsolate : public UIDartState { std::string advisory_script_entrypoint, ChildIsolatePreparer child_isolate_preparer, fml::closure isolate_create_callback, - fml::closure isolate_shutdown_callback); + fml::closure isolate_shutdown_callback, + const bool is_root_isolate); ~DartIsolate() override; @@ -113,6 +114,8 @@ class DartIsolate : public UIDartState { fml::RefPtr GetMessageHandlingTaskRunner() const; + bool IsRootIsolate() const { return is_root_isolate_; } + private: bool LoadKernel(std::shared_ptr mapping, bool last_piece); @@ -139,14 +142,14 @@ class DartIsolate : public UIDartState { const fml::closure isolate_create_callback_; const fml::closure isolate_shutdown_callback_; - FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate, - bool is_root_isolate); + const bool is_root_isolate_; + + FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate); - void SetMessageHandlingTaskRunner(fml::RefPtr runner, - bool is_root_isolate); + void SetMessageHandlingTaskRunner(fml::RefPtr runner); FML_WARN_UNUSED_RESULT - bool LoadLibraries(bool is_root_isolate); + bool LoadLibraries(); bool UpdateThreadPoolNames() const; @@ -189,7 +192,6 @@ class DartIsolate : public UIDartState { static bool InitializeIsolate(std::shared_ptr embedder_isolate, Dart_Isolate& isolate, - bool is_root_isolate, char** error); // |Dart_IsolateShutdownCallback| From 553407e198d2f3ab7f83b3eeaef6e6c0c0028897 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 28 Aug 2019 16:57:09 -0700 Subject: [PATCH 7/9] Introduce is_group_root_isolate, fix DartIsolateCleanupCallback type --- runtime/dart_isolate.cc | 87 ++++++++++++++++++++++++----------------- runtime/dart_isolate.h | 14 +++++-- runtime/dart_vm.cc | 2 +- 3 files changed, 64 insertions(+), 39 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 9ca452dbc4c6f..31d220c1a8cab 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -67,7 +67,8 @@ std::weak_ptr DartIsolate::CreateRootIsolate( nullptr, // child isolate preparer isolate_create_callback, // isolate create callback isolate_shutdown_callback, // isolate shutdown callback, - true // is_root_isolate + true, // is_root_isolate + true // is_group_root_isolate )); std::tie(vm_isolate, embedder_isolate) = CreateDartVMAndEmbedderObjectPair( @@ -112,7 +113,8 @@ DartIsolate::DartIsolate(const Settings& settings, ChildIsolatePreparer child_isolate_preparer, fml::closure isolate_create_callback, fml::closure isolate_shutdown_callback, - const bool is_root_isolate) + const bool is_root_isolate, + const bool is_group_root_isolate) : UIDartState(std::move(task_runners), settings.task_observer_add, settings.task_observer_remove, @@ -129,7 +131,8 @@ DartIsolate::DartIsolate(const Settings& settings, child_isolate_preparer_(std::move(child_isolate_preparer)), isolate_create_callback_(isolate_create_callback), isolate_shutdown_callback_(isolate_shutdown_callback), - is_root_isolate_(is_root_isolate) { + is_root_isolate_(is_root_isolate), + is_group_root_isolate_(is_group_root_isolate) { FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot."; phase_ = Phase::Uninitialized; } @@ -679,32 +682,31 @@ bool DartIsolate::DartIsolateInitializeCallback(void** child_callback_data, return false; } - auto* raw_embedder_isolate = reinterpret_cast*>( + auto* root_embedder_isolate = static_cast*>( Dart_CurrentIsolateGroupData()); - TaskRunners null_task_runners((*raw_embedder_isolate)->GetAdvisoryScriptURI(), + TaskRunners null_task_runners((*root_embedder_isolate)->GetAdvisoryScriptURI(), /* platform= */ nullptr, /* gpu= */ nullptr, /* ui= */ nullptr, /* io= */ nullptr); - std::unique_ptr> embedder_isolate = - std::make_unique< - std::shared_ptr>(std::make_shared( - (*raw_embedder_isolate)->GetSettings(), // settings - (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot - (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot - null_task_runners, // task_runners - fml::WeakPtr{}, // io_manager - fml::WeakPtr{}, // io_manager - (*raw_embedder_isolate) - ->GetAdvisoryScriptURI(), // advisory_script_uri - (*raw_embedder_isolate) - ->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint - (*raw_embedder_isolate)->child_isolate_preparer_, // preparer - (*raw_embedder_isolate)->isolate_create_callback_, // on create - (*raw_embedder_isolate)->isolate_shutdown_callback_, // on shutdown - false // is_root_isolate - )); + auto embedder_isolate = std::make_unique< + std::shared_ptr>(std::make_shared( + (*root_embedder_isolate)->GetSettings(), // settings + (*root_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot + (*root_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot + null_task_runners, // task_runners + fml::WeakPtr{}, // io_manager + fml::WeakPtr{}, // io_manager + (*root_embedder_isolate) + ->GetAdvisoryScriptURI(), // advisory_script_uri + (*root_embedder_isolate) + ->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint + (*root_embedder_isolate)->child_isolate_preparer_, // preparer + (*root_embedder_isolate)->isolate_create_callback_, // on create + (*root_embedder_isolate)->isolate_shutdown_callback_, // on shutdown + false, // is_root_isolate + false)); // is_group_root_isolate // root isolate should have been created via CreateRootIsolate and // CreateDartVMAndEmbedderObjectPair @@ -712,6 +714,8 @@ bool DartIsolate::DartIsolateInitializeCallback(void** child_callback_data, return false; } + // The ownership of the embedder object is controlled by the Dart VM. So the + // only reference returned to the caller is weak. *child_callback_data = embedder_isolate.release(); Dart_EnterIsolate(isolate); @@ -760,9 +764,8 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( (*raw_embedder_isolate)->child_isolate_preparer_, // preparer (*raw_embedder_isolate)->isolate_create_callback_, // on create (*raw_embedder_isolate)->isolate_shutdown_callback_, // on shutdown - is_root_isolate) - - ); + is_root_isolate, + true)); // is_root_group_isolate } // Create the Dart VM isolate and give it the embedder object as the baton. @@ -804,7 +807,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( bool DartIsolate::InitializeIsolate( std::shared_ptr embedder_isolate, - Dart_Isolate& isolate, + Dart_Isolate isolate, char** error) { TRACE_EVENT0("flutter", "DartIsolate::InitializeIsolate"); if (!embedder_isolate->Initialize(isolate)) { @@ -846,23 +849,37 @@ void DartIsolate::DartIsolateShutdownCallback( // |Dart_IsolateGroupCleanupCallback| void DartIsolate::DartIsolateGroupCleanupCallback( std::shared_ptr* isolate_data) { - FML_DLOG(ERROR) << "DartIsolateGroupCleanupCallback isolate_data:" - << isolate_data << "\n"; + TRACE_EVENT0("flutter", "DartIsolate::DartIsolateGroupCleanupCallback"); + FML_DLOG(INFO) << "DartIsolateGroupCleanupCallback isolate_data " << isolate_data; + delete isolate_data; } // |Dart_IsolateCleanupCallback| void DartIsolate::DartIsolateCleanupCallback( + std::shared_ptr* isolate_group_data, std::shared_ptr* isolate_data) { TRACE_EVENT0("flutter", "DartIsolate::DartIsolateCleanupCallback"); - if (!isolate_data->get()->IsRootIsolate()) { - FML_DLOG(ERROR) << "DartIsolateCleanupCallback isolate_data:" - << isolate_data << "\n"; - // Main/UI-isolate's and service isolate data will be cleaned up as part of - // IsolateGroup cleanup. - delete isolate_data; + if ((*isolate_data)->IsRootIsolate()) { + // isolate_data will be cleaned up as part of IsolateGroup cleanup + FML_DLOG(INFO) << "DartIsolateCleanupCallback no-op for root isolate isolate_data " + << isolate_data; + return; + } + if ((*isolate_data)->IsGroupRootIsolate()) { + // Even if isolate was not a root isolate(i.e. was spawned), + // it might have IsolateGroup created for it (when + // --no-enable-isolate-groups dart vm flag is used). + // Then its isolate_data will be cleaned up as part of IsolateGroup + // cleanup as well. + FML_DLOG(INFO) << "DartIsolateCleanupCallback no-op for group root isolate isolate_data " + << isolate_data; + return; } + + FML_DLOG(INFO) << "DartIsolateCleanupCallback cleaned up isolate_data " << isolate_data; + delete isolate_data; } fml::RefPtr DartIsolate::GetIsolateSnapshot() const { diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index e29ed651c7409..0aac4c6e245a5 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -65,7 +65,8 @@ class DartIsolate : public UIDartState { ChildIsolatePreparer child_isolate_preparer, fml::closure isolate_create_callback, fml::closure isolate_shutdown_callback, - const bool is_root_isolate); + const bool is_root_isolate, + const bool is_group_root_isolate); ~DartIsolate() override; @@ -114,7 +115,12 @@ class DartIsolate : public UIDartState { fml::RefPtr GetMessageHandlingTaskRunner() const; + // Root isolate of the VM application bool IsRootIsolate() const { return is_root_isolate_; } + // Isolate that owns IsolateGroup it lives in. + // When --no-enable-isolate-groups dart vm flag is set, + // all child isolates will have their own IsolateGroups. + bool IsGroupRootIsolate() const { return is_group_root_isolate_; } private: bool LoadKernel(std::shared_ptr mapping, bool last_piece); @@ -143,6 +149,7 @@ class DartIsolate : public UIDartState { const fml::closure isolate_shutdown_callback_; const bool is_root_isolate_; + const bool is_group_root_isolate_; FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate); @@ -191,7 +198,7 @@ class DartIsolate : public UIDartState { char** error); static bool InitializeIsolate(std::shared_ptr embedder_isolate, - Dart_Isolate& isolate, + Dart_Isolate isolate, char** error); // |Dart_IsolateShutdownCallback| @@ -201,7 +208,8 @@ class DartIsolate : public UIDartState { // |Dart_IsolateCleanupCallback| static void DartIsolateCleanupCallback( - std::shared_ptr* isolate_group_data); + std::shared_ptr* isolate_group_data, + std::shared_ptr* isolate_data); // |Dart_IsolateGroupCleanupCallback| static void DartIsolateGroupCleanupCallback( diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index bf21765bbb0df..5576c2e806ac0 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -402,7 +402,7 @@ DartVM::DartVM(std::shared_ptr vm_data, reinterpret_cast( DartIsolate::DartIsolateShutdownCallback); params.cleanup_isolate = - reinterpret_cast( + reinterpret_cast( DartIsolate::DartIsolateCleanupCallback); params.cleanup_group = reinterpret_cast( DartIsolate::DartIsolateGroupCleanupCallback); From 6bfaa05d4d700c7fe642ed4dbefae216935caa66 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 28 Aug 2019 22:08:37 -0700 Subject: [PATCH 8/9] Run ci/format.sh --- runtime/dart_isolate.cc | 61 ++++++++++++++++++++++------------------- runtime/dart_isolate.h | 4 +-- runtime/dart_vm.cc | 5 ++-- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 31d220c1a8cab..0a2891ceefc09 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -685,28 +685,29 @@ bool DartIsolate::DartIsolateInitializeCallback(void** child_callback_data, auto* root_embedder_isolate = static_cast*>( Dart_CurrentIsolateGroupData()); - TaskRunners null_task_runners((*root_embedder_isolate)->GetAdvisoryScriptURI(), - /* platform= */ nullptr, /* gpu= */ nullptr, - /* ui= */ nullptr, - /* io= */ nullptr); - - auto embedder_isolate = std::make_unique< - std::shared_ptr>(std::make_shared( - (*root_embedder_isolate)->GetSettings(), // settings - (*root_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot - (*root_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot - null_task_runners, // task_runners - fml::WeakPtr{}, // io_manager - fml::WeakPtr{}, // io_manager - (*root_embedder_isolate) - ->GetAdvisoryScriptURI(), // advisory_script_uri - (*root_embedder_isolate) - ->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint - (*root_embedder_isolate)->child_isolate_preparer_, // preparer - (*root_embedder_isolate)->isolate_create_callback_, // on create - (*root_embedder_isolate)->isolate_shutdown_callback_, // on shutdown - false, // is_root_isolate - false)); // is_group_root_isolate + TaskRunners null_task_runners( + (*root_embedder_isolate)->GetAdvisoryScriptURI(), + /* platform= */ nullptr, /* gpu= */ nullptr, + /* ui= */ nullptr, + /* io= */ nullptr); + + auto embedder_isolate = std::make_unique>( + std::make_shared( + (*root_embedder_isolate)->GetSettings(), // settings + (*root_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot + (*root_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot + null_task_runners, // task_runners + fml::WeakPtr{}, // io_manager + fml::WeakPtr{}, // io_manager + (*root_embedder_isolate) + ->GetAdvisoryScriptURI(), // advisory_script_uri + (*root_embedder_isolate) + ->GetAdvisoryScriptEntrypoint(), // advisory_script_entrypoint + (*root_embedder_isolate)->child_isolate_preparer_, // preparer + (*root_embedder_isolate)->isolate_create_callback_, // on create + (*root_embedder_isolate)->isolate_shutdown_callback_, // on shutdown + false, // is_root_isolate + false)); // is_group_root_isolate // root isolate should have been created via CreateRootIsolate and // CreateDartVMAndEmbedderObjectPair @@ -765,7 +766,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( (*raw_embedder_isolate)->isolate_create_callback_, // on create (*raw_embedder_isolate)->isolate_shutdown_callback_, // on shutdown is_root_isolate, - true)); // is_root_group_isolate + true)); // is_root_group_isolate } // Create the Dart VM isolate and give it the embedder object as the baton. @@ -850,7 +851,8 @@ void DartIsolate::DartIsolateShutdownCallback( void DartIsolate::DartIsolateGroupCleanupCallback( std::shared_ptr* isolate_data) { TRACE_EVENT0("flutter", "DartIsolate::DartIsolateGroupCleanupCallback"); - FML_DLOG(INFO) << "DartIsolateGroupCleanupCallback isolate_data " << isolate_data; + FML_DLOG(INFO) << "DartIsolateGroupCleanupCallback isolate_data " + << isolate_data; delete isolate_data; } @@ -863,8 +865,9 @@ void DartIsolate::DartIsolateCleanupCallback( if ((*isolate_data)->IsRootIsolate()) { // isolate_data will be cleaned up as part of IsolateGroup cleanup - FML_DLOG(INFO) << "DartIsolateCleanupCallback no-op for root isolate isolate_data " - << isolate_data; + FML_DLOG(INFO) + << "DartIsolateCleanupCallback no-op for root isolate isolate_data " + << isolate_data; return; } if ((*isolate_data)->IsGroupRootIsolate()) { @@ -873,12 +876,14 @@ void DartIsolate::DartIsolateCleanupCallback( // --no-enable-isolate-groups dart vm flag is used). // Then its isolate_data will be cleaned up as part of IsolateGroup // cleanup as well. - FML_DLOG(INFO) << "DartIsolateCleanupCallback no-op for group root isolate isolate_data " + FML_DLOG(INFO) << "DartIsolateCleanupCallback no-op for group root isolate " + "isolate_data " << isolate_data; return; } - FML_DLOG(INFO) << "DartIsolateCleanupCallback cleaned up isolate_data " << isolate_data; + FML_DLOG(INFO) << "DartIsolateCleanupCallback cleaned up isolate_data " + << isolate_data; delete isolate_data; } diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 0aac4c6e245a5..84caa1e5779ea 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -208,8 +208,8 @@ class DartIsolate : public UIDartState { // |Dart_IsolateCleanupCallback| static void DartIsolateCleanupCallback( - std::shared_ptr* isolate_group_data, - std::shared_ptr* isolate_data); + std::shared_ptr* isolate_group_data, + std::shared_ptr* isolate_data); // |Dart_IsolateGroupCleanupCallback| static void DartIsolateGroupCleanupCallback( diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 5576c2e806ac0..a3e3cc06ce3f7 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -401,9 +401,8 @@ DartVM::DartVM(std::shared_ptr vm_data, params.shutdown_isolate = reinterpret_cast( DartIsolate::DartIsolateShutdownCallback); - params.cleanup_isolate = - reinterpret_cast( - DartIsolate::DartIsolateCleanupCallback); + params.cleanup_isolate = reinterpret_cast( + DartIsolate::DartIsolateCleanupCallback); params.cleanup_group = reinterpret_cast( DartIsolate::DartIsolateGroupCleanupCallback); params.thread_exit = ThreadExitCallback; From 0dfecf889be78069f5b25aacfa5992d63796829a Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 4 Sep 2019 08:50:25 -0700 Subject: [PATCH 9/9] Get rid of consts, introduce FML_DCHECK --- runtime/dart_isolate.cc | 10 +++------- runtime/dart_isolate.h | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 0a2891ceefc09..f3a526a516c97 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -113,8 +113,8 @@ DartIsolate::DartIsolate(const Settings& settings, ChildIsolatePreparer child_isolate_preparer, fml::closure isolate_create_callback, fml::closure isolate_shutdown_callback, - const bool is_root_isolate, - const bool is_group_root_isolate) + bool is_root_isolate, + bool is_group_root_isolate) : UIDartState(std::move(task_runners), settings.task_observer_add, settings.task_observer_remove, @@ -792,11 +792,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( auto* isolate_data = static_cast*>( Dart_IsolateGroupData(isolate)); - if (isolate_data->get() != embedder_isolate->get()) { - *error = strdup("Unexpected isolate data during initialization."); - FML_DLOG(ERROR) << *error; - return {nullptr, {}}; - } + FML_DCHECK(isolate_data->get() == embedder_isolate->get()); auto weak_embedder_isolate = (*embedder_isolate)->GetWeakIsolatePtr(); diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 84caa1e5779ea..0095862ee63e3 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -65,8 +65,8 @@ class DartIsolate : public UIDartState { ChildIsolatePreparer child_isolate_preparer, fml::closure isolate_create_callback, fml::closure isolate_shutdown_callback, - const bool is_root_isolate, - const bool is_group_root_isolate); + bool is_root_isolate, + bool is_group_root_isolate); ~DartIsolate() override;