Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
tonic::DartWrappable Class Referenceabstract

#include <dart_wrappable.h>

Inheritance diagram for tonic::DartWrappable:
flutter::RefCountedDartWrappable< Canvas > flutter::RefCountedDartWrappable< CanvasImage > flutter::RefCountedDartWrappable< CanvasPath > flutter::RefCountedDartWrappable< CanvasPathMeasure > flutter::RefCountedDartWrappable< Codec > flutter::RefCountedDartWrappable< ColorFilter > flutter::RefCountedDartWrappable< EngineLayer > flutter::RefCountedDartWrappable< FlutterGpuTestClass > flutter::RefCountedDartWrappable< FragmentProgram > flutter::RefCountedDartWrappable< ImageDescriptor > flutter::RefCountedDartWrappable< ImageFilter > flutter::RefCountedDartWrappable< ImmutableBuffer > flutter::RefCountedDartWrappable< NativeStringAttribute > flutter::RefCountedDartWrappable< Paragraph > flutter::RefCountedDartWrappable< ParagraphBuilder > flutter::RefCountedDartWrappable< Picture > flutter::RefCountedDartWrappable< PictureRecorder > flutter::RefCountedDartWrappable< Scene > flutter::RefCountedDartWrappable< SceneBuilder > flutter::RefCountedDartWrappable< SceneNode > flutter::RefCountedDartWrappable< SemanticsUpdate > flutter::RefCountedDartWrappable< SemanticsUpdateBuilder > flutter::RefCountedDartWrappable< Shader > flutter::RefCountedDartWrappable< Vertices > flutter::RefCountedDartWrappable< CommandBuffer > flutter::RefCountedDartWrappable< Context > flutter::RefCountedDartWrappable< DeviceBuffer > flutter::RefCountedDartWrappable< HostBuffer > flutter::RefCountedDartWrappable< RenderPass > flutter::RefCountedDartWrappable< RenderPipeline > flutter::RefCountedDartWrappable< ShaderLibrary > flutter::RefCountedDartWrappable< Texture > flutter::RefCountedDartWrappable< MyNativeClass > flutter::RefCountedDartWrappable< T > zircon::dart::Handle zircon::dart::HandleDisposition zircon::dart::HandleWaiter zircon::dart::System

Public Types

enum  DartNativeFields { kPeerIndex , kNumberOfNativeFields }
 

Public Member Functions

 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
virtual void RetainDartWrappableReference () const =0
 
virtual void ReleaseDartWrappableReference () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Protected Member Functions

virtual ~DartWrappable ()
 

Static Protected Member Functions

static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 22 of file dart_wrappable.h.

Member Enumeration Documentation

◆ DartNativeFields

Enumerator
kPeerIndex 
kNumberOfNativeFields 

Definition at line 24 of file dart_wrappable.h.

24 {
25 kPeerIndex, // Must be first to work with Dart_GetNativeReceiver.
27 };

Constructor & Destructor Documentation

◆ DartWrappable()

tonic::DartWrappable::DartWrappable ( )
inline

Definition at line 29 of file dart_wrappable.h.

29: dart_wrapper_(DartWeakPersistentValue()) {}

◆ ~DartWrappable()

tonic::DartWrappable::~DartWrappable ( )
protectedvirtual

Definition at line 14 of file dart_wrappable.cc.

14 {
15 // Calls the destructor of dart_wrapper_ to delete WeakPersistentHandle.
16}

Member Function Documentation

◆ AssociateWithDartWrapper()

void tonic::DartWrappable::AssociateWithDartWrapper ( Dart_Handle  wrappable)

Definition at line 47 of file dart_wrappable.cc.

47 {
48 if (!dart_wrapper_.is_empty()) {
49 // Any previously given out wrapper must have been GCed.
50 TONIC_DCHECK(Dart_IsNull(dart_wrapper_.Get()));
51 dart_wrapper_.Clear();
52 }
53
55
57 wrapper, kPeerIndex, reinterpret_cast<intptr_t>(this))));
58
59 this->RetainDartWrappableReference(); // Balanced in FinalizeDartWrapper.
60
61 DartState* dart_state = DartState::Current();
62 dart_wrapper_.Set(dart_state, wrapper, this, sizeof(*this),
63 &FinalizeDartWrapper);
64}
static DartState * Current()
Definition dart_state.cc:56
void Set(DartState *dart_state, Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
virtual void RetainDartWrappableReference() const =0
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
bool CheckAndHandleError(Dart_Handle handle)
Definition dart_error.cc:33
#define TONIC_CHECK(condition)
Definition macros.h:23
#define TONIC_DCHECK
Definition macros.h:32

◆ ClearDartWrapper()

void tonic::DartWrappable::ClearDartWrapper ( )

Definition at line 66 of file dart_wrappable.cc.

66 {
67 TONIC_DCHECK(!dart_wrapper_.is_empty());
68 Dart_Handle wrapper = dart_wrapper_.Get();
71 dart_wrapper_.Clear();
73}
virtual void ReleaseDartWrappableReference() const =0
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258

◆ CreateDartWrapper()

Dart_Handle tonic::DartWrappable::CreateDartWrapper ( DartState dart_state)

Definition at line 19 of file dart_wrappable.cc.

19 {
20 if (!dart_wrapper_.is_empty()) {
21 // Any previously given out wrapper must have been GCed.
22 TONIC_DCHECK(Dart_IsNull(dart_wrapper_.Get()));
23 dart_wrapper_.Clear();
24 }
25
26 const DartWrapperInfo& info = GetDartWrapperInfo();
27
28 Dart_PersistentHandle type = dart_state->class_library().GetClass(info);
30
31 Dart_Handle wrapper =
32 Dart_New(type, dart_state->private_constructor_name(), 0, nullptr);
33
35
37 wrapper, kPeerIndex, reinterpret_cast<intptr_t>(this));
39
40 this->RetainDartWrappableReference(); // Balanced in FinalizeDartWrapper.
41 dart_wrapper_.Set(dart_state, wrapper, this, sizeof(*this),
42 &FinalizeDartWrapper);
43
44 return wrapper;
45}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
virtual const DartWrapperInfo & GetDartWrapperInfo() const =0
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
Dart_Handle Dart_PersistentHandle
Definition dart_api.h:259

◆ dart_wrapper()

Dart_WeakPersistentHandle tonic::DartWrappable::dart_wrapper ( ) const
inline

Definition at line 47 of file dart_wrappable.h.

47 {
48 return dart_wrapper_.value();
49 }
Dart_WeakPersistentHandle value() const

◆ GetDartWrapperInfo()

virtual const DartWrapperInfo & tonic::DartWrappable::GetDartWrapperInfo ( ) const
pure virtual

◆ GetTypeForWrapper()

Dart_PersistentHandle tonic::DartWrappable::GetTypeForWrapper ( tonic::DartState dart_state,
const tonic::DartWrapperInfo wrapper_info 
)
staticprotected

Definition at line 81 of file dart_wrappable.cc.

83 {
84 return dart_state->class_library().GetClass(wrapper_info);
85}
Dart_PersistentHandle GetClass(const DartWrapperInfo &info)
DartClassLibrary & class_library()
Definition dart_state.h:60

◆ ReleaseDartWrappableReference()

virtual void tonic::DartWrappable::ReleaseDartWrappableReference ( ) const
pure virtual

Implemented in flutter::RefCountedDartWrappable< T >, flutter::RefCountedDartWrappable< Canvas >, flutter::RefCountedDartWrappable< CanvasImage >, flutter::RefCountedDartWrappable< CanvasPath >, flutter::RefCountedDartWrappable< CanvasPathMeasure >, flutter::RefCountedDartWrappable< Codec >, flutter::RefCountedDartWrappable< ColorFilter >, flutter::RefCountedDartWrappable< CommandBuffer >, flutter::RefCountedDartWrappable< Context >, flutter::RefCountedDartWrappable< DeviceBuffer >, flutter::RefCountedDartWrappable< EngineLayer >, flutter::RefCountedDartWrappable< FlutterGpuTestClass >, flutter::RefCountedDartWrappable< FragmentProgram >, flutter::RefCountedDartWrappable< HostBuffer >, flutter::RefCountedDartWrappable< ImageDescriptor >, flutter::RefCountedDartWrappable< ImageFilter >, flutter::RefCountedDartWrappable< ImmutableBuffer >, flutter::RefCountedDartWrappable< MyNativeClass >, flutter::RefCountedDartWrappable< NativeStringAttribute >, flutter::RefCountedDartWrappable< Paragraph >, flutter::RefCountedDartWrappable< ParagraphBuilder >, flutter::RefCountedDartWrappable< Picture >, flutter::RefCountedDartWrappable< PictureRecorder >, flutter::RefCountedDartWrappable< RenderPass >, flutter::RefCountedDartWrappable< RenderPipeline >, flutter::RefCountedDartWrappable< Scene >, flutter::RefCountedDartWrappable< SceneBuilder >, flutter::RefCountedDartWrappable< SceneNode >, flutter::RefCountedDartWrappable< SemanticsUpdate >, flutter::RefCountedDartWrappable< SemanticsUpdateBuilder >, flutter::RefCountedDartWrappable< Shader >, flutter::RefCountedDartWrappable< ShaderLibrary >, flutter::RefCountedDartWrappable< Texture >, flutter::RefCountedDartWrappable< Vertices >, zircon::dart::Handle, zircon::dart::HandleDisposition, and zircon::dart::HandleWaiter.

◆ RetainDartWrappableReference()

virtual void tonic::DartWrappable::RetainDartWrappableReference ( ) const
pure virtual

Implemented in flutter::RefCountedDartWrappable< T >, flutter::RefCountedDartWrappable< Canvas >, flutter::RefCountedDartWrappable< CanvasImage >, flutter::RefCountedDartWrappable< CanvasPath >, flutter::RefCountedDartWrappable< CanvasPathMeasure >, flutter::RefCountedDartWrappable< Codec >, flutter::RefCountedDartWrappable< ColorFilter >, flutter::RefCountedDartWrappable< CommandBuffer >, flutter::RefCountedDartWrappable< Context >, flutter::RefCountedDartWrappable< DeviceBuffer >, flutter::RefCountedDartWrappable< EngineLayer >, flutter::RefCountedDartWrappable< FlutterGpuTestClass >, flutter::RefCountedDartWrappable< FragmentProgram >, flutter::RefCountedDartWrappable< HostBuffer >, flutter::RefCountedDartWrappable< ImageDescriptor >, flutter::RefCountedDartWrappable< ImageFilter >, flutter::RefCountedDartWrappable< ImmutableBuffer >, flutter::RefCountedDartWrappable< MyNativeClass >, flutter::RefCountedDartWrappable< NativeStringAttribute >, flutter::RefCountedDartWrappable< Paragraph >, flutter::RefCountedDartWrappable< ParagraphBuilder >, flutter::RefCountedDartWrappable< Picture >, flutter::RefCountedDartWrappable< PictureRecorder >, flutter::RefCountedDartWrappable< RenderPass >, flutter::RefCountedDartWrappable< RenderPipeline >, flutter::RefCountedDartWrappable< Scene >, flutter::RefCountedDartWrappable< SceneBuilder >, flutter::RefCountedDartWrappable< SceneNode >, flutter::RefCountedDartWrappable< SemanticsUpdate >, flutter::RefCountedDartWrappable< SemanticsUpdateBuilder >, flutter::RefCountedDartWrappable< Shader >, flutter::RefCountedDartWrappable< ShaderLibrary >, flutter::RefCountedDartWrappable< Texture >, flutter::RefCountedDartWrappable< Vertices >, zircon::dart::Handle, zircon::dart::HandleDisposition, and zircon::dart::HandleWaiter.


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