Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
GrNonAtomicRef< TSubclass > Class Template Reference

#include <GrNonAtomicRef.h>

Inheritance diagram for GrNonAtomicRef< TSubclass >:
SkNoncopyable

Public Member Functions

 GrNonAtomicRef ()
 
bool unique () const
 
int refCnt () const
 
void ref () const
 
void unref () const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Detailed Description

template<typename TSubclass>
class GrNonAtomicRef< TSubclass >

A simple non-atomic ref used in the GrBackendApi when we don't want to pay for the overhead of a threadsafe ref counted object

Definition at line 19 of file GrNonAtomicRef.h.

Constructor & Destructor Documentation

◆ GrNonAtomicRef()

template<typename TSubclass >
GrNonAtomicRef< TSubclass >::GrNonAtomicRef ( )
inline

Definition at line 21 of file GrNonAtomicRef.h.

21: fRefCnt(1) {}

Member Function Documentation

◆ ref()

template<typename TSubclass >
void GrNonAtomicRef< TSubclass >::ref ( ) const
inline

Definition at line 38 of file GrNonAtomicRef.h.

38 {
39 // Once the ref cnt reaches zero it should never be ref'ed again.
40 SkASSERT(fRefCnt > 0);
41 ++fRefCnt;
42 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ refCnt()

template<typename TSubclass >
int GrNonAtomicRef< TSubclass >::refCnt ( ) const
inline

Definition at line 36 of file GrNonAtomicRef.h.

36{ return fRefCnt; }

◆ unique()

template<typename TSubclass >
bool GrNonAtomicRef< TSubclass >::unique ( ) const
inline

Definition at line 32 of file GrNonAtomicRef.h.

32{ return 1 == fRefCnt; }

◆ unref()

template<typename TSubclass >
void GrNonAtomicRef< TSubclass >::unref ( ) const
inline

Definition at line 44 of file GrNonAtomicRef.h.

44 {
45 SkASSERT(fRefCnt > 0);
46 --fRefCnt;
47 if (0 == fRefCnt) {
48 GrTDeleteNonAtomicRef(static_cast<const TSubclass*>(this));
49 return;
50 }
51 }
void GrTDeleteNonAtomicRef(const T *ref)

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