| Flutter Windows Embedder |

Classes | Public Member Functions | Static Public Member Functions | List of all members
flutter::TaskRunnerWindow Class Reference

`#include <task_runner_window.h>`

## Classes
class | Delegate

## Public Member Functions
void | WakeUp ()
void | AddDelegate (Delegate *delegate)
void | RemoveDelegate (Delegate *delegate)
void | PollOnce (std::chrono::milliseconds timeout)
| ~TaskRunnerWindow ()

## Static Public Member Functions
static std::shared_ptr< TaskRunnerWindow > | GetSharedInstance ()

## Detailed Description

Definition at line 20 of file task_runner_window.h.

## Constructor & Destructor Documentation

## ◆ ~TaskRunnerWindow()

flutter::TaskRunnerWindow::~TaskRunnerWindow | ( |  | ) |

Definition at line 40 of file task_runner_window.cc.

40 {
41 if (window_handle_) {
42 DestroyWindow(window_handle_);
43 window_handle_ = nullptr;
44 }
45 UnregisterClass(window_class_name_.c_str(), nullptr);
46 }

## Member Function Documentation

## ◆ AddDelegate()

void flutter::TaskRunnerWindow::AddDelegate | ( | Delegate * | delegate | ) |

Definition at line 65 of file task_runner_window.cc.

65 {
66 delegates_.push_back(delegate);
67 SetTimer(std::chrono::nanoseconds::zero());
68 }

## ◆ GetSharedInstance()

std::shared_ptr< TaskRunnerWindow > flutter::TaskRunnerWindow::GetSharedInstance | ( |  | ) |
| static

Definition at line 48 of file task_runner_window.cc.

48 {
49 static std::weak_ptr<TaskRunnerWindow> instance;
50 auto res = instance.lock();
51 if (!res) {
52 // can't use make_shared with private contructor
53 res.reset(new TaskRunnerWindow());
54 instance = res;
55 }
56 return res;
57 }

Referenced by flutter::TaskRunner::TaskRunner().

## ◆ PollOnce()

void flutter::TaskRunnerWindow::PollOnce | ( | std::chrono::milliseconds | timeout | ) |

Definition at line 77 of file task_runner_window.cc.

77 {
78 MSG msg;
79 ::SetTimer(window_handle_, kPollTimeoutTimerId, timeout.count(), nullptr);
80 if (GetMessage(&msg, window_handle_, 0, 0)) {
81 TranslateMessage(&msg);
82 DispatchMessage(&msg);
83 }
84 ::KillTimer(window_handle_, kPollTimeoutTimerId);
85 }
flutter::kPollTimeoutTimerId
static const uintptr_t kPollTimeoutTimerId
Definition: task_runner_window.cc:16

References flutter::kPollTimeoutTimerId.

## ◆ RemoveDelegate()

void flutter::TaskRunnerWindow::RemoveDelegate | ( | Delegate * | delegate | ) |

Definition at line 70 of file task_runner_window.cc.

70 {
71 auto i = std::find(delegates_.begin(), delegates_.end(), delegate);
72 if (i != delegates_.end()) {
73 delegates_.erase(i);
74 }
75 }

## ◆ WakeUp()

void flutter::TaskRunnerWindow::WakeUp | ( |  | ) |

Definition at line 59 of file task_runner_window.cc.

59 {
60 if (!PostMessage(window_handle_, WM_NULL, 0, 0)) {
61 FML_LOG(ERROR) << "Failed to post message to main thread.";
62 }
63 }

The documentation for this class was generated from the following files:

- shell/platform/windows/task_runner_window.h
- shell/platform/windows/task_runner_window.cc