5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
12 #include <shared_mutex>
14 #include <string_view>
15 #include <unordered_map>
18 #include "flutter/fml/closure.h"
19 #include "flutter/fml/macros.h"
25 #include "flutter/shell/platform/embedder/embedder.h"
47 #include "third_party/rapidjson/include/rapidjson/document.h"
61 FlutterThreadPriority priority) {
65 case FlutterThreadPriority::kBackground: {
66 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
69 case FlutterThreadPriority::kDisplay: {
70 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
73 case FlutterThreadPriority::kRaster: {
74 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
77 case FlutterThreadPriority::kNormal: {
120 bool Run(std::string_view entrypoint);
123 virtual bool running()
const {
return engine_ !=
nullptr; }
133 std::unique_ptr<FlutterWindowsView>
CreateView(
134 std::unique_ptr<WindowBindingHandler> window);
153 void SetSwitches(
const std::vector<std::string>& switches);
158 return message_dispatcher_.get();
166 return texture_registrar_.get();
174 return window_proc_delegate_manager_.get();
192 return keyboard_key_handler_.get();
200 const size_t message_size,
241 FlutterSemanticsAction
action,
242 fml::MallocMapping data);
269 root_isolate_create_callback_ =
callback;
276 void OnQuit(std::optional<HWND> hwnd,
277 std::optional<WPARAM> wparam,
278 std::optional<LPARAM> lparam,
303 return lifecycle_manager_.get();
307 return windows_proc_table_;
338 const FlutterViewFocusChangeRequest* request);
348 void SendSystemLocales();
357 void InitializeKeyboard();
360 void SendAccessibilityFeatures();
365 bool Present(
const FlutterPresentViewInfo* info);
370 FlutterEngineProcTable embedder_api_ = {};
372 std::unique_ptr<FlutterProjectBundle> project_;
390 std::unordered_map<FlutterViewId, FlutterWindowsView*> views_;
399 mutable std::shared_mutex views_mutex_;
402 std::unique_ptr<TaskRunner> task_runner_;
405 fml::RefPtr<flutter::FlutterDesktopMessenger> messenger_;
408 std::unique_ptr<BinaryMessengerImpl> messenger_wrapper_;
411 std::unique_ptr<IncomingMessageDispatcher> message_dispatcher_;
414 std::unique_ptr<FlutterDesktopPluginRegistrar> plugin_registrar_;
417 std::unique_ptr<FlutterWindowsTextureRegistrar> texture_registrar_;
422 std::unique_ptr<egl::Manager> egl_manager_;
426 std::unique_ptr<Compositor> compositor_;
429 std::unique_ptr<PluginRegistrar> internal_plugin_registrar_;
432 std::unique_ptr<AccessibilityPlugin> accessibility_plugin_;
435 std::unique_ptr<CursorHandler> cursor_handler_;
438 std::unique_ptr<PlatformHandler> platform_handler_;
441 std::unique_ptr<KeyboardHandlerBase> keyboard_key_handler_;
444 std::unique_ptr<TextInputPlugin> text_input_plugin_;
447 std::unique_ptr<SettingsPlugin> settings_plugin_;
453 plugin_registrar_destruction_callbacks_;
456 std::chrono::nanoseconds FrameInterval();
459 std::chrono::nanoseconds start_time_ = std::chrono::nanoseconds::zero();
462 std::optional<std::chrono::nanoseconds> frame_interval_override_ =
465 bool semantics_enabled_ =
false;
467 bool high_contrast_enabled_ =
false;
469 bool enable_impeller_ =
false;
472 std::unique_ptr<WindowProcDelegateManager> window_proc_delegate_manager_;
475 fml::closure root_isolate_create_callback_;
478 fml::closure next_frame_callback_;
481 std::unique_ptr<WindowsLifecycleManager> lifecycle_manager_;
483 std::shared_ptr<WindowsProcTable> windows_proc_table_;
485 std::shared_ptr<egl::ProcTable> gl_;
487 std::unique_ptr<PlatformViewPlugin> platform_view_plugin_;
494 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_