Skip to content

Commit

Permalink
Create separate objects for isolate state and isolate group state
Browse files Browse the repository at this point in the history
Isolate data may need to be deleted on the same thread where it was allocated.
In particular, the task observer set up in the UIDartState ctor must be removed
from the same message loop where it was added.

The engine had been using the same DartIsolate object as the root isolate data
and as the isolate group data.  This object would be deleted when the isolate
group was shut down.  However, group shutdown may occur on a thread associated
with a secondary isolate.  When this happens, cleanup of any state tied to the
root isolate's thread will fail.

This change adds a DartIsolateGroupData object holding state that is common
among all isolates in a group.  DartIsolateGroupData can be deleted on any
thread.

See flutter/flutter#45578
  • Loading branch information
jason-simmons committed Dec 10, 2019
1 parent a614c0a commit 21373cc
Show file tree
Hide file tree
Showing 7 changed files with 321 additions and 260 deletions.
2 changes: 2 additions & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ FILE: ../../../flutter/lib/web_ui/lib/ui.dart
FILE: ../../../flutter/lib/web_ui/tool/unicode_sync_script.dart
FILE: ../../../flutter/runtime/dart_isolate.cc
FILE: ../../../flutter/runtime/dart_isolate.h
FILE: ../../../flutter/runtime/dart_isolate_group_data.cc
FILE: ../../../flutter/runtime/dart_isolate_group_data.h
FILE: ../../../flutter/runtime/dart_isolate_unittests.cc
FILE: ../../../flutter/runtime/dart_lifecycle_unittests.cc
FILE: ../../../flutter/runtime/dart_service_isolate.cc
Expand Down
2 changes: 2 additions & 0 deletions runtime/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ source_set("runtime") {
sources = [
"dart_isolate.cc",
"dart_isolate.h",
"dart_isolate_group_data.cc",
"dart_isolate_group_data.h",
"dart_service_isolate.cc",
"dart_service_isolate.h",
"dart_snapshot.cc",
Expand Down
Loading

0 comments on commit 21373cc

Please sign in to comment.