Lines Matching full:cache
42 SkDebugf("Font Cache Hash success rate: %d%%\n",
465 SkGlyphCache* cache;
469 for (cache = globals.fHead; cache != NULL; cache = cache->fNext) {
470 if (proc(cache, context)) {
482 - call a fontscaler (which might call into the cache)
491 SkGlyphCache* cache;
499 cache = hash[index];
500 if (cache && *cache->fDesc == *desc) {
501 cache->detach(&globals.fHead);
506 for (cache = globals.fHead; cache != NULL; cache = cache->fNext) {
507 if (cache->fDesc->equals(*desc)) {
508 cache->detach(&globals.fHead);
514 side-effects like trying to access the cache/mutex (yikes!)
519 cache = SkNEW_ARGS(SkGlyphCache, (desc));
522 if (proc(cache, context)) { // stay detached
524 SkASSERT(globals.fTotalMemoryUsed >= cache->fMemoryUsed);
525 globals.fTotalMemoryUsed -= cache->fMemoryUsed;
532 cache->attachToHead(&globals.fHead);
534 hash[index] = cache;
537 AttachCache(cache);
539 cache = NULL;
541 return cache;
544 void SkGlyphCache::AttachCache(SkGlyphCache* cache) {
545 SkASSERT(cache);
546 SkASSERT(cache->fNext == NULL);
553 // if we have a fixed budget for our cache, do a purge here
555 cache->fMemoryUsed;
561 cache->attachToHead(&globals.fHead);
562 globals.fTotalMemoryUsed += cache->fMemoryUsed;
565 unsigned index = desc_to_hashindex(cache->fDesc);
566 SkASSERT(globals.fHash[index] != cache);
567 globals.fHash[index] = cache;
594 SkGlyphCache* SkGlyphCache::FindTail(SkGlyphCache* cache) {
595 if (cache) {
596 while (cache->fNext) {
597 cache = cache->fNext;
600 return cache;
635 SkGlyphCache* cache = FindTail(globals->fHead);
636 while (cache != NULL && bytesFreed < bytesNeeded) {
637 SkGlyphCache* prev = cache->fPrev;
638 bytesFreed += cache->fMemoryUsed;
641 unsigned index = desc_to_hashindex(cache->fDesc);
642 if (cache == globals->fHash[index]) {
647 cache->detach(&globals->fHead);
648 SkDELETE(cache);
649 cache = prev;
659 SkDebugf("purging %dK from font cache [%d entries]\n",