Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | List of all members
SkCachedData Class Reference

#include <SkCachedData.h>

Inheritance diagram for SkCachedData:
SkNoncopyable SkMipmap

Classes

class  AutoMutexWritable
 

Public Member Functions

 SkCachedData (void *mallocData, size_t size)
 
 SkCachedData (size_t size, SkDiscardableMemory *)
 
virtual ~SkCachedData ()
 
size_t size () const
 
const void * data () const
 
void * writable_data ()
 
void ref () const
 
void unref () const
 
int testing_only_getRefCnt () const
 
bool testing_only_isLocked () const
 
bool testing_only_isInCache () const
 
SkDiscardableMemorydiagnostic_only_getDiscardable () const
 
void validate () const
 
void attachToCacheAndRef () const
 
void detachFromCacheAndUnref () const
 

Protected Member Functions

virtual void onDataChange (void *oldData, void *newData)
 

Detailed Description

Definition at line 19 of file SkCachedData.h.

Constructor & Destructor Documentation

◆ SkCachedData() [1/2]

SkCachedData::SkCachedData ( void *  mallocData,
size_t  size 
)

Definition at line 12 of file SkCachedData.cpp.

13 : fData(data)
14 , fSize(size)
15 , fRefCnt(1)
16 , fStorageType(kMalloc_StorageType)
17 , fInCache(false)
18 , fIsLocked(true)
19{
20 fStorage.fMalloc = data;
21}
size_t size() const
Definition: SkCachedData.h:25
const void * data() const
Definition: SkCachedData.h:26

◆ SkCachedData() [2/2]

SkCachedData::SkCachedData ( size_t  size,
SkDiscardableMemory dm 
)

Definition at line 23 of file SkCachedData.cpp.

24 : fData(dm->data())
25 , fSize(size)
26 , fRefCnt(1)
27 , fStorageType(kDiscardableMemory_StorageType)
28 , fInCache(false)
29 , fIsLocked(true)
30{
31 fStorage.fDM = dm;
32}
virtual void * data()=0

◆ ~SkCachedData()

SkCachedData::~SkCachedData ( )
virtual

Definition at line 34 of file SkCachedData.cpp.

34 {
35 switch (fStorageType) {
36 case kMalloc_StorageType:
37 sk_free(fStorage.fMalloc);
38 break;
39 case kDiscardableMemory_StorageType:
40 delete fStorage.fDM;
41 break;
42 }
43}
SK_API void sk_free(void *)

Member Function Documentation

◆ attachToCacheAndRef()

void SkCachedData::attachToCacheAndRef ( ) const
inline

Definition at line 106 of file SkCachedData.h.

106{ this->internalRef(true); }

◆ data()

const void * SkCachedData::data ( ) const
inline

Definition at line 26 of file SkCachedData.h.

26{ return fData; }

◆ detachFromCacheAndUnref()

void SkCachedData::detachFromCacheAndUnref ( ) const
inline

Definition at line 112 of file SkCachedData.h.

112{ this->internalUnref(true); }

◆ diagnostic_only_getDiscardable()

SkDiscardableMemory * SkCachedData::diagnostic_only_getDiscardable ( ) const
inline

Definition at line 37 of file SkCachedData.h.

37 {
38 return kDiscardableMemory_StorageType == fStorageType ? fStorage.fDM : nullptr;
39 }

◆ onDataChange()

virtual void SkCachedData::onDataChange ( void *  oldData,
void *  newData 
)
inlineprotectedvirtual

Reimplemented in SkMipmap.

Definition at line 43 of file SkCachedData.h.

43{}

◆ ref()

void SkCachedData::ref ( ) const
inline

Definition at line 30 of file SkCachedData.h.

30{ this->internalRef(false); }

◆ size()

size_t SkCachedData::size ( ) const
inline

Definition at line 25 of file SkCachedData.h.

25{ return fSize; }

◆ testing_only_getRefCnt()

int SkCachedData::testing_only_getRefCnt ( ) const
inline

Definition at line 33 of file SkCachedData.h.

33{ return fRefCnt; }

◆ testing_only_isInCache()

bool SkCachedData::testing_only_isInCache ( ) const
inline

Definition at line 35 of file SkCachedData.h.

35{ return fInCache; }

◆ testing_only_isLocked()

bool SkCachedData::testing_only_isLocked ( ) const
inline

Definition at line 34 of file SkCachedData.h.

34{ return fIsLocked; }

◆ unref()

void SkCachedData::unref ( ) const
inline

Definition at line 31 of file SkCachedData.h.

31{ this->internalUnref(false); }

◆ validate()

void SkCachedData::validate ( ) const
inline

Definition at line 87 of file SkCachedData.h.

87{}

◆ writable_data()

void * SkCachedData::writable_data ( )
inline

Definition at line 28 of file SkCachedData.h.

28{ return fData; }

Member Data Documentation

◆ fDM

SkDiscardableMemory* SkCachedData::fDM

Definition at line 54 of file SkCachedData.h.

◆ fMalloc

void* SkCachedData::fMalloc

Definition at line 55 of file SkCachedData.h.


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