-
Notifications
You must be signed in to change notification settings - Fork 6k
Plumbing refactor to allow the usage of Dart_CreateIsolateInGroup #23549
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
| #include "flutter/lib/ui/io_manager.h" | ||
| #include "flutter/lib/ui/snapshot_delegate.h" | ||
| #include "flutter/lib/ui/ui_dart_state.h" | ||
| #include "flutter/lib/ui/volatile_path_tracker.h" | ||
| #include "flutter/lib/ui/window/platform_configuration.h" | ||
| #include "flutter/runtime/dart_snapshot.h" | ||
| #include "third_party/dart/runtime/include/dart_api.h" | ||
|
|
@@ -232,7 +231,33 @@ class DartIsolate : public UIDartState { | |
| std::optional<std::string> dart_entrypoint, | ||
| std::optional<std::string> dart_entrypoint_library, | ||
| std::unique_ptr<IsolateConfiguration> isolate_configration, | ||
| std::shared_ptr<VolatilePathTracker> volatile_path_tracker); | ||
| std::shared_ptr<VolatilePathTracker> volatile_path_tracker, | ||
| const DartIsolate* spawning_isolate = nullptr); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Creates a running DartIsolate who shares as many resources as | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creates a new running DartIsolate from the current DartIsolate
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that is much of an improvement. Hopefully the other edits cover the information you are trying to convey with that. |
||
| /// possible with the caller DartIsolate. This allows them to | ||
| /// occupy less memory together and to be created faster. | ||
| /// @details Shared components will be destroyed when the last DartIsolate | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
| /// is destroyed. SpawnIsolate can only be used to create | ||
| /// DartIsolates whose executable code is shared with the calling | ||
| /// DartIsolate. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the current DartIsolate need to be in any particular states before calling this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure of the hard requirements of Dart_CreateIsolateInGroup. It isn't spelled out in its documentation. |
||
| /// @attention Only certain setups can take advantage of the most savings | ||
| /// currently, AOT specifically. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the same disclosure for why it's a weak pointer, who owns it, performance considerations etc.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| /// @return A running DartIsolate. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A new, running DartIsolate.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| std::weak_ptr<DartIsolate> SpawnIsolate( | ||
| const Settings& settings, | ||
| std::unique_ptr<PlatformConfiguration> platform_configuration, | ||
| fml::WeakPtr<SnapshotDelegate> snapshot_delegate, | ||
| fml::WeakPtr<HintFreedDelegate> hint_freed_delegate, | ||
| std::string advisory_script_uri, | ||
| std::string advisory_script_entrypoint, | ||
| Flags flags, | ||
| const fml::closure& isolate_create_callback, | ||
| const fml::closure& isolate_shutdown_callback, | ||
| std::optional<std::string> dart_entrypoint, | ||
| std::optional<std::string> dart_entrypoint_library, | ||
| std::unique_ptr<IsolateConfiguration> isolate_configration) const; | ||
|
|
||
| // |UIDartState| | ||
| ~DartIsolate() override; | ||
|
|
@@ -433,7 +458,8 @@ class DartIsolate : public UIDartState { | |
| Flags flags, | ||
| const fml::closure& isolate_create_callback, | ||
| const fml::closure& isolate_shutdown_callback, | ||
| std::shared_ptr<VolatilePathTracker> volatile_path_tracker); | ||
| std::shared_ptr<VolatilePathTracker> volatile_path_tracker, | ||
| const DartIsolate* spawning_isolate = nullptr); | ||
|
|
||
| DartIsolate(const Settings& settings, | ||
| TaskRunners task_runners, | ||
|
|
@@ -463,6 +489,8 @@ class DartIsolate : public UIDartState { | |
|
|
||
| DartIsolateGroupData& GetIsolateGroupData(); | ||
|
|
||
| const DartIsolateGroupData& GetIsolateGroupData() const; | ||
|
|
||
| // |Dart_IsolateGroupCreateCallback| | ||
| static Dart_Isolate DartIsolateGroupCreateCallback( | ||
| const char* advisory_script_uri, | ||
|
|
@@ -487,7 +515,11 @@ class DartIsolate : public UIDartState { | |
| std::unique_ptr<std::shared_ptr<DartIsolateGroupData>> isolate_group_data, | ||
| std::unique_ptr<std::shared_ptr<DartIsolate>> isolate_data, | ||
| Dart_IsolateFlags* flags, | ||
| char** error); | ||
| char** error, | ||
| std::function<Dart_Isolate(std::shared_ptr<DartIsolateGroupData>*, | ||
| std::shared_ptr<DartIsolate>*, | ||
| Dart_IsolateFlags*, | ||
| char**)> make_isolate); | ||
|
|
||
| static bool InitializeIsolate(std::shared_ptr<DartIsolate> embedder_isolate, | ||
| Dart_Isolate isolate, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you change the signature, update the method doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done