Flutter Engine
 
Loading...
Searching...
No Matches
embedder_config_builder.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_TESTS_EMBEDDER_CONFIG_BUILDER_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_
7
13
14namespace flutter::testing {
15
17 static FlutterEngine InvalidValue() { return nullptr; }
18
19 static bool IsValid(const FlutterEngine& value) { return value != nullptr; }
20
21 static void Free(FlutterEngine engine) {
22 auto result = FlutterEngineShutdown(engine);
23 FML_CHECK(result == kSuccess);
24 }
25};
26
28
30 public:
37
38 explicit EmbedderConfigBuilder(
39 EmbedderTestContext& context,
40 InitializationPreference preference =
42
44
46
47 void SetAssetsPath();
48
49 void SetSnapshots();
50
51 void SetAOTDataElf();
52
54
56
57 // Used to set a custom log message handler.
59
61
63
64 // Used to set a custom log tag.
65 void SetLogTag(std::string tag);
66
68
69 void SetExecutableName(std::string executable_name);
70
71 void SetDartEntrypoint(std::string entrypoint);
72
73 void AddCommandLineArgument(std::string arg);
74
75 void AddDartEntrypointArgument(std::string arg);
76
78
80
82
84 const std::function<void(const FlutterPlatformMessage*)>& callback);
85
87 const std::function<void(const FlutterViewFocusChangeRequest*)>&
88 callback);
89
90 void SetCompositor(bool avoid_backing_store_cache = false,
91 bool use_present_layers_callback = false);
92
94
95 void SetSurface(DlISize surface_size) { context_.SetSurface(surface_size); }
96
99 FlutterSoftwarePixelFormat software_pixfmt =
101
103
105
106 // Sets up the callback for vsync, the callbacks needs to be specified on the
107 // text context vis `SetVsyncCallback`.
108 void SetupVsyncCallback();
109
112
113 private:
114 EmbedderTestContext& context_;
115 FlutterProjectArgs project_args_ = {};
116 std::string dart_entrypoint_;
117 FlutterCustomTaskRunners custom_task_runners_ = {};
118 FlutterCompositor compositor_ = {};
119 std::vector<std::string> command_line_arguments_;
120 std::vector<std::string> dart_entrypoint_arguments_;
121 std::string log_tag_;
122
123 UniqueEngine SetupEngine(bool run) const;
124
125 FML_DISALLOW_COPY_AND_ASSIGN(EmbedderConfigBuilder);
126};
127
128} // namespace flutter::testing
129
130#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_
GLenum type
void SetPlatformTaskRunner(const FlutterTaskRunnerDescription *runner)
void SetExecutableName(std::string executable_name)
void SetRenderTargetType(EmbedderTestBackingStoreProducer::RenderTargetType type, FlutterSoftwarePixelFormat software_pixfmt=kFlutterSoftwarePixelFormatNative32)
void SetViewFocusChangeRequestCallback(const std::function< void(const FlutterViewFocusChangeRequest *)> &callback)
void SetViewFocusChangeRequestCallback(const FlutterViewFocusChangeRequestCallback &callback)
void SetRenderTaskRunner(const FlutterTaskRunnerDescription *runner)
void SetUITaskRunner(const FlutterTaskRunnerDescription *runner)
void SetCompositor(bool avoid_backing_store_cache=false, bool use_present_layers_callback=false)
void SetPlatformMessageCallback(const std::function< void(const FlutterPlatformMessage *)> &callback)
virtual void SetSurface(DlISize surface_size)=0
int32_t value
FlutterEngineResult FlutterEngineShutdown(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embed...
Definition embedder.cc:2649
FlutterSoftwarePixelFormat
Definition embedder.h:450
@ kFlutterSoftwarePixelFormatNative32
Definition embedder.h:506
void(* FlutterViewFocusChangeRequestCallback)(const FlutterViewFocusChangeRequest *, void *)
Definition embedder.h:1842
FlutterEngine engine
Definition main.cc:84
FlutterDesktopBinaryReply callback
#define FML_CHECK(condition)
Definition logging.h:104
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
fml::UniqueObject< FlutterEngine, UniqueEngineTraits > UniqueEngine
static bool IsValid(const FlutterEngine &value)
static void Free(FlutterEngine engine)