| Flutter Windows Embedder |

event_watcher.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
5 #include "flutter/shell/platform/windows/event_watcher.h"
6
7 namespace flutter {
8
9 EventWatcher::EventWatcher(std::function<void()> callback)
10 : callback_(callback) {
11 handle_ = CreateEvent(NULL, TRUE, FALSE, NULL);
12
13 RegisterWaitForSingleObject(&handle_for_wait_, handle_, &CallbackForWait,
14 reinterpret_cast<void*>(this), INFINITE,
15 WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD);
16 }
17
18 EventWatcher::~EventWatcher() {
19 UnregisterWait(handle_for_wait_);
20 CloseHandle(handle_);
21 }
22
23 HANDLE EventWatcher::GetHandle() {
24 return handle_;
25 }
26
27 // static
28 VOID CALLBACK EventWatcher::CallbackForWait(PVOID context, BOOLEAN) {
29 EventWatcher* self = reinterpret_cast<EventWatcher*>(context);
30 ResetEvent(self->handle_);
31 self->callback_();
32 }
33
34 } // namespace flutter
event_watcher.h
flutter::EventWatcher
Definition: event_watcher.h:17
flutter::EventWatcher::~EventWatcher
~EventWatcher()
Definition: event_watcher.cc:18
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::EventWatcher::EventWatcher
EventWatcher(std::function< void()> callback)
Definition: event_watcher.cc:9
flutter::EventWatcher::GetHandle
HANDLE GetHandle()
Definition: event_watcher.cc:23
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:46