Flutter Engine
The Flutter Engine
handle_waiter.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_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_WAITER_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_WAITER_H_
7
8#include <lib/async/cpp/wait.h>
9#include <lib/zx/handle.h>
10
11#include "flutter/fml/memory/ref_counted.h"
13
14namespace tonic {
15class DartLibraryNatives;
16} // namespace tonic
17
18namespace zircon {
19namespace dart {
20
21class Handle;
22
23class HandleWaiter : public fml::RefCountedThreadSafe<HandleWaiter>,
25 DEFINE_WRAPPERTYPEINFO();
26 FML_FRIEND_REF_COUNTED_THREAD_SAFE(HandleWaiter);
27 FML_FRIEND_MAKE_REF_COUNTED(HandleWaiter);
28
29 public:
31 zx_signals_t signals,
33
34 void Cancel();
35
36 bool is_pending() { return wait_.is_pending(); }
37
38 static void RegisterNatives(tonic::DartLibraryNatives* natives);
39
40 private:
41 explicit HandleWaiter(Handle* handle,
42 zx_signals_t signals,
45
46 void OnWaitComplete(async_dispatcher_t* dispatcher,
47 async::WaitBase* wait,
48 zx_status_t status,
49 const zx_packet_signal_t* signal);
50
51 void RetainDartWrappableReference() const override { AddRef(); }
52
53 void ReleaseDartWrappableReference() const override { Release(); }
54
55 async::WaitMethod<HandleWaiter, &HandleWaiter::OnWaitComplete> wait_;
56 Handle* handle_;
58};
59
60} // namespace dart
61} // namespace zircon
62
63#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_WAITER_H_
static void RegisterNatives(tonic::DartLibraryNatives *natives)
static fml::RefPtr< HandleWaiter > Create(Handle *handle, zx_signals_t signals, Dart_Handle callback)
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static guint signals[kSignalLastSignal]
Definition: fl_settings.cc:16
Definition: dart_vm.cc:33
Definition: handle.cc:14