Flutter Windows Embedder
event_watcher.h
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 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EVENT_WATCHER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_EVENT_WATCHER_H_
7 
8 #include <Windows.h>
9 
10 #include <functional>
11 
12 #include "flutter/fml/macros.h"
13 
14 namespace flutter {
15 
16 // A win32 `HANDLE` wrapper for use as a one-time callback.
17 class EventWatcher {
18  public:
19  explicit EventWatcher(std::function<void()> callback);
20  ~EventWatcher();
21 
22  // Returns `HANDLE`, which can be used to register an event listener.
23  HANDLE GetHandle();
24 
25  private:
26  static VOID CALLBACK CallbackForWait(PVOID context, BOOLEAN);
27 
28  std::function<void()> callback_;
29 
30  HANDLE handle_;
31  HANDLE handle_for_wait_;
32 
33  FML_DISALLOW_COPY_AND_ASSIGN(EventWatcher);
34 };
35 
36 } // namespace flutter
37 
38 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_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:51