Flutter Engine
The Flutter Engine
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
7namespace flutter {
8
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
19 UnregisterWait(handle_for_wait_);
20 CloseHandle(handle_);
21}
22
24 return handle_;
25}
26
27// static
28VOID 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
EventWatcher(std::function< void()> callback)
Definition: event_watcher.cc:9
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
Definition: fuchsia.cc:51
return FALSE
void * PVOID
Definition: windows_types.h:35
BYTE BOOLEAN
Definition: windows_types.h:39
#define CreateEvent
#define VOID
Definition: windows_types.h:27
void * HANDLE
Definition: windows_types.h:36
#define CALLBACK