Flutter Engine
shell.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 SHELL_COMMON_SHELL_H_
6 #define SHELL_COMMON_SHELL_H_
7 
8 #include <functional>
9 #include <mutex>
10 #include <string_view>
11 #include <unordered_map>
12 
13 #include "flutter/assets/directory_asset_bundle.h"
14 #include "flutter/common/settings.h"
15 #include "flutter/common/task_runners.h"
16 #include "flutter/flow/surface.h"
17 #include "flutter/flow/texture.h"
18 #include "flutter/fml/closure.h"
19 #include "flutter/fml/macros.h"
20 #include "flutter/fml/memory/ref_ptr.h"
21 #include "flutter/fml/memory/thread_checker.h"
22 #include "flutter/fml/memory/weak_ptr.h"
23 #include "flutter/fml/status.h"
24 #include "flutter/fml/synchronization/sync_switch.h"
25 #include "flutter/fml/synchronization/waitable_event.h"
26 #include "flutter/fml/thread.h"
27 #include "flutter/fml/time/time_point.h"
28 #include "flutter/lib/ui/semantics/custom_accessibility_action.h"
29 #include "flutter/lib/ui/semantics/semantics_node.h"
30 #include "flutter/lib/ui/window/platform_message.h"
31 #include "flutter/runtime/dart_vm_lifecycle.h"
32 #include "flutter/runtime/service_protocol.h"
33 #include "flutter/shell/common/animator.h"
34 #include "flutter/shell/common/display_manager.h"
35 #include "flutter/shell/common/engine.h"
36 #include "flutter/shell/common/platform_view.h"
37 #include "flutter/shell/common/rasterizer.h"
38 #include "flutter/shell/common/shell_io_manager.h"
39 
40 namespace flutter {
41 
42 /// Error exit codes for the Dart isolate.
43 enum class DartErrorCode {
44  /// No error has occurred.
45  NoError = 0,
46  /// The Dart error code for an API error.
47  ApiError = 253,
48  /// The Dart error code for a compilation error.
49  CompilationError = 254,
50  /// The Dart error code for an unkonwn error.
51  UnknownError = 255
52 };
53 
54 //------------------------------------------------------------------------------
55 /// Perhaps the single most important class in the Flutter engine repository.
56 /// When embedders create a Flutter application, they are referring to the
57 /// creation of an instance of a shell. Creation and destruction of the shell is
58 /// synchronous and the embedder only holds a unique pointer to the shell. The
59 /// shell does not create the threads its primary components run on. Instead, it
60 /// is the embedder's responsibility to create threads and give the shell task
61 /// runners for those threads. Due to deterministic destruction of the shell,
62 /// the embedder can terminate all threads immediately after collecting the
63 /// shell. The shell must be created and destroyed on the same thread, but,
64 /// different shells (i.e. a separate instances of a Flutter application) may be
65 /// run on different threads simultaneously. The task runners themselves do not
66 /// have to be unique. If all task runner references given to the shell during
67 /// shell creation point to the same task runner, the Flutter application is
68 /// effectively single threaded.
69 ///
70 /// The shell is the central nervous system of the Flutter application. None of
71 /// the shell components are thread safe and must be created, accessed and
72 /// destroyed on the same thread. To interact with one another, the various
73 /// components delegate to the shell for communication. Instead of using back
74 /// pointers to the shell, a delegation pattern is used by all components that
75 /// want to communicate with one another. Because of this, the shell implements
76 /// the delegate interface for all these components.
77 ///
78 /// All shell methods accessed by the embedder may only be called on the
79 /// platform task runner. In case the embedder wants to directly access a shell
80 /// subcomponent, it is the embedder's responsibility to acquire a weak pointer
81 /// to that component and post a task to the task runner used by the component
82 /// to access its methods. The shell must also be destroyed on the platform
83 /// task runner.
84 ///
85 /// There is no explicit API to bootstrap and shutdown the Dart VM. The first
86 /// instance of the shell in the process bootstraps the Dart VM and the
87 /// destruction of the last shell instance destroys the same. Since different
88 /// shells may be created and destroyed on different threads. VM bootstrap may
89 /// happen on one thread but its collection on another. This behavior is thread
90 /// safe.
91 ///
92 class Shell final : public PlatformView::Delegate,
93  public Animator::Delegate,
94  public Engine::Delegate,
95  public Rasterizer::Delegate,
97  public:
98  template <class T>
99  using CreateCallback = std::function<std::unique_ptr<T>(Shell&)>;
100 
101  //----------------------------------------------------------------------------
102  /// @brief Creates a shell instance using the provided settings. The
103  /// callbacks to create the various shell subcomponents will be
104  /// called on the appropriate threads before this method returns.
105  /// If this is the first instance of a shell in the process, this
106  /// call also bootstraps the Dart VM.
107  ///
108  /// @param[in] task_runners The task runners
109  /// @param[in] settings The settings
110  /// @param[in] on_create_platform_view The callback that must return a
111  /// platform view. This will be called on
112  /// the platform task runner before this
113  /// method returns.
114  /// @param[in] on_create_rasterizer That callback that must provide a
115  /// valid rasterizer. This will be called
116  /// on the render task runner before this
117  /// method returns.
118  ///
119  /// @return A full initialized shell if the settings and callbacks are
120  /// valid. The root isolate has been created but not yet launched.
121  /// It may be launched by obtaining the engine weak pointer and
122  /// posting a task onto the UI task runner with a valid run
123  /// configuration to run the isolate. The embedder must always
124  /// check the validity of the shell (using the IsSetup call)
125  /// immediately after getting a pointer to it.
126  ///
127  static std::unique_ptr<Shell> Create(
128  TaskRunners task_runners,
129  Settings settings,
130  const CreateCallback<PlatformView>& on_create_platform_view,
131  const CreateCallback<Rasterizer>& on_create_rasterizer);
132 
133  //----------------------------------------------------------------------------
134  /// @brief Creates a shell instance using the provided settings. The
135  /// callbacks to create the various shell subcomponents will be
136  /// called on the appropriate threads before this method returns.
137  /// Unlike the simpler variant of this factory method, this method
138  /// allows for specification of window data. If this is the first
139  /// instance of a shell in the process, this call also bootstraps
140  /// the Dart VM.
141  ///
142  /// @param[in] task_runners The task runners
143  /// @param[in] platform_data The default data for setting up
144  /// ui.Window that attached to this
145  /// intance.
146  /// @param[in] settings The settings
147  /// @param[in] on_create_platform_view The callback that must return a
148  /// platform view. This will be called on
149  /// the platform task runner before this
150  /// method returns.
151  /// @param[in] on_create_rasterizer That callback that must provide a
152  /// valid rasterizer. This will be called
153  /// on the render task runner before this
154  /// method returns.
155  ///
156  /// @return A full initialized shell if the settings and callbacks are
157  /// valid. The root isolate has been created but not yet launched.
158  /// It may be launched by obtaining the engine weak pointer and
159  /// posting a task onto the UI task runner with a valid run
160  /// configuration to run the isolate. The embedder must always
161  /// check the validity of the shell (using the IsSetup call)
162  /// immediately after getting a pointer to it.
163  ///
164  static std::unique_ptr<Shell> Create(
165  TaskRunners task_runners,
166  const PlatformData platform_data,
167  Settings settings,
168  CreateCallback<PlatformView> on_create_platform_view,
169  CreateCallback<Rasterizer> on_create_rasterizer);
170 
171  //----------------------------------------------------------------------------
172  /// @brief Creates a shell instance using the provided settings. The
173  /// callbacks to create the various shell subcomponents will be
174  /// called on the appropriate threads before this method returns.
175  /// Unlike the simpler variant of this factory method, this method
176  /// allows for the specification of an isolate snapshot that
177  /// cannot be adequately described in the settings. This call also
178  /// requires the specification of a running VM instance.
179  ///
180  /// @param[in] task_runners The task runners
181  /// @param[in] platform_data The default data for setting up
182  /// ui.Window that attached to this
183  /// intance.
184  /// @param[in] settings The settings
185  /// @param[in] isolate_snapshot A custom isolate snapshot. Takes
186  /// precedence over any snapshots
187  /// specified in the settings.
188  /// @param[in] on_create_platform_view The callback that must return a
189  /// platform view. This will be called on
190  /// the platform task runner before this
191  /// method returns.
192  /// @param[in] on_create_rasterizer That callback that must provide a
193  /// valid rasterizer. This will be called
194  /// on the render task runner before this
195  /// method returns.
196  /// @param[in] vm A running VM instance.
197  ///
198  /// @return A full initialized shell if the settings and callbacks are
199  /// valid. The root isolate has been created but not yet launched.
200  /// It may be launched by obtaining the engine weak pointer and
201  /// posting a task onto the UI task runner with a valid run
202  /// configuration to run the isolate. The embedder must always
203  /// check the validity of the shell (using the IsSetup call)
204  /// immediately after getting a pointer to it.
205  ///
206  static std::unique_ptr<Shell> Create(
207  TaskRunners task_runners,
208  const PlatformData platform_data,
209  Settings settings,
210  fml::RefPtr<const DartSnapshot> isolate_snapshot,
211  const CreateCallback<PlatformView>& on_create_platform_view,
212  const CreateCallback<Rasterizer>& on_create_rasterizer,
213  DartVMRef vm);
214 
215  //----------------------------------------------------------------------------
216  /// @brief Destroys the shell. This is a synchronous operation and
217  /// synchronous barrier blocks are introduced on the various
218  /// threads to ensure shutdown of all shell sub-components before
219  /// this method returns.
220  ///
221  ~Shell();
222 
223  //----------------------------------------------------------------------------
224  /// @brief Starts an isolate for the given RunConfiguration.
225  ///
226  void RunEngine(RunConfiguration run_configuration);
227 
228  //----------------------------------------------------------------------------
229  /// @brief Starts an isolate for the given RunConfiguration. The
230  /// result_callback will be called with the status of the
231  /// operation.
232  ///
233  void RunEngine(RunConfiguration run_configuration,
234  const std::function<void(Engine::RunStatus)>& result_callback);
235 
236  //------------------------------------------------------------------------------
237  /// @return The settings used to launch this shell.
238  ///
239  const Settings& GetSettings() const;
240 
241  //------------------------------------------------------------------------------
242  /// @brief If callers wish to interact directly with any shell
243  /// subcomponents, they must (on the platform thread) obtain a
244  /// task runner that the component is designed to run on and a
245  /// weak pointer to that component. They may then post a task to
246  /// that task runner, do the validity check on that task runner
247  /// before performing any operation on that component. This
248  /// accessor allows callers to access the task runners for this
249  /// shell.
250  ///
251  /// @return The task runners current in use by the shell.
252  ///
253  const TaskRunners& GetTaskRunners() const override;
254 
255  //----------------------------------------------------------------------------
256  /// @brief Rasterizers may only be accessed on the GPU task runner.
257  ///
258  /// @return A weak pointer to the rasterizer.
259  ///
260  fml::TaskRunnerAffineWeakPtr<Rasterizer> GetRasterizer() const;
261 
262  //------------------------------------------------------------------------------
263  /// @brief Engines may only be accessed on the UI thread. This method is
264  /// deprecated, and implementers should instead use other API
265  /// available on the Shell or the PlatformView.
266  ///
267  /// @return A weak pointer to the engine.
268  ///
269  fml::WeakPtr<Engine> GetEngine();
270 
271  //----------------------------------------------------------------------------
272  /// @brief Platform views may only be accessed on the platform task
273  /// runner.
274  ///
275  /// @return A weak pointer to the platform view.
276  ///
277  fml::WeakPtr<PlatformView> GetPlatformView();
278 
279  //----------------------------------------------------------------------------
280  /// @brief The IO Manager may only be accessed on the IO task runner.
281  ///
282  /// @return A weak pointer to the IO manager.
283  ///
284  fml::WeakPtr<ShellIOManager> GetIOManager();
285 
286  // Embedders should call this under low memory conditions to free up
287  // internal caches used.
288  //
289  // This method posts a task to the raster threads to signal the Rasterizer to
290  // free resources.
291 
292  //----------------------------------------------------------------------------
293  /// @brief Used by embedders to notify that there is a low memory
294  /// warning. The shell will attempt to purge caches. Current, only
295  /// the rasterizer cache is purged.
296  void NotifyLowMemoryWarning() const;
297 
298  //----------------------------------------------------------------------------
299  /// @brief Used by embedders to check if all shell subcomponents are
300  /// initialized. It is the embedder's responsibility to make this
301  /// call before accessing any other shell method. A shell that is
302  /// not setup must be discarded and another one created with
303  /// updated settings.
304  ///
305  /// @return Returns if the shell has been setup. Once set up, this does
306  /// not change for the life-cycle of the shell.
307  ///
308  bool IsSetup() const;
309 
310  //----------------------------------------------------------------------------
311  /// @brief Captures a screenshot and optionally Base64 encodes the data
312  /// of the last layer tree rendered by the rasterizer in this
313  /// shell.
314  ///
315  /// @param[in] type The type of screenshot to capture.
316  /// @param[in] base64_encode If the screenshot data should be base64
317  /// encoded.
318  ///
319  /// @return The screenshot result.
320  ///
322  bool base64_encode);
323 
324  //----------------------------------------------------------------------------
325  /// @brief Pauses the calling thread until the first frame is presented.
326  ///
327  /// @return 'kOk' when the first frame has been presented before the timeout
328  /// successfully, 'kFailedPrecondition' if called from the GPU or UI
329  /// thread, 'kDeadlineExceeded' if there is a timeout.
330  ///
331  fml::Status WaitForFirstFrame(fml::TimeDelta timeout);
332 
333  //----------------------------------------------------------------------------
334  /// @brief Used by embedders to reload the system fonts in
335  /// FontCollection.
336  /// It also clears the cached font families and send system
337  /// channel message to framework to rebuild affected widgets.
338  ///
339  /// @return Returns if shell reloads system fonts successfully.
340  ///
341  bool ReloadSystemFonts();
342 
343  //----------------------------------------------------------------------------
344  /// @brief Used by embedders to get the last error from the Dart UI
345  /// Isolate, if one exists.
346  ///
347  /// @return Returns the last error code from the UI Isolate.
348  ///
349  std::optional<DartErrorCode> GetUIIsolateLastError() const;
350 
351  //----------------------------------------------------------------------------
352  /// @brief Used by embedders to check if the Engine is running and has
353  /// any live ports remaining. For example, the Flutter tester uses
354  /// this method to check whether it should continue to wait for
355  /// a running test or not.
356  ///
357  /// @return Returns if the shell has an engine and the engine has any live
358  /// Dart ports.
359  ///
360  bool EngineHasLivePorts() const;
361 
362  //----------------------------------------------------------------------------
363  /// @brief Accessor for the disable GPU SyncSwitch
364  std::shared_ptr<fml::SyncSwitch> GetIsGpuDisabledSyncSwitch() const override;
365 
366  //----------------------------------------------------------------------------
367  /// @brief Get a pointer to the Dart VM used by this running shell
368  /// instance.
369  ///
370  /// @return The Dart VM pointer.
371  ///
372  DartVM* GetDartVM();
373 
374  //----------------------------------------------------------------------------
375  /// @brief Notifies the display manager of the updates.
376  ///
377  void OnDisplayUpdates(DisplayUpdateType update_type,
378  std::vector<Display> displays);
379 
380  //----------------------------------------------------------------------------
381  /// @brief Queries the `DisplayManager` for the main display refresh rate.
382  ///
383  double GetMainDisplayRefreshRate();
384 
385  private:
386  using ServiceProtocolHandler =
388  rapidjson::Document*)>;
389 
391  const Settings settings_;
392  DartVMRef vm_;
393  mutable std::mutex time_recorder_mutex_;
394  std::optional<fml::TimePoint> latest_frame_target_time_;
395  std::unique_ptr<PlatformView> platform_view_; // on platform task runner
396  std::unique_ptr<Engine> engine_; // on UI task runner
397  std::unique_ptr<Rasterizer> rasterizer_; // on GPU task runner
398  std::unique_ptr<ShellIOManager> io_manager_; // on IO task runner
399  std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;
400 
401  fml::WeakPtr<Engine> weak_engine_; // to be shared across threads
403  weak_rasterizer_; // to be shared across threads
405  weak_platform_view_; // to be shared across threads
406 
407  std::unordered_map<std::string_view, // method
408  std::pair<fml::RefPtr<fml::TaskRunner>,
409  ServiceProtocolHandler> // task-runner/function
410  // pair
411  >
412  service_protocol_handlers_;
413  bool is_setup_ = false;
414  bool is_added_to_service_protocol_ = false;
415  uint64_t next_pointer_flow_id_ = 0;
416 
417  bool first_frame_rasterized_ = false;
418  std::atomic<bool> waiting_for_first_frame_ = true;
419  std::mutex waiting_for_first_frame_mutex_;
420  std::condition_variable waiting_for_first_frame_condition_;
421 
422  // Written in the UI thread and read from the raster thread. Hence make it
423  // atomic.
424  std::atomic<bool> needs_report_timings_{false};
425 
426  // Whether there's a task scheduled to report the timings to Dart through
427  // ui.Window.onReportTimings.
428  bool frame_timings_report_scheduled_ = false;
429 
430  // Vector of FrameTiming::kCount * n timestamps for n frames whose timings
431  // have not been reported yet. Vector of ints instead of FrameTiming is stored
432  // here for easier conversions to Dart objects.
433  std::vector<int64_t> unreported_timings_;
434 
435  /// Manages the displays. This class is thread safe, can be accessed from any
436  /// of the threads.
437  std::unique_ptr<DisplayManager> display_manager_;
438 
439  // protects expected_frame_size_ which is set on platform thread and read on
440  // raster thread
441  std::mutex resize_mutex_;
442 
443  // used to discard wrong size layer tree produced during interactive resizing
444  SkISize expected_frame_size_ = SkISize::MakeEmpty();
445 
446  // How many frames have been timed since last report.
447  size_t UnreportedFramesCount() const;
448 
449  Shell(DartVMRef vm, TaskRunners task_runners, Settings settings);
450 
451  static std::unique_ptr<Shell> CreateShellOnPlatformThread(
452  DartVMRef vm,
453  TaskRunners task_runners,
454  const PlatformData platform_data,
455  Settings settings,
456  fml::RefPtr<const DartSnapshot> isolate_snapshot,
457  const Shell::CreateCallback<PlatformView>& on_create_platform_view,
458  const Shell::CreateCallback<Rasterizer>& on_create_rasterizer);
459 
460  bool Setup(std::unique_ptr<PlatformView> platform_view,
461  std::unique_ptr<Engine> engine,
462  std::unique_ptr<Rasterizer> rasterizer,
463  std::unique_ptr<ShellIOManager> io_manager);
464 
465  void ReportTimings();
466 
467  // |PlatformView::Delegate|
468  void OnPlatformViewCreated(std::unique_ptr<Surface> surface) override;
469 
470  // |PlatformView::Delegate|
471  void OnPlatformViewDestroyed() override;
472 
473  // |PlatformView::Delegate|
474  void OnPlatformViewSetViewportMetrics(
475  const ViewportMetrics& metrics) override;
476 
477  // |PlatformView::Delegate|
478  void OnPlatformViewDispatchPlatformMessage(
479  fml::RefPtr<PlatformMessage> message) override;
480 
481  // |PlatformView::Delegate|
482  void OnPlatformViewDispatchPointerDataPacket(
483  std::unique_ptr<PointerDataPacket> packet) override;
484 
485  // |PlatformView::Delegate|
486  void OnPlatformViewDispatchSemanticsAction(
487  int32_t id,
489  std::vector<uint8_t> args) override;
490 
491  // |PlatformView::Delegate|
492  void OnPlatformViewSetSemanticsEnabled(bool enabled) override;
493 
494  // |shell:PlatformView::Delegate|
495  void OnPlatformViewSetAccessibilityFeatures(int32_t flags) override;
496 
497  // |PlatformView::Delegate|
498  void OnPlatformViewRegisterTexture(
499  std::shared_ptr<flutter::Texture> texture) override;
500 
501  // |PlatformView::Delegate|
502  void OnPlatformViewUnregisterTexture(int64_t texture_id) override;
503 
504  // |PlatformView::Delegate|
505  void OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) override;
506 
507  // |PlatformView::Delegate|
508  void OnPlatformViewSetNextFrameCallback(const fml::closure& closure) override;
509 
510  // |PlatformView::Delegate|
511  std::unique_ptr<std::vector<std::string>> ComputePlatformViewResolvedLocale(
512  const std::vector<std::string>& supported_locale_data) override;
513 
514  // |Animator::Delegate|
515  void OnAnimatorBeginFrame(fml::TimePoint frame_target_time) override;
516 
517  // |Animator::Delegate|
518  void OnAnimatorNotifyIdle(int64_t deadline) override;
519 
520  // |Animator::Delegate|
521  void OnAnimatorDraw(fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline,
522  fml::TimePoint frame_target_time) override;
523 
524  // |Animator::Delegate|
525  void OnAnimatorDrawLastLayerTree() override;
526 
527  // |Engine::Delegate|
528  void OnEngineUpdateSemantics(
529  SemanticsNodeUpdates update,
530  CustomAccessibilityActionUpdates actions) override;
531 
532  // |Engine::Delegate|
533  void OnEngineHandlePlatformMessage(
534  fml::RefPtr<PlatformMessage> message) override;
535 
536  void HandleEngineSkiaMessage(fml::RefPtr<PlatformMessage> message);
537 
538  // |Engine::Delegate|
539  void OnPreEngineRestart() override;
540 
541  // |Engine::Delegate|
542  void OnRootIsolateCreated() override;
543 
544  // |Engine::Delegate|
545  void UpdateIsolateDescription(const std::string isolate_name,
546  int64_t isolate_port) override;
547 
548  // |Engine::Delegate|
549  void SetNeedsReportTimings(bool value) override;
550 
551  // |Engine::Delegate|
552  std::unique_ptr<std::vector<std::string>> ComputePlatformResolvedLocale(
553  const std::vector<std::string>& supported_locale_data) override;
554 
555  // |Rasterizer::Delegate|
556  void OnFrameRasterized(const FrameTiming&) override;
557 
558  // |Rasterizer::Delegate|
559  fml::Milliseconds GetFrameBudget() override;
560 
561  // |Rasterizer::Delegate|
562  fml::TimePoint GetLatestFrameTargetTime() const override;
563 
564  // |ServiceProtocol::Handler|
565  fml::RefPtr<fml::TaskRunner> GetServiceProtocolHandlerTaskRunner(
566  std::string_view method) const override;
567 
568  // |ServiceProtocol::Handler|
569  bool HandleServiceProtocolMessage(
570  std::string_view method, // one if the extension names specified above.
571  const ServiceProtocolMap& params,
572  rapidjson::Document* response) override;
573 
574  // |ServiceProtocol::Handler|
575  ServiceProtocol::Handler::Description GetServiceProtocolDescription()
576  const override;
577 
578  // Service protocol handler
579  bool OnServiceProtocolScreenshot(
581  rapidjson::Document* response);
582 
583  // Service protocol handler
584  bool OnServiceProtocolScreenshotSKP(
586  rapidjson::Document* response);
587 
588  // Service protocol handler
589  bool OnServiceProtocolRunInView(
591  rapidjson::Document* response);
592 
593  // Service protocol handler
594  bool OnServiceProtocolFlushUIThreadTasks(
596  rapidjson::Document* response);
597 
598  // Service protocol handler
599  bool OnServiceProtocolSetAssetBundlePath(
601  rapidjson::Document* response);
602 
603  // Service protocol handler
604  bool OnServiceProtocolGetDisplayRefreshRate(
606  rapidjson::Document* response);
607 
608  // Service protocol handler
609  //
610  // The returned SkSLs are base64 encoded. Decode before storing them to files.
611  bool OnServiceProtocolGetSkSLs(
613  rapidjson::Document* response);
614 
615  // Service protocol handler
616  bool OnServiceProtocolEstimateRasterCacheMemory(
618  rapidjson::Document* response);
619 
620  // Creates an asset bundle from the original settings asset path or
621  // directory.
622  std::unique_ptr<DirectoryAssetBundle> RestoreOriginalAssetResolver();
623 
624  // For accessing the Shell via the raster thread, necessary for various
625  // rasterizer callbacks.
626  std::unique_ptr<fml::TaskRunnerAffineWeakPtrFactory<Shell>> weak_factory_gpu_;
627 
628  fml::WeakPtrFactory<Shell> weak_factory_;
629  friend class testing::ShellTest;
630 
632 };
633 
634 } // namespace flutter
635 
636 #endif // SHELL_COMMON_SHELL_H_
Settings settings_
G_BEGIN_DECLS FlValue * args
While the engine operates entirely on the UI task runner, it needs the capabilities of the other comp...
Definition: engine.h:139
std::function< std::unique_ptr< T >(Shell &)> CreateCallback
Definition: shell.h:99
std::map< std::string_view, std::string_view > ServiceProtocolMap
The Dart error code for an API error.
Dart_NativeFunction function
Definition: fuchsia.cc:51
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
DartErrorCode
Error exit codes for the Dart isolate.
Definition: shell.h:43
TaskRunners task_runners_
The Dart error code for an unkonwn error.
static void NotifyLowMemoryWarning(JNIEnv *env, jobject obj, jlong shell_holder)
std::function< void()> closure
Definition: closure.h:14
A POD type used to return the screenshot data along with the size of the frame.
Definition: rasterizer.h:279
uint8_t value
ScreenshotType
The type of the screenshot to obtain of the previously rendered layer tree.
Definition: rasterizer.h:249
Specifies all the configuration required by the runtime library to launch the root isolate...
SemanticsAction action
Dart_Handle ComputePlatformResolvedLocale(Dart_Handle supportedLocalesHandle)
Used to forward events from the rasterizer to interested subsystems. Currently, the shell sets itself...
Definition: rasterizer.h:53
fml::WeakPtr< IOManager > io_manager_
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
RunStatus
Indicates the result of the call to Engine::Run.
Definition: engine.h:80
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
Used to forward events from the platform view to interested subsystems. This forwarding is done by th...
Definition: platform_view.h:51
The Dart error code for a compilation error.
std::chrono::duration< double, std::milli > Milliseconds
Definition: time_delta.h:18
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart flags
Definition: switches.h:66
No error has occurred.