Flutter Windows Embedder
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)
 
 ~TaskRunnerWindow ()
 

Static Public Member Functions

static std::shared_ptr< TaskRunnerWindowGetSharedInstance ()
 

Detailed Description

Definition at line 20 of file task_runner_window.h.

Constructor & Destructor Documentation

◆ ~TaskRunnerWindow()

flutter::TaskRunnerWindow::~TaskRunnerWindow ( )

Definition at line 35 of file task_runner_window.cc.

35  {
36  if (window_handle_) {
37  DestroyWindow(window_handle_);
38  window_handle_ = nullptr;
39  }
40  UnregisterClass(window_class_name_.c_str(), nullptr);
41 }

Member Function Documentation

◆ AddDelegate()

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

Definition at line 60 of file task_runner_window.cc.

60  {
61  delegates_.push_back(delegate);
62  SetTimer(std::chrono::nanoseconds::zero());
63 }

◆ GetSharedInstance()

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

Definition at line 43 of file task_runner_window.cc.

43  {
44  static std::weak_ptr<TaskRunnerWindow> instance;
45  auto res = instance.lock();
46  if (!res) {
47  // can't use make_shared with private contructor
48  res.reset(new TaskRunnerWindow());
49  instance = res;
50  }
51  return res;
52 }

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

◆ RemoveDelegate()

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

Definition at line 65 of file task_runner_window.cc.

65  {
66  auto i = std::find(delegates_.begin(), delegates_.end(), delegate);
67  if (i != delegates_.end()) {
68  delegates_.erase(i);
69  }
70 }

◆ WakeUp()

void flutter::TaskRunnerWindow::WakeUp ( )

Definition at line 54 of file task_runner_window.cc.

54  {
55  if (!PostMessage(window_handle_, WM_NULL, 0, 0)) {
56  FML_LOG(ERROR) << "Failed to post message to main thread.";
57  }
58 }

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