Lines Matching refs:rec
68 static const SkResourceCache::Key& GetKey(const SkResourceCache::Rec* rec) { in GetKey()
69 return rec->getKey(); in GetKey()
104 Rec* rec = fHead; in ~SkResourceCache() local
105 while (rec) { in ~SkResourceCache()
106 Rec* next = rec->fNext; in ~SkResourceCache()
107 delete rec; in ~SkResourceCache()
108 rec = next; in ~SkResourceCache()
119 Rec* rec = *found; in find() local
120 if (visitor(*rec, context)) { in find()
121 this->moveToHead(rec); // for our LRU in find()
124 this->remove(rec); // stale in find()
143 void SkResourceCache::add(Rec* rec, void* payload) { in add() argument
146 SkASSERT(rec); in add()
148 if (Rec** preexisting = fHash->find(rec->getKey())) { in add()
156 delete rec; in add()
161 this->addToHead(rec); in add()
162 fHash->set(rec); in add()
163 rec->postAddInstall(payload); in add()
167 make_size_str(rec->bytesUsed(), &bytesStr); in add()
170 bytesStr.c_str(), rec, rec->getHash(), totalStr.c_str(), fCount); in add()
177 void SkResourceCache::remove(Rec* rec) { in remove() argument
178 SkASSERT(rec->canBePurged()); in remove()
179 size_t used = rec->bytesUsed(); in remove()
182 this->release(rec); in remove()
183 fHash->remove(rec->getKey()); in remove()
195 bytesStr.c_str(), rec, rec->getHash(), totalStr.c_str(), fCount); in remove()
198 delete rec; in remove()
213 Rec* rec = fTail; in purgeAsNeeded() local
214 while (rec) { in purgeAsNeeded()
219 Rec* prev = rec->fPrev; in purgeAsNeeded()
220 if (rec->canBePurged()) { in purgeAsNeeded()
221 this->remove(rec); in purgeAsNeeded()
223 rec = prev; in purgeAsNeeded()
245 Rec* rec = fTail; in purgeSharedID() local
246 while (rec) { in purgeSharedID()
247 Rec* prev = rec->fPrev; in purgeSharedID()
248 if (rec->getKey().getSharedID() == sharedID) { in purgeSharedID()
251 if (rec->canBePurged()) { in purgeSharedID()
252 this->remove(rec); in purgeSharedID()
258 rec = prev; in purgeSharedID()
274 Rec* rec = fTail; in visitAll() local
275 while (rec) { in visitAll()
276 visitor(*rec, context); in visitAll()
277 rec = rec->fPrev; in visitAll()
305 void SkResourceCache::release(Rec* rec) { in release() argument
306 Rec* prev = rec->fPrev; in release()
307 Rec* next = rec->fNext; in release()
310 SkASSERT(fHead == rec); in release()
322 rec->fNext = rec->fPrev = nullptr; in release()
325 void SkResourceCache::moveToHead(Rec* rec) { in moveToHead() argument
326 if (fHead == rec) { in moveToHead()
335 this->release(rec); in moveToHead()
337 fHead->fPrev = rec; in moveToHead()
338 rec->fNext = fHead; in moveToHead()
339 fHead = rec; in moveToHead()
344 void SkResourceCache::addToHead(Rec* rec) { in addToHead() argument
347 rec->fPrev = nullptr; in addToHead()
348 rec->fNext = fHead; in addToHead()
350 fHead->fPrev = rec; in addToHead()
352 fHead = rec; in addToHead()
354 fTail = rec; in addToHead()
356 fTotalBytesUsed += rec->bytesUsed(); in addToHead()
386 const Rec* rec = fHead; in validate() local
387 while (rec) { in validate()
389 used += rec->bytesUsed(); in validate()
391 rec = rec->fNext; in validate()
395 rec = fTail; in validate()
396 while (rec) { in validate()
399 SkASSERT(used >= rec->bytesUsed()); in validate()
400 used -= rec->bytesUsed(); in validate()
401 rec = rec->fPrev; in validate()
524 void SkResourceCache::Add(Rec* rec, void* payload) { in Add() argument
526 get_cache()->add(rec, payload); in Add()
572 static void dump_visitor(const SkResourceCache::Rec& rec, void*) { in dump_visitor() argument
574 rec.getCategory(), rec.bytesUsed(), rec.diagnostic_only_getDiscardable()); in dump_visitor()
581 static void sk_trace_dump_visitor(const SkResourceCache::Rec& rec, void* context) { in sk_trace_dump_visitor() argument
583 SkString dumpName = SkStringPrintf("skia/sk_resource_cache/%s_%p", rec.getCategory(), &rec); in sk_trace_dump_visitor()
584 SkDiscardableMemory* discardable = rec.diagnostic_only_getDiscardable(); in sk_trace_dump_visitor()
590 dump->dumpNumericValue(dumpName.c_str(), "discardable_size", "bytes", rec.bytesUsed()); in sk_trace_dump_visitor()
592 dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", rec.bytesUsed()); in sk_trace_dump_visitor()