5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_H_
8#include <zircon/syscalls.h>
13#include "flutter/fml/memory/ref_counted.h"
15#include "third_party/dart/runtime/include/dart_api.h"
28 DEFINE_WRAPPERTYPEINFO();
29 FML_FRIEND_REF_COUNTED_THREAD_SAFE(
Handle);
30 FML_FRIEND_MAKE_REF_COUNTED(
Handle);
51 bool is_valid()
const {
return handle_ != ZX_HANDLE_INVALID; }
53 zx_handle_t
handle()
const {
return handle_; }
56 if (!cached_koid_.has_value()) {
57 zx_info_handle_basic_t
info;
58 zx_status_t status = zx_object_get_info(
59 handle_, ZX_INFO_HANDLE_BASIC, &
info,
sizeof(
info),
nullptr,
nullptr);
60 cached_koid_ = std::optional<zx_koid_t>(
61 status == ZX_OK ?
info.koid : ZX_KOID_INVALID);
63 return cached_koid_.value();
80 void RetainDartWrappableReference()
const override {
AddRef(); }
82 void ReleaseDartWrappableReference()
const override {
Release(); }
86 std::vector<HandleWaiter*> waiters_;
91 mutable std::optional<zx_koid_t> cached_koid_;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Dart_Handle Duplicate(uint32_t rights)
static Dart_Handle CreateInvalid()
void ReleaseWaiter(HandleWaiter *waiter)
static fml::RefPtr< Handle > Unwrap(Dart_Handle handle)
static fml::RefPtr< Handle > Create(zx_handle_t handle)
zx_handle_t ReleaseHandle()
static fml::RefPtr< Handle > Create(zx::handle handle)
zx_handle_t handle() const
fml::RefPtr< HandleWaiter > AsyncWait(zx_signals_t signals, Dart_Handle callback)
static void RegisterNatives(tonic::DartLibraryNatives *natives)
Dart_Handle Replace(uint32_t rights)
struct _Dart_Handle * Dart_Handle
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static guint signals[kSignalLastSignal]