5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_
13 #include <string_view>
14 #include <unordered_map>
17 #include "flutter/fml/closure.h"
18 #include "flutter/fml/macros.h"
19 #include "flutter/fml/synchronization/shared_mutex.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: {
114 bool Run(std::string_view entrypoint);
117 virtual bool running()
const {
return engine_ !=
nullptr; }
127 std::unique_ptr<FlutterWindowsView>
CreateView(
128 std::unique_ptr<WindowBindingHandler> window);
147 void SetSwitches(
const std::vector<std::string>& switches);
152 return message_dispatcher_.get();
160 return texture_registrar_.get();
168 return window_proc_delegate_manager_.get();
183 return keyboard_key_handler_.get();
191 const size_t message_size,
232 FlutterSemanticsAction
action,
233 fml::MallocMapping data);
260 root_isolate_create_callback_ =
callback;
267 void OnQuit(std::optional<HWND> hwnd,
268 std::optional<WPARAM> wparam,
269 std::optional<LPARAM> lparam,
294 return lifecycle_manager_.get();
298 return windows_proc_table_;
336 void SendSystemLocales();
345 void InitializeKeyboard();
348 void SendAccessibilityFeatures();
353 bool Present(
const FlutterPresentViewInfo* info);
358 FlutterEngineProcTable embedder_api_ = {};
360 std::unique_ptr<FlutterProjectBundle> project_;
378 std::unordered_map<FlutterViewId, FlutterWindowsView*> views_;
387 std::unique_ptr<fml::SharedMutex> views_mutex_;
390 std::unique_ptr<TaskRunner> task_runner_;
393 fml::RefPtr<flutter::FlutterDesktopMessenger> messenger_;
396 std::unique_ptr<BinaryMessengerImpl> messenger_wrapper_;
399 std::unique_ptr<IncomingMessageDispatcher> message_dispatcher_;
402 std::unique_ptr<FlutterDesktopPluginRegistrar> plugin_registrar_;
405 std::unique_ptr<FlutterWindowsTextureRegistrar> texture_registrar_;
410 std::unique_ptr<egl::Manager> egl_manager_;
414 std::unique_ptr<Compositor> compositor_;
417 std::unique_ptr<PluginRegistrar> internal_plugin_registrar_;
420 std::unique_ptr<AccessibilityPlugin> accessibility_plugin_;
423 std::unique_ptr<CursorHandler> cursor_handler_;
426 std::unique_ptr<PlatformHandler> platform_handler_;
429 std::unique_ptr<KeyboardHandlerBase> keyboard_key_handler_;
432 std::unique_ptr<TextInputPlugin> text_input_plugin_;
435 std::unique_ptr<SettingsPlugin> settings_plugin_;
441 plugin_registrar_destruction_callbacks_;
444 std::chrono::nanoseconds FrameInterval();
447 std::chrono::nanoseconds start_time_ = std::chrono::nanoseconds::zero();
450 std::optional<std::chrono::nanoseconds> frame_interval_override_ =
453 bool semantics_enabled_ =
false;
455 bool high_contrast_enabled_ =
false;
457 bool enable_impeller_ =
false;
460 std::unique_ptr<WindowProcDelegateManager> window_proc_delegate_manager_;
463 fml::closure root_isolate_create_callback_;
466 fml::closure next_frame_callback_;
469 std::unique_ptr<WindowsLifecycleManager> lifecycle_manager_;
471 std::shared_ptr<WindowsProcTable> windows_proc_table_;
473 std::shared_ptr<egl::ProcTable> gl_;
475 std::unique_ptr<PlatformViewPlugin> platform_view_plugin_;
482 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_ENGINE_H_