Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter_windows_engine_builder.cc
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
6
9
10namespace flutter {
11namespace testing {
12
14 public:
16 const FlutterProjectBundle& project,
19 std::shared_ptr<WindowsProcTable> windows_proc_table = nullptr)
21 get_key_state_(std::move(get_key_state)),
22 map_vk_to_scan_(std::move(map_vk_to_scan)) {}
23
24 protected:
25 std::unique_ptr<KeyboardHandlerBase> CreateKeyboardKeyHandler(
29 if (get_key_state_) {
30 get_key_state = get_key_state_;
31 }
32
33 if (map_vk_to_scan_) {
34 map_vk_to_scan = map_vk_to_scan_;
35 }
36
38 messenger, get_key_state, map_vk_to_scan);
39 }
40
41 private:
44
46};
47
50 : context_(context) {
51 properties_.assets_path = context.GetAssetsPath().c_str();
52 properties_.icu_data_path = context.GetIcuDataPath().c_str();
53 properties_.aot_library_path = context.GetAotLibraryPath().c_str();
54 properties_.impeller_switch = DefaultImpeller;
55}
56
58
60 dart_entrypoint_ = std::move(entrypoint);
61 properties_.dart_entrypoint = dart_entrypoint_.c_str();
62}
63
65 dart_entrypoint_arguments_.emplace_back(std::move(arg));
66}
67
69 std::vector<std::string> switches) {
70 switches_ = std::move(switches);
71}
72
74 FlutterDesktopImpellerSwitch impeller_switch) {
75 properties_.impeller_switch = impeller_switch;
76}
77
81 get_key_state_ = std::move(get_key_state);
82 map_vk_to_scan_ = std::move(map_vk_to_scan);
83}
84
86 std::shared_ptr<WindowsProcTable> windows_proc_table) {
87 windows_proc_table_ = std::move(windows_proc_table);
88}
89
90std::unique_ptr<FlutterWindowsEngine> FlutterWindowsEngineBuilder::Build() {
91 std::vector<const char*> dart_args;
92 dart_args.reserve(dart_entrypoint_arguments_.size());
93
94 for (const auto& arg : dart_entrypoint_arguments_) {
95 dart_args.push_back(arg.c_str());
96 }
97
98 if (!dart_args.empty()) {
99 properties_.dart_entrypoint_argv = dart_args.data();
100 properties_.dart_entrypoint_argc = dart_args.size();
101 } else {
102 properties_.dart_entrypoint_argv = nullptr;
103 properties_.dart_entrypoint_argc = 0;
104 }
105
106 FlutterProjectBundle project(properties_);
107 project.SetSwitches(switches_);
108
109 return std::make_unique<TestFlutterWindowsEngine>(
110 project, get_key_state_, map_vk_to_scan_, std::move(windows_proc_table_));
111}
112
113} // namespace testing
114} // namespace flutter
void SetSwitches(const std::vector< std::string > &switches)
FlutterDesktopMessengerRef messenger()
std::shared_ptr< WindowsProcTable > windows_proc_table()
virtual std::unique_ptr< KeyboardHandlerBase > CreateKeyboardKeyHandler(BinaryMessenger *messenger, KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state, KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan)
std::function< SHORT(UINT, bool)> MapVirtualKeyToScanCode
void SetCreateKeyboardHandlerCallbacks(KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state, KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan)
void SetSwitches(std::vector< std::string > switches)
void SetImpellerSwitch(FlutterDesktopImpellerSwitch impeller_switch)
void SetWindowsProcTable(std::shared_ptr< WindowsProcTable > windows_proc_table)
std::unique_ptr< KeyboardHandlerBase > CreateKeyboardKeyHandler(BinaryMessenger *messenger, KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state, KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan)
TestFlutterWindowsEngine(const FlutterProjectBundle &project, KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state, KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
FlutterDesktopImpellerSwitch
@ DefaultImpeller
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
Definition ref_ptr.h:261
std::shared_ptr< ContextGLES > context
FlutterDesktopImpellerSwitch impeller_switch