Flutter Engine
The Flutter Engine
|
#include <GrManagedResource.h>
Public Member Functions | |
GrManagedResource () | |
virtual | ~GrManagedResource () |
bool | unique () const |
void | ref () const |
void | unref () const |
Private Member Functions | |
virtual void | freeGPUData () const =0 |
GrManagedResource is the base class for GPU resources that may be shared by multiple objects, in particular objects that are tracked by a command buffer. When an existing owner wants to share a reference, it calls ref(). When an owner wants to release its reference, it calls unref(). When the shared object's reference count goes to zero as the result of an unref() call, its (virtual) destructor is called. It is an error for the destructor to be called explicitly (or via the object going out of scope on the stack or calling delete) if getRefCnt() > 1.
This is nearly identical to SkRefCntBase. The exceptions are that unref() takes a GrGpu, and any derived classes must implement freeGPUData().
Definition at line 39 of file GrManagedResource.h.
|
inline |
Default construct, initializing the reference count to 1.
Definition at line 80 of file GrManagedResource.h.
|
inlinevirtual |
Destruct, asserting that the reference count is 1.
Definition at line 89 of file GrManagedResource.h.
|
privatepure virtual |
Must be implemented by any subclasses. Deletes any GPU data associated with this resource
Implemented in GrD3DPipeline, GrMtlDepthStencil, GrMtlRenderPipeline, GrMtlSampler, and GrMtlEvent.
|
inline |
Increment the reference count. Must be balanced by a call to unref() or unrefAndFreeResources().
Definition at line 115 of file GrManagedResource.h.
|
inline |
May return true if the caller is the only owner. Ensures that all previous owner's actions are complete.
Definition at line 105 of file GrManagedResource.h.
|
inline |
Decrement the reference count. If the reference count is 1 before the decrement, then delete the object. Note that if this is the case, then the object needs to have been allocated via new, and not on the stack. Any GPU data associated with this resource will be freed before it's deleted.
Definition at line 126 of file GrManagedResource.h.