Flutter Engine
embedder_engine.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_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
6 #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
7 
8 #include <memory>
9 #include <unordered_map>
10 
11 #include "flutter/fml/macros.h"
12 #include "flutter/shell/common/shell.h"
13 #include "flutter/shell/common/thread_host.h"
14 #include "flutter/shell/platform/embedder/embedder.h"
15 #include "flutter/shell/platform/embedder/embedder_thread_host.h"
16 
17 #ifdef SHELL_ENABLE_GL
18 #include "flutter/shell/platform/embedder/embedder_external_texture_gl.h"
19 #endif
20 
21 namespace flutter {
22 
23 struct ShellArgs;
24 
25 // The object that is returned to the embedder as an opaque pointer to the
26 // instance of the Flutter engine.
28  public:
29  EmbedderEngine(std::unique_ptr<EmbedderThreadHost> thread_host,
30  TaskRunners task_runners,
31  Settings settings,
32  RunConfiguration run_configuration,
33  Shell::CreateCallback<PlatformView> on_create_platform_view,
34  Shell::CreateCallback<Rasterizer> on_create_rasterizer
35 #ifdef SHELL_ENABLE_GL
36  ,
38  external_texture_callback
39 #endif
40  );
41 
43 
44  bool LaunchShell();
45 
46  bool CollectShell();
47 
48  const TaskRunners& GetTaskRunners() const;
49 
50  bool NotifyCreated();
51 
52  bool NotifyDestroyed();
53 
54  bool RunRootIsolate();
55 
56  bool IsValid() const;
57 
59 
61  std::unique_ptr<flutter::PointerDataPacket> packet);
62 
64 
65  bool RegisterTexture(int64_t texture);
66 
67  bool UnregisterTexture(int64_t texture);
68 
69  bool MarkTextureFrameAvailable(int64_t texture);
70 
71  bool SetSemanticsEnabled(bool enabled);
72 
73  bool SetAccessibilityFeatures(int32_t flags);
74 
75  bool DispatchSemanticsAction(int id,
77  std::vector<uint8_t> args);
78 
79  bool OnVsyncEvent(intptr_t baton,
80  fml::TimePoint frame_start_time,
81  fml::TimePoint frame_target_time);
82 
83  bool ReloadSystemFonts();
84 
85  bool PostRenderThreadTask(const fml::closure& task);
86 
87  bool RunTask(const FlutterTask* task);
88 
91 
92  Shell& GetShell();
93 
94  private:
95  const std::unique_ptr<EmbedderThreadHost> thread_host_;
96  TaskRunners task_runners_;
97  RunConfiguration run_configuration_;
98  std::unique_ptr<ShellArgs> shell_args_;
99  std::unique_ptr<Shell> shell_;
100 #ifdef SHELL_ENABLE_GL
102  external_texture_callback_;
103 #endif
104 
105  FML_DISALLOW_COPY_AND_ASSIGN(EmbedderEngine);
106 };
107 
108 } // namespace flutter
109 
110 #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
G_BEGIN_DECLS FlValue * args
bool DispatchPointerDataPacket(std::unique_ptr< flutter::PointerDataPacket > packet)
std::function< std::unique_ptr< T >(Shell &)> CreateCallback
Definition: shell.h:99
bool SendPlatformMessage(fml::RefPtr< flutter::PlatformMessage > message)
bool RunTask(const FlutterTask *task)
bool DispatchSemanticsAction(int id, flutter::SemanticsAction action, std::vector< uint8_t > args)
Dart_NativeFunction function
Definition: fuchsia.cc:51
bool SetViewportMetrics(flutter::ViewportMetrics metrics)
bool OnVsyncEvent(intptr_t baton, fml::TimePoint frame_start_time, fml::TimePoint frame_target_time)
bool SetAccessibilityFeatures(int32_t flags)
bool PostTaskOnEngineManagedNativeThreads(std::function< void(FlutterNativeThreadType)> closure) const
std::function< void()> closure
Definition: closure.h:14
Specifies all the configuration required by the runtime library to launch the root isolate...
SemanticsAction action
bool SetSemanticsEnabled(bool enabled)
bool RegisterTexture(int64_t texture)
bool UnregisterTexture(int64_t texture)
FlutterNativeThreadType
Definition: embedder.h:1096
bool PostRenderThreadTask(const fml::closure &task)
const TaskRunners & GetTaskRunners() const
std::function< sk_sp< SkImage >(int64_t texture_identifier, GrDirectContext *, const SkISize &)> ExternalTextureCallback
EmbedderEngine(std::unique_ptr< EmbedderThreadHost > thread_host, TaskRunners task_runners, Settings settings, RunConfiguration run_configuration, Shell::CreateCallback< PlatformView > on_create_platform_view, Shell::CreateCallback< Rasterizer > on_create_rasterizer)
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
bool MarkTextureFrameAvailable(int64_t texture)