#include <ResourceCache.h>
Definition at line 41 of file ResourceCache.h.
◆ ~ResourceCache()
skgpu::graphite::ResourceCache::~ResourceCache |
( |
| ) |
|
|
override |
◆ ResourceCache() [1/2]
skgpu::graphite::ResourceCache::ResourceCache |
( |
const ResourceCache & |
| ) |
|
|
delete |
◆ ResourceCache() [2/2]
skgpu::graphite::ResourceCache::ResourceCache |
( |
ResourceCache && |
| ) |
|
|
delete |
◆ currentBudgetedBytes()
size_t skgpu::graphite::ResourceCache::currentBudgetedBytes |
( |
| ) |
const |
|
inline |
◆ dumpMemoryStatistics()
void skgpu::graphite::ResourceCache::dumpMemoryStatistics |
( |
SkTraceMemoryDump * |
traceMemoryDump | ) |
const |
Definition at line 558 of file ResourceCache.cpp.
558 {
559 for (
int i = 0;
i < fNonpurgeableResources.
size(); ++
i) {
560 fNonpurgeableResources[
i]->dumpMemoryStatistics(traceMemoryDump);
561 }
562 for (
int i = 0;
i < fPurgeableQueue.
count(); ++
i) {
563 fPurgeableQueue.
at(
i)->dumpMemoryStatistics(traceMemoryDump);
564 }
565}
◆ findAndRefResource()
Definition at line 126 of file ResourceCache.cpp.
127 {
129
131
134
135
136
137 if (this->processReturnedResources()) {
139 }
140 }
142
145
146
150 fBudgetedBytes -=
resource->gpuMemorySize();
151 }
152 SkDEBUGCODE(
resource->fNonShareableInCache =
false;)
153 } else {
154
156 }
157 this->refAndMakeResourceMRU(
resource);
158 this->validate();
159 }
160
161
162
163
164
165
166
167
168
169
170
171 this->purgeAsNeeded();
172
174}
#define ASSERT_SINGLE_OWNER
static SkString resource(SkPDFResourceType type, int index)
int find(const char substring[]) const
◆ getMaxBudget()
size_t skgpu::graphite::ResourceCache::getMaxBudget |
( |
| ) |
const |
|
inline |
◆ getResourceCount()
int skgpu::graphite::ResourceCache::getResourceCount |
( |
| ) |
const |
|
inline |
◆ insertResource()
void skgpu::graphite::ResourceCache::insertResource |
( |
Resource * |
resource | ) |
|
Definition at line 82 of file ResourceCache.cpp.
82 {
89
90
92
93
94
95
96
97
98
100 this->processReturnedResources();
101 }
102
105
106
107
108 this->setResourceTimestamp(
resource, this->getNextTimestamp());
110
111 this->addToNonpurgeableArray(
resource);
112
114
117 }
118
120 fBudgetedBytes +=
resource->gpuMemorySize();
121 }
122
123 this->purgeAsNeeded();
124}
sk_sp< T > sk_ref_sp(T *obj)
◆ Make()
Definition at line 26 of file ResourceCache.cpp.
28 {
30}
ResourceCache(const ResourceCache &)=delete
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ proxyCache()
ProxyCache * skgpu::graphite::ResourceCache::proxyCache |
( |
| ) |
|
|
inline |
◆ purgeResources()
void skgpu::graphite::ResourceCache::purgeResources |
( |
| ) |
|
◆ purgeResourcesNotUsedSince()
void skgpu::graphite::ResourceCache::purgeResourcesNotUsedSince |
( |
StdSteadyClock::time_point |
purgeTime | ) |
|
◆ returnResource()
Definition at line 191 of file ResourceCache.cpp.
191 {
192
195 if (fIsShutdown) {
196 return false;
197 }
198
200
201
202
203
204 if (
resource->shouldDeleteASAP() == Resource::DeleteASAP::kNo &&
208
210 return true;
211 }
212 }
213
214
215
216
217
218
219
220
221 if (*
resource->accessReturnIndex() >= 0) {
222
223
226 fReturnQueue[*
resource->accessReturnIndex()].second = removedRef;
227 }
228 return true;
229 }
230#ifdef SK_DEBUG
231 for (auto& nextResource : fReturnQueue) {
233 }
234#endif
235
236 fReturnQueue.push_back(std::make_pair(
resource, removedRef));
237 *
resource->accessReturnIndex() = fReturnQueue.
size() - 1;
239 return true;
240}
◆ shutdown()
void skgpu::graphite::ResourceCache::shutdown |
( |
| ) |
|
Definition at line 50 of file ResourceCache.cpp.
50 {
52
54
55 {
57 fIsShutdown = true;
58 }
59 if (fProxyCache) {
60 fProxyCache->purgeAll();
61 }
62
63 this->processReturnedResources();
64
65 while (fNonpurgeableResources.
size()) {
66 Resource* back = *(fNonpurgeableResources.
end() - 1);
68 this->removeFromNonpurgeableArray(back);
69 back->unrefCache();
70 }
71
72 while (fPurgeableQueue.
count()) {
73 Resource* top = fPurgeableQueue.
peek();
75 this->removeFromPurgeableQueue(top);
76 top->unrefCache();
77 }
78
80}
#define TRACE_EVENT_SCOPE_THREAD
#define TRACE_EVENT_INSTANT0(category_group, name)
The documentation for this class was generated from the following files: