Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DiscardableManager Class Reference
Inheritance diagram for DiscardableManager:
SkStrikeServer::DiscardableHandleManager SkStrikeClient::DiscardableHandleManager SkStrikeServer::DiscardableHandleManager SkStrikeClient::DiscardableHandleManager SkRefCnt SkRefCnt SkRefCntBase SkRefCntBase

Public Member Functions

 DiscardableManager ()
 
 ~DiscardableManager () override=default
 
SkDiscardableHandleId createHandle () override
 
bool lockHandle (SkDiscardableHandleId id) override
 
bool deleteHandle (SkDiscardableHandleId id) override
 
void notifyCacheMiss (SkStrikeClient::CacheMissType type, int fontSize) override
 
bool isHandleDeleted (SkDiscardableHandleId id) override
 
void unlockAll ()
 
void unlockAndDeleteAll ()
 
const THashSet< SkDiscardableHandleId > & lockedHandles () const
 
SkDiscardableHandleId handleCount ()
 
int cacheMissCount (uint32_t type)
 
bool hasCacheMiss () const
 
void resetCacheMissCounts ()
 
- Public Member Functions inherited from SkStrikeServer::DiscardableHandleManager
virtual SK_SPI ~DiscardableHandleManager ()=default
 
virtual SK_SPI SkDiscardableHandleId createHandle ()=0
 
virtual SK_SPI bool lockHandle (SkDiscardableHandleId)=0
 
virtual SK_SPI bool isHandleDeleted (SkDiscardableHandleId)=0
 
- Public Member Functions inherited from SkStrikeClient::DiscardableHandleManager
 ~DiscardableHandleManager () override=default
 
virtual bool deleteHandle (SkDiscardableHandleId)=0
 
virtual void assertHandleValid (SkDiscardableHandleId)
 
virtual void notifyCacheMiss (CacheMissType type, int fontSize)=0
 
virtual void notifyReadFailure (const ReadFailureData &data)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Detailed Description

Definition at line 70 of file SkRemoteGlyphCacheTest.cpp.

Constructor & Destructor Documentation

◆ DiscardableManager()

DiscardableManager::DiscardableManager ( )
inline

Definition at line 73 of file SkRemoteGlyphCacheTest.cpp.

73{ sk_bzero(&fCacheMissCount, sizeof(fCacheMissCount)); }
sk_bzero(glyphs, sizeof(glyphs))

◆ ~DiscardableManager()

DiscardableManager::~DiscardableManager ( )
overridedefault

Member Function Documentation

◆ cacheMissCount()

int DiscardableManager::cacheMissCount ( uint32_t  type)
inline

Definition at line 131 of file SkRemoteGlyphCacheTest.cpp.

131 {
132 SkAutoMutexExclusive l(fMutex);
133
134 return fCacheMissCount[type];
135 }
GLenum type

◆ createHandle()

SkDiscardableHandleId DiscardableManager::createHandle ( )
inlineoverridevirtual

Implements SkStrikeServer::DiscardableHandleManager.

Definition at line 77 of file SkRemoteGlyphCacheTest.cpp.

77 {
78 SkAutoMutexExclusive l(fMutex);
79
80 // Handles starts as locked.
81 fLockedHandles.add(++fNextHandleId);
82 return fNextHandleId;
83 }
void add(T item)
Definition: SkTHash.h:592

◆ deleteHandle()

bool DiscardableManager::deleteHandle ( SkDiscardableHandleId  id)
inlineoverridevirtual

Implements SkStrikeClient::DiscardableHandleManager.

Definition at line 93 of file SkRemoteGlyphCacheTest.cpp.

93 {
94 SkAutoMutexExclusive l(fMutex);
95
96 return id <= fLastDeletedHandleId;
97 }

◆ handleCount()

SkDiscardableHandleId DiscardableManager::handleCount ( )
inline

Definition at line 126 of file SkRemoteGlyphCacheTest.cpp.

126 {
127 SkAutoMutexExclusive l(fMutex);
128
129 return fNextHandleId;
130 }

◆ hasCacheMiss()

bool DiscardableManager::hasCacheMiss ( ) const
inline

Definition at line 136 of file SkRemoteGlyphCacheTest.cpp.

136 {
137 SkAutoMutexExclusive l(fMutex);
138
139 for (uint32_t i = 0; i <= SkStrikeClient::CacheMissType::kLast; ++i) {
140 if (fCacheMissCount[i] > 0) { return true; }
141 }
142 return false;
143 }

◆ isHandleDeleted()

bool DiscardableManager::isHandleDeleted ( SkDiscardableHandleId  id)
inlineoverridevirtual

Implements SkStrikeServer::DiscardableHandleManager.

Definition at line 104 of file SkRemoteGlyphCacheTest.cpp.

104 {
105 SkAutoMutexExclusive l(fMutex);
106
107 return id <= fLastDeletedHandleId;
108 }

◆ lockedHandles()

const THashSet< SkDiscardableHandleId > & DiscardableManager::lockedHandles ( ) const
inline

Definition at line 121 of file SkRemoteGlyphCacheTest.cpp.

121 {
122 SkAutoMutexExclusive l(fMutex);
123
124 return fLockedHandles;
125 }

◆ lockHandle()

bool DiscardableManager::lockHandle ( SkDiscardableHandleId  id)
inlineoverridevirtual

Implements SkStrikeServer::DiscardableHandleManager.

Definition at line 84 of file SkRemoteGlyphCacheTest.cpp.

84 {
85 SkAutoMutexExclusive l(fMutex);
86
87 if (id <= fLastDeletedHandleId) return false;
88 fLockedHandles.add(id);
89 return true;
90 }

◆ notifyCacheMiss()

void DiscardableManager::notifyCacheMiss ( SkStrikeClient::CacheMissType  type,
int  fontSize 
)
inlineoverridevirtual

Implements SkStrikeClient::DiscardableHandleManager.

Definition at line 99 of file SkRemoteGlyphCacheTest.cpp.

99 {
100 SkAutoMutexExclusive l(fMutex);
101
102 fCacheMissCount[type]++;
103 }

◆ resetCacheMissCounts()

void DiscardableManager::resetCacheMissCounts ( )
inline

Definition at line 144 of file SkRemoteGlyphCacheTest.cpp.

144 {
145 SkAutoMutexExclusive l(fMutex);
146 sk_bzero(&fCacheMissCount, sizeof(fCacheMissCount));
147 }

◆ unlockAll()

void DiscardableManager::unlockAll ( )
inline

Definition at line 110 of file SkRemoteGlyphCacheTest.cpp.

110 {
111 SkAutoMutexExclusive l(fMutex);
112
113 fLockedHandles.reset();
114 }

◆ unlockAndDeleteAll()

void DiscardableManager::unlockAndDeleteAll ( )
inline

Definition at line 115 of file SkRemoteGlyphCacheTest.cpp.

115 {
116 SkAutoMutexExclusive l(fMutex);
117
118 fLockedHandles.reset();
119 fLastDeletedHandleId = fNextHandleId;
120 }

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