Flutter Engine
zircon::dart::HandleWaiter Class Reference

#include <handle_waiter.h>

Inheritance diagram for zircon::dart::HandleWaiter:
fml::RefCountedThreadSafe< HandleWaiter > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

void Cancel ()
 
bool is_pending ()
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< HandleWaiter >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
virtual size_t GetAllocationSize () const
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static fml::RefPtr< HandleWaiterCreate (Handle *handle, zx_signals_t signals, Dart_Handle callback)
 
static void RegisterNatives (tonic::DartLibraryNatives *natives)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex,
  kWrapperInfoIndex,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< HandleWaiter >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 23 of file handle_waiter.h.

Member Function Documentation

◆ Cancel()

void zircon::dart::HandleWaiter::Cancel ( )

Definition at line 58 of file handle_waiter.cc.

References tonic::DartPersistentValue::dart_state(), FML_DCHECK, tonic::DartPersistentValue::is_empty(), tonic::LogIfError(), tonic::DartPersistentValue::Release(), zircon::dart::Handle::ReleaseWaiter(), and tonic::ToDart().

Referenced by Create().

58  {
59  FML_DCHECK(wait_.is_pending() == !!handle_);
60  if (handle_) {
61  // Cancel the wait.
62  wait_.Cancel();
63 
64  // Release this object from the handle and clear handle_.
65  handle_->ReleaseWaiter(this);
66  handle_ = nullptr;
67  }
68  FML_DCHECK(!wait_.is_pending());
69 }
void ReleaseWaiter(HandleWaiter *waiter)
Definition: handle.cc:97
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ Create()

fml::RefPtr< HandleWaiter > zircon::dart::HandleWaiter::Create ( Handle handle,
zx_signals_t  signals,
Dart_Handle  callback 
)
static

Definition at line 35 of file handle_waiter.cc.

References Cancel(), FML_CHECK, FML_DCHECK, zircon::dart::Handle::handle(), and zircon::dart::Handle::is_valid().

Referenced by zircon::dart::Handle::AsyncWait().

37  {
38  return fml::MakeRefCounted<HandleWaiter>(handle, signals, callback);
39 }

◆ is_pending()

bool zircon::dart::HandleWaiter::is_pending ( )
inline

Definition at line 36 of file handle_waiter.h.

36 { return wait_.is_pending(); }

◆ RegisterNatives()

void zircon::dart::HandleWaiter::RegisterNatives ( tonic::DartLibraryNatives natives)
static

Definition at line 31 of file handle_waiter.cc.

References DART_REGISTER_NATIVE, and FOR_EACH_BINDING.

31  {
33 }
#define FOR_EACH_BINDING(V)
void Register(std::initializer_list< Entry > entries)
#define DART_REGISTER_NATIVE(CLASS, METHOD)

The documentation for this class was generated from the following files: