Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
skgpu::RefCntedCallback Class Reference

#include <RefCntedCallback.h>

Inheritance diagram for skgpu::RefCntedCallback:
SkNVRefCnt< RefCntedCallback >

Public Types

using Context = void *
 
using Callback = void(*)(Context)
 
using ResultCallback = void(*)(Context, CallbackResult)
 

Public Member Functions

 ~RefCntedCallback ()
 
Context context () const
 
void setFailureResult ()
 
- Public Member Functions inherited from SkNVRefCnt< RefCntedCallback >
 SkNVRefCnt ()
 
 ~SkNVRefCnt ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
void deref () const
 
bool refCntGreaterThan (int32_t threadIsolatedTestCnt) const
 

Static Public Member Functions

static sk_sp< RefCntedCallbackMake (Callback proc, Context ctx)
 
static sk_sp< RefCntedCallbackMake (ResultCallback proc, Context ctx)
 

Detailed Description

Ref-counted object that calls a callback from its destructor.

Definition at line 18 of file RefCntedCallback.h.

Member Typedef Documentation

◆ Callback

Definition at line 21 of file RefCntedCallback.h.

◆ Context

Definition at line 20 of file RefCntedCallback.h.

◆ ResultCallback

Definition at line 22 of file RefCntedCallback.h.

Constructor & Destructor Documentation

◆ ~RefCntedCallback()

skgpu::RefCntedCallback::~RefCntedCallback ( )
inline

Definition at line 38 of file RefCntedCallback.h.

38 {
39 if (fReleaseProc) {
40 SkASSERT(!fResultReleaseProc);
41 fReleaseProc(fReleaseCtx);
42 } else {
43 SkASSERT(fResultReleaseProc);
44 fResultReleaseProc(fReleaseCtx, fResult);
45 }
46 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

Member Function Documentation

◆ context()

Context skgpu::RefCntedCallback::context ( ) const
inline

Definition at line 48 of file RefCntedCallback.h.

48{ return fReleaseCtx; }

◆ Make() [1/2]

static sk_sp< RefCntedCallback > skgpu::RefCntedCallback::Make ( Callback  proc,
Context  ctx 
)
inlinestatic

Definition at line 24 of file RefCntedCallback.h.

24 {
25 if (!proc) {
26 return nullptr;
27 }
28 return sk_sp<RefCntedCallback>(new RefCntedCallback(proc, ctx));
29 }

◆ Make() [2/2]

static sk_sp< RefCntedCallback > skgpu::RefCntedCallback::Make ( ResultCallback  proc,
Context  ctx 
)
inlinestatic

Definition at line 31 of file RefCntedCallback.h.

31 {
32 if (!proc) {
33 return nullptr;
34 }
35 return sk_sp<RefCntedCallback>(new RefCntedCallback(proc, ctx));
36 }

◆ setFailureResult()

void skgpu::RefCntedCallback::setFailureResult ( )
inline

Definition at line 50 of file RefCntedCallback.h.

50 {
51 SkASSERT(fResultReleaseProc);
52 // Shouldn't really be calling this multiple times.
55 }

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