Flutter Engine
dart_isolate.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_RUNTIME_DART_ISOLATE_H_
6 #define FLUTTER_RUNTIME_DART_ISOLATE_H_
7 
8 #include <memory>
9 #include <optional>
10 #include <set>
11 #include <string>
12 #include <unordered_set>
13 
14 #include "flutter/common/task_runners.h"
15 #include "flutter/fml/compiler_specific.h"
16 #include "flutter/fml/macros.h"
17 #include "flutter/fml/mapping.h"
18 #include "flutter/lib/ui/io_manager.h"
19 #include "flutter/lib/ui/snapshot_delegate.h"
20 #include "flutter/lib/ui/ui_dart_state.h"
21 #include "flutter/lib/ui/window/platform_configuration.h"
22 #include "flutter/runtime/dart_snapshot.h"
23 #include "third_party/dart/runtime/include/dart_api.h"
25 
26 namespace flutter {
27 
28 class DartVM;
29 class DartIsolateGroupData;
30 class IsolateConfiguration;
31 
32 //------------------------------------------------------------------------------
33 /// @brief Represents an instance of a live isolate. An isolate is a
34 /// separate Dart execution context. Different Dart isolates don't
35 /// share memory and can be scheduled concurrently by the Dart VM on
36 /// one of the Dart VM managed worker pool threads.
37 ///
38 /// The entire lifecycle of a Dart isolate is controlled by the Dart
39 /// VM. Because of this, the engine never holds a strong pointer to
40 /// the Dart VM for extended periods of time. This allows the VM (or
41 /// the isolates themselves) to terminate Dart execution without
42 /// consulting the engine.
43 ///
44 /// The isolate that the engine creates to act as the host for the
45 /// Flutter application code with UI bindings is called the root
46 /// isolate.
47 ///
48 /// The root isolate is special in the following ways:
49 /// * The root isolate forms a new isolate group. Child isolates are
50 /// added to their parents groups. When the root isolate dies, all
51 /// isolates in its group are terminated.
52 /// * Only root isolates get UI bindings.
53 /// * Root isolates execute their code on engine managed threads.
54 /// All other isolates run their Dart code on Dart VM managed
55 /// thread pool workers that the engine has no control over.
56 /// * Since the engine does not know the thread on which non-root
57 /// isolates are run, the engine has no opportunity to get a
58 /// reference to non-root isolates. Such isolates can only be
59 /// terminated if they terminate themselves or their isolate group
60 /// is torn down.
61 ///
62 class DartIsolate : public UIDartState {
63  public:
64  class Flags {
65  public:
66  Flags();
67 
68  explicit Flags(const Dart_IsolateFlags* flags);
69 
70  ~Flags();
71 
72  void SetNullSafetyEnabled(bool enabled);
73  void SetIsDontNeedSafe(bool value);
74 
75  Dart_IsolateFlags Get() const;
76 
77  private:
78  Dart_IsolateFlags flags_;
79  };
80 
81  //----------------------------------------------------------------------------
82  /// @brief The engine represents all dart isolates as being in one of the
83  /// known phases. By invoking various methods on the Dart isolate,
84  /// the engine transition the Dart isolate from one phase to the
85  /// next. The Dart isolate will only move from one phase to the
86  /// next in the order specified in the `DartIsolate::Phase` enum.
87  /// That is, once the isolate has moved out of a particular phase,
88  /// it can never transition back to that phase in the future.
89  /// There is no error recovery mechanism and callers that find
90  /// their isolates in an undesirable phase must discard the
91  /// isolate and start over.
92  ///
93  enum class Phase {
94  //--------------------------------------------------------------------------
95  /// The initial phase of all Dart isolates. This is an internal phase and
96  /// callers can never get a reference to a Dart isolate in this phase.
97  ///
98  Unknown,
99  //--------------------------------------------------------------------------
100  /// The Dart isolate has been created but none of the library tag or message
101  /// handers have been set yet. The is an internal phase and callers can
102  /// never get a reference to a Dart isolate in this phase.
103  ///
104  Uninitialized,
105  //--------------------------------------------------------------------------
106  /// The Dart isolate has been been fully initialized but none of the
107  /// libraries referenced by that isolate have been loaded yet. This is an
108  /// internal phase and callers can never get a reference to a Dart isolate
109  /// in this phase.
110  ///
111  Initialized,
112  //--------------------------------------------------------------------------
113  /// The isolate has been fully initialized and is waiting for the caller to
114  /// associate isolate snapshots with the same. The isolate will only be
115  /// ready to execute Dart code once one of the `Prepare` calls are
116  /// successfully made.
117  ///
118  LibrariesSetup,
119  //--------------------------------------------------------------------------
120  /// The isolate is fully ready to start running Dart code. Callers can
121  /// transition the isolate to the next state by calling the `Run` or
122  /// `RunFromLibrary` methods.
123  ///
124  Ready,
125  //--------------------------------------------------------------------------
126  /// The isolate is currently running Dart code.
127  ///
128  Running,
129  //--------------------------------------------------------------------------
130  /// The isolate is no longer running Dart code and is in the middle of being
131  /// collected. This is in internal phase and callers can never get a
132  /// reference to a Dart isolate in this phase.
133  ///
134  Shutdown,
135  };
136 
137  //----------------------------------------------------------------------------
138  /// @brief Creates an instance of a root isolate and returns a weak
139  /// pointer to the same. The isolate instance may only be used
140  /// safely on the engine thread on which it was created. In the
141  /// shell, this is the UI thread and task runner. Using the
142  /// isolate on any other thread is user error.
143  ///
144  /// The isolate that the engine creates to act as the host for the
145  /// Flutter application code with UI bindings is called the root
146  /// isolate.
147  ///
148  /// The root isolate is special in the following ways:
149  /// * The root isolate forms a new isolate group. Child isolates
150  /// are added to their parents groups. When the root isolate
151  /// dies, all isolates in its group are terminated.
152  /// * Only root isolates get UI bindings.
153  /// * Root isolates execute their code on engine managed threads.
154  /// All other isolates run their Dart code on Dart VM managed
155  /// thread pool workers that the engine has no control over.
156  /// * Since the engine does not know the thread on which non-root
157  /// isolates are run, the engine has no opportunity to get a
158  /// reference to non-root isolates. Such isolates can only be
159  /// terminated if they terminate themselves or their isolate
160  /// group is torn down.
161  ///
162  /// @param[in] settings The settings used to create the
163  /// isolate.
164  /// @param[in] platform_configuration The platform configuration for
165  /// handling communication with the
166  /// framework.
167  /// @param[in] flags The Dart isolate flags for this
168  /// isolate instance.
169  /// @param[in] dart_entrypoint The name of the dart entrypoint
170  /// function to invoke.
171  /// @param[in] dart_entrypoint_library The name of the dart library
172  /// containing the entrypoint.
173  /// @param[in] dart_entrypoint_args Arguments passed as a List<String>
174  /// to Dart's entrypoint function.
175  /// @param[in] isolate_configuration The isolate configuration used to
176  /// configure the isolate before
177  /// invoking the entrypoint.
178  /// @param[in] root_isolate_create_callback A callback called after the root
179  /// isolate is created, _without_
180  /// isolate scope. This gives the
181  /// caller a chance to finish any
182  /// setup before running the Dart
183  /// program, and after any embedder
184  /// callbacks in the settings object.
185  /// @param[in] isolate_create_callback The isolate create callback. This
186  /// will be called when the before the
187  /// main Dart entrypoint is invoked in
188  /// the root isolate. The isolate is
189  /// already in the running state at
190  /// this point and an isolate scope is
191  /// current.
192  /// @param[in] isolate_shutdown_callback The isolate shutdown callback.
193  /// This will be called before the
194  /// isolate is about to transition
195  /// into the Shutdown phase. The
196  /// isolate is still running at this
197  /// point and an isolate scope is
198  /// current.
199  /// @param[in] context Engine-owned state which is
200  /// accessed by the root dart isolate.
201  /// @param[in] spawning_isolate The isolate that is spawning the
202  /// new isolate. See also
203  /// DartIsolate::SpawnIsolate.
204  /// @return A weak pointer to the root Dart isolate. The caller must
205  /// ensure that the isolate is not referenced for long periods of
206  /// time as it prevents isolate collection when the isolate
207  /// terminates itself. The caller may also only use the isolate on
208  /// the thread on which the isolate was created.
209  ///
210  static std::weak_ptr<DartIsolate> CreateRunningRootIsolate(
211  const Settings& settings,
212  fml::RefPtr<const DartSnapshot> isolate_snapshot,
213  std::unique_ptr<PlatformConfiguration> platform_configuration,
214  Flags flags,
215  fml::closure root_isolate_create_callback,
216  const fml::closure& isolate_create_callback,
217  const fml::closure& isolate_shutdown_callback,
218  std::optional<std::string> dart_entrypoint,
219  std::optional<std::string> dart_entrypoint_library,
220  const std::vector<std::string>& dart_entrypoint_args,
221  std::unique_ptr<IsolateConfiguration> isolate_configuration,
222  const UIDartState::Context& context,
223  const DartIsolate* spawning_isolate = nullptr);
224 
225  //----------------------------------------------------------------------------
226  /// @brief Creates a running DartIsolate who shares as many resources as
227  /// possible with the caller DartIsolate. This allows them to
228  /// occupy less memory together and to be created faster.
229  /// @details Shared components will be destroyed when the last live
230  /// DartIsolate is destroyed. SpawnIsolate can only be used to
231  /// create DartIsolates whose executable code is shared with the
232  /// calling DartIsolate.
233  /// @attention Only certain setups can take advantage of the most savings
234  /// currently, AOT specifically.
235  /// @return A weak pointer to a new running DartIsolate. The caller must
236  /// ensure that the isolate is not referenced for long periods of
237  /// time as it prevents isolate collection when the isolate
238  /// terminates itself. The caller may also only use the isolate on
239  /// the thread on which the isolate was created.
240  std::weak_ptr<DartIsolate> SpawnIsolate(
241  const Settings& settings,
242  std::unique_ptr<PlatformConfiguration> platform_configuration,
243  fml::WeakPtr<SnapshotDelegate> snapshot_delegate,
244  std::string advisory_script_uri,
245  std::string advisory_script_entrypoint,
246  Flags flags,
247  const fml::closure& isolate_create_callback,
248  const fml::closure& isolate_shutdown_callback,
249  std::optional<std::string> dart_entrypoint,
250  std::optional<std::string> dart_entrypoint_library,
251  const std::vector<std::string>& dart_entrypoint_args,
252  std::unique_ptr<IsolateConfiguration> isolate_configuration) const;
253 
254  // |UIDartState|
255  ~DartIsolate() override;
256 
257  //----------------------------------------------------------------------------
258  /// @brief The current phase of the isolate. The engine represents all
259  /// dart isolates as being in one of the known phases. By invoking
260  /// various methods on the Dart isolate, the engine transitions
261  /// the Dart isolate from one phase to the next. The Dart isolate
262  /// will only move from one phase to the next in the order
263  /// specified in the `DartIsolate::Phase` enum. That is, the once
264  /// the isolate has moved out of a particular phase, it can never
265  /// transition back to that phase in the future. There is no error
266  /// recovery mechanism and callers that find their isolates in an
267  /// undesirable phase must discard the isolate and start over.
268  ///
269  /// @return The current isolate phase.
270  ///
271  Phase GetPhase() const;
272 
273  //----------------------------------------------------------------------------
274  /// @brief Returns the ID for an isolate which is used to query the
275  /// service protocol.
276  ///
277  /// @return The service identifier for this isolate.
278  ///
279  std::string GetServiceId();
280 
281  //----------------------------------------------------------------------------
282  /// @brief Prepare the isolate for running for a precompiled code bundle.
283  /// The Dart VM must be configured for running precompiled code.
284  ///
285  /// The isolate must already be in the `Phase::LibrariesSetup`
286  /// phase. After a successful call to this method, the isolate
287  /// will transition to the `Phase::Ready` phase.
288  ///
289  /// @return Whether the isolate was prepared and the described phase
290  /// transition made.
291  ///
292  [[nodiscard]] bool PrepareForRunningFromPrecompiledCode();
293 
294  //----------------------------------------------------------------------------
295  /// @brief Prepare the isolate for running for a a list of kernel files.
296  ///
297  /// The Dart VM must be configured for running from kernel
298  /// snapshots.
299  ///
300  /// The isolate must already be in the `Phase::LibrariesSetup`
301  /// phase. This call can be made multiple times. After a series of
302  /// successful calls to this method, the caller can specify the
303  /// last kernel file mapping by specifying `last_piece` to `true`.
304  /// On success, the isolate will transition to the `Phase::Ready`
305  /// phase.
306  ///
307  /// @param[in] kernel The kernel mapping.
308  /// @param[in] last_piece Indicates if this is the last kernel mapping
309  /// expected. After this point, the isolate will
310  /// attempt a transition to the `Phase::Ready` phase.
311  ///
312  /// @return If the kernel mapping supplied was successfully used to
313  /// prepare the isolate.
314  ///
315  [[nodiscard]] bool PrepareForRunningFromKernel(
316  std::shared_ptr<const fml::Mapping> kernel,
317  bool child_isolate,
318  bool last_piece);
319 
320  //----------------------------------------------------------------------------
321  /// @brief Prepare the isolate for running for a a list of kernel files.
322  ///
323  /// The Dart VM must be configured for running from kernel
324  /// snapshots.
325  ///
326  /// The isolate must already be in the `Phase::LibrariesSetup`
327  /// phase. After a successful call to this method, the isolate
328  /// will transition to the `Phase::Ready` phase.
329  ///
330  /// @param[in] kernels The kernels
331  ///
332  /// @return If the kernel mappings supplied were successfully used to
333  /// prepare the isolate.
334  ///
335  [[nodiscard]] bool PrepareForRunningFromKernels(
336  std::vector<std::shared_ptr<const fml::Mapping>> kernels);
337 
338  //----------------------------------------------------------------------------
339  /// @brief Prepare the isolate for running for a a list of kernel files.
340  ///
341  /// The Dart VM must be configured for running from kernel
342  /// snapshots.
343  ///
344  /// The isolate must already be in the `Phase::LibrariesSetup`
345  /// phase. After a successful call to this method, the isolate
346  /// will transition to the `Phase::Ready` phase.
347  ///
348  /// @param[in] kernels The kernels
349  ///
350  /// @return If the kernel mappings supplied were successfully used to
351  /// prepare the isolate.
352  ///
353  [[nodiscard]] bool PrepareForRunningFromKernels(
354  std::vector<std::unique_ptr<const fml::Mapping>> kernels);
355 
356  //----------------------------------------------------------------------------
357  /// @brief Transition the root isolate to the `Phase::Running` phase and
358  /// invoke the main entrypoint (the "main" method) in the
359  /// specified library. The isolate must already be in the
360  /// `Phase::Ready` phase.
361  ///
362  /// @param[in] library_name The name of the library in which to invoke the
363  /// supplied entrypoint.
364  /// @param[in] entrypoint The entrypoint in `library_name`
365  /// @param[in] args A list of string arguments to the entrypoint.
366  ///
367  /// @return If the isolate successfully transitioned to the running phase
368  /// and the main entrypoint was invoked.
369  ///
370  [[nodiscard]] bool RunFromLibrary(std::optional<std::string> library_name,
371  std::optional<std::string> entrypoint,
372  const std::vector<std::string>& args);
373 
374  //----------------------------------------------------------------------------
375  /// @brief Transition the isolate to the `Phase::Shutdown` phase. The
376  /// only thing left to do is to collect the isolate.
377  ///
378  /// @return If the isolate successfully transitioned to the shutdown
379  /// phase.
380  ///
381  [[nodiscard]] bool Shutdown();
382 
383  //----------------------------------------------------------------------------
384  /// @brief Registers a callback that will be invoked in isolate scope
385  /// just before the isolate transitions to the `Phase::Shutdown`
386  /// phase.
387  ///
388  /// @param[in] closure The callback to invoke on isolate shutdown.
389  ///
391 
392  //----------------------------------------------------------------------------
393  /// @brief A weak pointer to the Dart isolate instance. This instance may
394  /// only be used on the task runner that created the root isolate.
395  ///
396  /// @return The weak isolate pointer.
397  ///
398  std::weak_ptr<DartIsolate> GetWeakIsolatePtr();
399 
400  //----------------------------------------------------------------------------
401  /// @brief The task runner on which the Dart code for the root isolate is
402  /// running. For the root isolate, this is the UI task runner for
403  /// the shell that owns the root isolate.
404  ///
405  /// @return The message handling task runner.
406  ///
408 
409  bool LoadLoadingUnit(
410  intptr_t loading_unit_id,
411  std::unique_ptr<const fml::Mapping> snapshot_data,
412  std::unique_ptr<const fml::Mapping> snapshot_instructions);
413 
414  void LoadLoadingUnitError(intptr_t loading_unit_id,
415  const std::string error_message,
416  bool transient);
417 
418  private:
419  friend class IsolateConfiguration;
420  class AutoFireClosure {
421  public:
422  explicit AutoFireClosure(const fml::closure& closure);
423 
424  ~AutoFireClosure();
425 
426  private:
427  fml::closure closure_;
428  FML_DISALLOW_COPY_AND_ASSIGN(AutoFireClosure);
429  };
430  friend class DartVM;
431 
432  Phase phase_ = Phase::Unknown;
433  std::vector<std::shared_ptr<const fml::Mapping>> kernel_buffers_;
434  std::vector<std::unique_ptr<AutoFireClosure>> shutdown_callbacks_;
435  std::unordered_set<fml::RefPtr<DartSnapshot>> loading_unit_snapshots_;
436  fml::RefPtr<fml::TaskRunner> message_handling_task_runner_;
437  const bool may_insecurely_connect_to_all_domains_;
438  std::string domain_network_policy_;
439 
440  static std::weak_ptr<DartIsolate> CreateRootIsolate(
441  const Settings& settings,
442  fml::RefPtr<const DartSnapshot> isolate_snapshot,
443  std::unique_ptr<PlatformConfiguration> platform_configuration,
444  Flags flags,
445  const fml::closure& isolate_create_callback,
446  const fml::closure& isolate_shutdown_callback,
447  const UIDartState::Context& context,
448  const DartIsolate* spawning_isolate = nullptr);
449 
450  DartIsolate(const Settings& settings,
451  bool is_root_isolate,
452  const UIDartState::Context& context);
453 
454  [[nodiscard]] bool Initialize(Dart_Isolate isolate);
455 
456  void SetMessageHandlingTaskRunner(fml::RefPtr<fml::TaskRunner> runner);
457 
458  bool LoadKernel(std::shared_ptr<const fml::Mapping> mapping, bool last_piece);
459 
460  [[nodiscard]] bool LoadLibraries();
461 
462  bool UpdateThreadPoolNames() const;
463 
464  [[nodiscard]] bool MarkIsolateRunnable();
465 
466  void OnShutdownCallback();
467 
468  DartIsolateGroupData& GetIsolateGroupData();
469 
470  const DartIsolateGroupData& GetIsolateGroupData() const;
471 
472  // |Dart_IsolateGroupCreateCallback|
473  static Dart_Isolate DartIsolateGroupCreateCallback(
474  const char* advisory_script_uri,
475  const char* advisory_script_entrypoint,
476  const char* package_root,
477  const char* package_config,
478  Dart_IsolateFlags* flags,
479  std::shared_ptr<DartIsolate>* parent_isolate_group,
480  char** error);
481 
482  // |Dart_IsolateInitializeCallback|
483  static bool DartIsolateInitializeCallback(void** child_callback_data,
484  char** error);
485 
486  static Dart_Isolate DartCreateAndStartServiceIsolate(
487  const char* package_root,
488  const char* package_config,
489  Dart_IsolateFlags* flags,
490  char** error);
491 
492  typedef std::function<Dart_Isolate(std::shared_ptr<DartIsolateGroupData>*,
493  std::shared_ptr<DartIsolate>*,
494  Dart_IsolateFlags*,
495  char**)>
496  IsolateMaker;
497 
498  static Dart_Isolate CreateDartIsolateGroup(
499  std::unique_ptr<std::shared_ptr<DartIsolateGroupData>> isolate_group_data,
500  std::unique_ptr<std::shared_ptr<DartIsolate>> isolate_data,
501  Dart_IsolateFlags* flags,
502  char** error,
503  const IsolateMaker& make_isolate);
504 
505  static bool InitializeIsolate(std::shared_ptr<DartIsolate> embedder_isolate,
506  Dart_Isolate isolate,
507  char** error);
508 
509  // |Dart_IsolateShutdownCallback|
510  static void DartIsolateShutdownCallback(
511  std::shared_ptr<DartIsolateGroupData>* isolate_group_data,
512  std::shared_ptr<DartIsolate>* isolate_data);
513 
514  // |Dart_IsolateCleanupCallback|
515  static void DartIsolateCleanupCallback(
516  std::shared_ptr<DartIsolateGroupData>* isolate_group_data,
517  std::shared_ptr<DartIsolate>* isolate_data);
518 
519  // |Dart_IsolateGroupCleanupCallback|
520  static void DartIsolateGroupCleanupCallback(
521  std::shared_ptr<DartIsolateGroupData>* isolate_group_data);
522 
523  // |Dart_DeferredLoadHandler|
524  static Dart_Handle OnDartLoadLibrary(intptr_t loading_unit_id);
525 
526  static void SpawnIsolateShutdownCallback(
527  std::shared_ptr<DartIsolateGroupData>* isolate_group_data,
528  std::shared_ptr<DartIsolate>* isolate_data);
529 
531 };
532 
533 } // namespace flutter
534 
535 #endif // FLUTTER_RUNTIME_DART_ISOLATE_H_
G_BEGIN_DECLS FlValue * args
Phase GetPhase() const
The current phase of the isolate. The engine represents all dart isolates as being in one of the know...
Dart_IsolateFlags Get() const
Definition: dart_isolate.cc:81
Dart_Isolate isolate()
Definition: dart_state.h:51
bool RunFromLibrary(std::optional< std::string > library_name, std::optional< std::string > entrypoint, const std::vector< std::string > &args)
Transition the root isolate to the Phase::Running phase and invoke the main entrypoint (the "main" me...
const uint8_t uint32_t uint32_t GError ** error
Phase
The engine represents all dart isolates as being in one of the known phases. By invoking various meth...
Definition: dart_isolate.h:93
bool PrepareForRunningFromKernel(std::shared_ptr< const fml::Mapping > kernel, bool child_isolate, bool last_piece)
Prepare the isolate for running for a a list of kernel files.
FlutterSemanticsFlag flags
void SetNullSafetyEnabled(bool enabled)
Definition: dart_isolate.cc:73
std::function< void()> closure
Definition: closure.h:14
void AddIsolateShutdownCallback(const fml::closure &closure)
Registers a callback that will be invoked in isolate scope just before the isolate transitions to the...
std::weak_ptr< DartIsolate > SpawnIsolate(const Settings &settings, std::unique_ptr< PlatformConfiguration > platform_configuration, fml::WeakPtr< SnapshotDelegate > snapshot_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, const std::vector< std::string > &dart_entrypoint_args, std::unique_ptr< IsolateConfiguration > isolate_configuration) const
Creates a running DartIsolate who shares as many resources as possible with the caller DartIsolate...
Definition: dart_isolate.cc:85
uint8_t value
void Initialize(fidl::InterfaceHandle< fuchsia::sys::Environment > environment, zx::channel directory_request, std::optional< zx::eventpair > view_ref)
Initializes Dart bindings for the Fuchsia application model.
Definition: fuchsia.cc:103
Represents an instance of a live isolate. An isolate is a separate Dart execution context...
Definition: dart_isolate.h:62
void SetIsDontNeedSafe(bool value)
Definition: dart_isolate.cc:77
The subset of state which is owned by the shell or engine and passed through the RuntimeController in...
Definition: ui_dart_state.h:43
PlatformConfiguration * platform_configuration() const
std::string GetServiceId()
Returns the ID for an isolate which is used to query the service protocol.
bool LoadLoadingUnit(intptr_t loading_unit_id, std::unique_ptr< const fml::Mapping > snapshot_data, std::unique_ptr< const fml::Mapping > snapshot_instructions)
Describes a running instance of the Dart VM. There may only be one running instance of the Dart VM in...
Definition: dart_vm.h:61
fml::RefPtr< fml::TaskRunner > GetMessageHandlingTaskRunner() const
The task runner on which the Dart code for the root isolate is running. For the root isolate...
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
bool Shutdown()
Transition the isolate to the Phase::Shutdown phase. The only thing left to do is to collect the isol...
bool PrepareForRunningFromKernels(std::vector< std::shared_ptr< const fml::Mapping >> kernels)
Prepare the isolate for running for a a list of kernel files.
std::weak_ptr< DartIsolate > GetWeakIsolatePtr()
A weak pointer to the Dart isolate instance. This instance may only be used on the task runner that c...
An isolate configuration is a collection of snapshots and asset managers that the engine will use to ...
bool PrepareForRunningFromPrecompiledCode()
Prepare the isolate for running for a precompiled code bundle. The Dart VM must be configured for run...
void LoadLoadingUnitError(intptr_t loading_unit_id, const std::string error_message, bool transient)
static std::weak_ptr< DartIsolate > CreateRunningRootIsolate(const Settings &settings, fml::RefPtr< const DartSnapshot > isolate_snapshot, std::unique_ptr< PlatformConfiguration > platform_configuration, Flags flags, fml::closure root_isolate_create_callback, 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, const std::vector< std::string > &dart_entrypoint_args, std::unique_ptr< IsolateConfiguration > isolate_configuration, const UIDartState::Context &context, const DartIsolate *spawning_isolate=nullptr)
Creates an instance of a root isolate and returns a weak pointer to the same. The isolate instance ma...