Skia
2DGraphicsLibrary
|
This class is intended only for internal use in core Gr code. More...
#include <GrGpuResourceRef.h>
Public Member Functions | |
GrGpuResource * | getResource () const |
bool | ownsPendingIO () const |
Does this object own a pending read or write on the resource it is wrapping. More... | |
void | reset () |
Shortcut for calling setResource() with NULL. More... | |
Protected Member Functions | |
GrGpuResourceRef (GrGpuResource *, GrIOType) | |
Adopts a ref from the caller. More... | |
void | setResource (GrGpuResource *, GrIOType) |
Adopts a ref from the caller. More... | |
Private Types | |
typedef SkNoncopyable | INHERITED |
Private Member Functions | |
void | markPendingIO () const |
Called by owning GrProgramElement when the program element is first scheduled for execution. More... | |
void | removeRef () const |
Called when the program element/draw state is no longer owned by GrDrawTarget-client code. More... | |
void | pendingIOComplete () const |
Called to indicate that the previous pending IO is complete. More... | |
Private Attributes | |
GrGpuResource * | fResource |
bool | fOwnRef |
bool | fPendingIO |
GrIOType | fIOType |
Friends | |
class | GrProgramElement |
This class is intended only for internal use in core Gr code.
Class that wraps a resource referenced by a GrProgramElement or GrDrawState. It manages converting refs to pending IO operations. It allows a resource ownership to be in three states:
It is legal to destroy the GrGpuResourceRef in any of these states. It starts in state
Like SkAutoTUnref, its constructor and setter adopt a ref from their caller.
TODO: Once GrDODrawState no longer exists and therefore GrDrawState and GrOptDrawState no longer share an instance of this class, attempt to make the resource owned by GrGpuResourceRef only settable via the constructor.
|
protected |
Adopts a ref from the caller.
ioType expresses what type of IO operations will be marked as pending on the resource when markPendingIO is called.
|
private |
Called by owning GrProgramElement when the program element is first scheduled for execution.
It can only be called once.
|
inline |
Does this object own a pending read or write on the resource it is wrapping.
|
private |
Called to indicate that the previous pending IO is complete.
Useful when the owning object still has refs, so it is not about to destroy this GrGpuResourceRef, but its previously pending executions have been complete. Can only be called if removeRef() was not previously called.
|
private |
Called when the program element/draw state is no longer owned by GrDrawTarget-client code.
This lets the cache know that the drawing code will no longer schedule additional reads or writes to the resource using the program element or draw state. It can only be called once.
void GrGpuResourceRef::reset | ( | ) |
Shortcut for calling setResource() with NULL.
It cannot be called after markingPendingIO is called.
|
protected |
Adopts a ref from the caller.
ioType expresses what type of IO operations will be marked as pending on the resource when markPendingIO is called.