Flutter Engine
The 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_external_texture_resolver.h"
16#include "flutter/shell/platform/embedder/embedder_thread_host.h"
17namespace flutter {
18
19struct ShellArgs;
20
21// The object that is returned to the embedder as an opaque pointer to the
22// instance of the Flutter engine.
24 public:
26 std::unique_ptr<EmbedderThreadHost> thread_host,
27 const TaskRunners& task_runners,
28 const Settings& settings,
29 RunConfiguration run_configuration,
30 const Shell::CreateCallback<PlatformView>& on_create_platform_view,
31 const Shell::CreateCallback<Rasterizer>& on_create_rasterizer,
32 std::unique_ptr<EmbedderExternalTextureResolver>
33 external_texture_resolver);
34
36
37 bool LaunchShell();
38
39 bool CollectShell();
40
41 const TaskRunners& GetTaskRunners() const;
42
43 bool NotifyCreated();
44
45 bool NotifyDestroyed();
46
47 bool RunRootIsolate();
48
49 bool IsValid() const;
50
51 bool SetViewportMetrics(int64_t view_id,
52 const flutter::ViewportMetrics& metrics);
53
55 std::unique_ptr<flutter::PointerDataPacket> packet);
56
57 bool SendPlatformMessage(std::unique_ptr<PlatformMessage> message);
58
59 bool RegisterTexture(int64_t texture);
60
61 bool UnregisterTexture(int64_t texture);
62
64
65 bool SetSemanticsEnabled(bool enabled);
66
67 bool SetAccessibilityFeatures(int32_t flags);
68
69 bool DispatchSemanticsAction(int node_id,
72
73 bool OnVsyncEvent(intptr_t baton,
74 fml::TimePoint frame_start_time,
75 fml::TimePoint frame_target_time);
76
77 bool ReloadSystemFonts();
78
79 bool PostRenderThreadTask(const fml::closure& task);
80
81 bool RunTask(const FlutterTask* task);
82
85
86 bool ScheduleFrame();
87
88 Shell& GetShell();
89
90 private:
91 const std::unique_ptr<EmbedderThreadHost> thread_host_;
92 TaskRunners task_runners_;
93 RunConfiguration run_configuration_;
94 std::unique_ptr<ShellArgs> shell_args_;
95 std::unique_ptr<Shell> shell_;
96 std::unique_ptr<EmbedderExternalTextureResolver> external_texture_resolver_;
97
98 FML_DISALLOW_COPY_AND_ASSIGN(EmbedderEngine);
99};
100
101} // namespace flutter
102
103#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
bool MarkTextureFrameAvailable(int64_t texture)
bool PostTaskOnEngineManagedNativeThreads(const std::function< void(FlutterNativeThreadType)> &closure) const
EmbedderEngine(std::unique_ptr< EmbedderThreadHost > thread_host, const TaskRunners &task_runners, const Settings &settings, RunConfiguration run_configuration, const Shell::CreateCallback< PlatformView > &on_create_platform_view, const Shell::CreateCallback< Rasterizer > &on_create_rasterizer, std::unique_ptr< EmbedderExternalTextureResolver > external_texture_resolver)
bool RegisterTexture(int64_t texture)
bool PostRenderThreadTask(const fml::closure &task)
bool SetAccessibilityFeatures(int32_t flags)
bool SetViewportMetrics(int64_t view_id, const flutter::ViewportMetrics &metrics)
bool RunTask(const FlutterTask *task)
bool DispatchPointerDataPacket(std::unique_ptr< flutter::PointerDataPacket > packet)
const TaskRunners & GetTaskRunners() const
bool DispatchSemanticsAction(int node_id, flutter::SemanticsAction action, fml::MallocMapping args)
bool UnregisterTexture(int64_t texture)
bool SendPlatformMessage(std::unique_ptr< PlatformMessage > message)
bool SetSemanticsEnabled(bool enabled)
bool OnVsyncEvent(intptr_t baton, fml::TimePoint frame_start_time, fml::TimePoint frame_target_time)
Specifies all the configuration required by the runtime library to launch the root isolate....
std::function< std::unique_ptr< T >(Shell &)> CreateCallback
Definition: shell.h:120
A Mapping like NonOwnedMapping, but uses Free as its release proc.
Definition: mapping.h:144
FlutterNativeThreadType
Definition: embedder.h:2086
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Dart_NativeFunction function
Definition: fuchsia.cc:51
Win32Message message
FlTexture * texture
std::function< void()> closure
Definition: closure.h:14