Lines Matching full:resource
55 SK_ABORT("Too many Resource Types"); in GenerateResourceType()
269 auto resource = fPurgeableQueue.at(i); in cacheInfoPurgeableQueue() local
271 if (std::strcmp(resource->getResourceType(), "VkImage") == 0) { in cacheInfoPurgeableQueue()
272 auto vkimage = static_cast<GrVkImage*>(resource); in cacheInfoPurgeableQueue()
278 auto resourceTag = resource->getResourceTag(); in cacheInfoPurgeableQueue()
280 …updatePurgeableWidMap(resource, purgNameInfoWid, purgSizeInfoWid, purgPidInfoWid, purgCountInfoWid… in cacheInfoPurgeableQueue()
282 updatePurgeableFidMap(resource, purgNameInfoFid, purgSizeInfoFid, purgCountInfoFid); in cacheInfoPurgeableQueue()
284 updatePurgeablePidMap(resource, purgNameInfoPid, purgSizeInfoPid, purgCountInfoPid); in cacheInfoPurgeableQueue()
288 purgSizeUnknown += resource->gpuMemorySize(); in cacheInfoPurgeableQueue()
328 auto resource = fNonpurgeableResources[i]; in cacheInfoNoPurgeableQueue() local
329 if (resource == nullptr) { in cacheInfoNoPurgeableQueue()
333 if (std::strcmp(resource->getResourceType(), "VkImage") == 0) { in cacheInfoNoPurgeableQueue()
334 auto vkimage = static_cast<GrVkImage*>(resource); in cacheInfoNoPurgeableQueue()
340 auto resourceTag = resource->getResourceTag(); in cacheInfoNoPurgeableQueue()
342 …updatePurgeableWidMap(resource, noPurgNameInfoWid, noPurgSizeInfoWid, noPurgPidInfoWid, noPurgCoun… in cacheInfoNoPurgeableQueue()
344 … updatePurgeableFidMap(resource, noPurgNameInfoFid, noPurgSizeInfoFid, noPurgCountInfoFid); in cacheInfoNoPurgeableQueue()
346 … updatePurgeablePidMap(resource, noPurgNameInfoPid, noPurgSizeInfoPid, noPurgCountInfoPid); in cacheInfoNoPurgeableQueue()
350 noPurgSizeUnknown += resource->gpuMemorySize(); in cacheInfoNoPurgeableQueue()
371 void GrResourceCache::updatePurgeableWidMap(GrGpuResource* resource, in updatePurgeableWidMap() argument
377 auto resourceTag = resource->getResourceTag(); in updatePurgeableWidMap()
380 sizeInfoWid[resourceTag.fWid] = it->second + resource->gpuMemorySize(); in updatePurgeableWidMap()
383 sizeInfoWid[resourceTag.fWid] = resource->gpuMemorySize(); in updatePurgeableWidMap()
390 void GrResourceCache::updatePurgeablePidMap(GrGpuResource* resource, in updatePurgeablePidMap() argument
395 auto resourceTag = resource->getResourceTag(); in updatePurgeablePidMap()
398 sizeInfoPid[resourceTag.fPid] = it->second + resource->gpuMemorySize(); in updatePurgeablePidMap()
401 sizeInfoPid[resourceTag.fPid] = resource->gpuMemorySize(); in updatePurgeablePidMap()
407 void GrResourceCache::updatePurgeableFidMap(GrGpuResource* resource, in updatePurgeableFidMap() argument
412 auto resourceTag = resource->getResourceTag(); in updatePurgeableFidMap()
415 sizeInfoFid[resourceTag.fFid] = it->second + resource->gpuMemorySize(); in updatePurgeableFidMap()
418 sizeInfoFid[resourceTag.fFid] = resource->gpuMemorySize(); in updatePurgeableFidMap()
483 void GrResourceCache::insertResource(GrGpuResource* resource) in insertResource() argument
486 SkASSERT(resource); in insertResource()
487 SkASSERT(!this->isInCache(resource)); in insertResource()
488 SkASSERT(!resource->wasDestroyed()); in insertResource()
489 SkASSERT(!resource->resourcePriv().isPurgeable()); in insertResource()
493 resource->cacheAccess().setTimestamp(this->getNextTimestamp()); in insertResource()
495 this->addToNonpurgeableArray(resource); in insertResource()
497 size_t size = resource->gpuMemorySize(); in insertResource()
502 auto pid = resource->getResourceTag().fPid; in insertResource()
503 if (pid && resource->isRealAlloc()) { in insertResource()
510 SkDebugf("OHOS resource overflow! pid[%{public}d], size[%{public}zu]", pid, pidSize); in insertResource()
512 … HITRACE_OHOS_NAME_FMT_ALWAYS("OHOS gpu resource overflow: pid(%u), size:(%u)", pid, pidSize); in insertResource()
521 if (GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType()) { in insertResource()
531 SkASSERT(!resource->cacheAccess().isUsableAsScratch()); in insertResource()
551 void GrResourceCache::removeResource(GrGpuResource* resource) { in removeResource() argument
554 SkASSERT(this->isInCache(resource)); in removeResource()
556 size_t size = resource->gpuMemorySize(); in removeResource()
557 if (resource->resourcePriv().isPurgeable()) { in removeResource()
558 fPurgeableQueue.remove(resource); in removeResource()
561 this->removeFromNonpurgeableArray(resource); in removeResource()
568 auto pid = resource->getResourceTag().fPid; in removeResource()
569 if (pid && resource->isRealAlloc()) { in removeResource()
578 if (GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType()) { in removeResource()
585 if (resource->cacheAccess().isUsableAsScratch()) { in removeResource()
586 fScratchMap.remove(resource->resourcePriv().getScratchKey(), resource); in removeResource()
588 if (resource->getUniqueKey().isValid()) { in removeResource()
589 fUniqueHash.remove(resource->getUniqueKey()); in removeResource()
673 GrGpuResource* resource = fNonpurgeableResources[i]; in releaseByTag() local
674 if (tag.filter(resource->getResourceTag())) { in releaseByTag()
675 recycleVector.emplace_back(resource); in releaseByTag()
676 if (resource->getUniqueKey().isValid()) { in releaseByTag()
677 fProxyProvider->processInvalidUniqueKey(resource->getUniqueKey(), nullptr, in releaseByTag()
684 GrGpuResource* resource = fPurgeableQueue.at(i); in releaseByTag() local
685 if (tag.filter(resource->getResourceTag())) { in releaseByTag()
686 recycleVector.emplace_back(resource); in releaseByTag()
687 if (resource->getUniqueKey().isValid()) { in releaseByTag()
688 fProxyProvider->processInvalidUniqueKey(resource->getUniqueKey(), nullptr, in releaseByTag()
694 for (auto resource : recycleVector) { in releaseByTag() local
695 SkASSERT(!resource->wasDestroyed()); in releaseByTag()
696 resource->cacheAccess().release(); in releaseByTag()
734 // OH ISSUE: set purgeable resource max count limit.
762 // OH ISSUE: change the fbyte when the resource tag changes.
781 void GrResourceCache::refResource(GrGpuResource* resource) { in refResource() argument
782 SkASSERT(resource); in refResource()
783 SkASSERT(resource->getContext()->priv().getResourceCache() == this); in refResource()
784 if (resource->cacheAccess().hasRef()) { in refResource()
785 resource->ref(); in refResource()
787 this->refAndMakeResourceMRU(resource); in refResource()
796 bool operator()(const GrGpuResource* resource) const { in operator ()()
798 // scratch resource. in operator ()()
806 GrGpuResource* resource = fScratchMap.find(scratchKey, AvailableForScratchUse()); in findAndRefScratchResource() local
807 if (resource) { in findAndRefScratchResource()
808 fScratchMap.remove(scratchKey, resource); in findAndRefScratchResource()
809 this->refAndMakeResourceMRU(resource); in findAndRefScratchResource()
812 return resource; in findAndRefScratchResource()
815 void GrResourceCache::willRemoveScratchKey(const GrGpuResource* resource) { in willRemoveScratchKey() argument
817 SkASSERT(resource->resourcePriv().getScratchKey().isValid()); in willRemoveScratchKey()
818 if (resource->cacheAccess().isUsableAsScratch()) { in willRemoveScratchKey()
819 fScratchMap.remove(resource->resourcePriv().getScratchKey(), resource); in willRemoveScratchKey()
823 void GrResourceCache::removeUniqueKey(GrGpuResource* resource) { in removeUniqueKey() argument
825 // Someone has a ref to this resource in order to have removed the key. When the ref count in removeUniqueKey()
827 if (resource->getUniqueKey().isValid()) { in removeUniqueKey()
828 SkASSERT(resource == fUniqueHash.find(resource->getUniqueKey())); in removeUniqueKey()
829 fUniqueHash.remove(resource->getUniqueKey()); in removeUniqueKey()
831 resource->cacheAccess().removeUniqueKey(); in removeUniqueKey()
832 if (resource->cacheAccess().isUsableAsScratch()) { in removeUniqueKey()
833 fScratchMap.insert(resource->resourcePriv().getScratchKey(), resource); in removeUniqueKey()
836 // Removing a unique key from a kUnbudgetedCacheable resource would make the resource in removeUniqueKey()
837 // require purging. However, the resource must be ref'ed to get here and therefore can't in removeUniqueKey()
839 SkASSERT(!resource->resourcePriv().isPurgeable()); in removeUniqueKey()
843 void GrResourceCache::changeUniqueKey(GrGpuResource* resource, const GrUniqueKey& newKey) { in changeUniqueKey() argument
845 SkASSERT(resource); in changeUniqueKey()
846 SkASSERT(this->isInCache(resource)); in changeUniqueKey()
848 // If another resource has the new key, remove its key then install the key on this resource. in changeUniqueKey()
851 // If the old resource using the key is purgeable and is unreachable, then remove it. in changeUniqueKey()
856 // removeUniqueKey expects an external owner of the resource. in changeUniqueKey()
862 // Remove the entry for this resource if it already has a unique key. in changeUniqueKey()
863 if (resource->getUniqueKey().isValid()) { in changeUniqueKey()
864 SkASSERT(resource == fUniqueHash.find(resource->getUniqueKey())); in changeUniqueKey()
865 fUniqueHash.remove(resource->getUniqueKey()); in changeUniqueKey()
866 SkASSERT(nullptr == fUniqueHash.find(resource->getUniqueKey())); in changeUniqueKey()
868 // 'resource' didn't have a valid unique key before so it is switching sides. Remove it in changeUniqueKey()
871 if (resource->cacheAccess().isUsableAsScratch()) { in changeUniqueKey()
872 fScratchMap.remove(resource->resourcePriv().getScratchKey(), resource); in changeUniqueKey()
876 resource->cacheAccess().setUniqueKey(newKey); in changeUniqueKey()
877 fUniqueHash.add(resource); in changeUniqueKey()
879 this->removeUniqueKey(resource); in changeUniqueKey()
885 void GrResourceCache::refAndMakeResourceMRU(GrGpuResource* resource) { in refAndMakeResourceMRU() argument
887 SkASSERT(resource); in refAndMakeResourceMRU()
888 SkASSERT(this->isInCache(resource)); in refAndMakeResourceMRU()
889 if (resource->resourcePriv().isPurgeable()) { in refAndMakeResourceMRU()
891 fPurgeableBytes -= resource->gpuMemorySize(); in refAndMakeResourceMRU()
892 fPurgeableQueue.remove(resource); in refAndMakeResourceMRU()
893 this->addToNonpurgeableArray(resource); in refAndMakeResourceMRU()
894 } else if (!resource->cacheAccess().hasRefOrCommandBufferUsage() && in refAndMakeResourceMRU()
895 resource->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted) { in refAndMakeResourceMRU()
899 resource->cacheAccess().ref(); in refAndMakeResourceMRU()
901 resource->cacheAccess().setTimestamp(this->getNextTimestamp()); in refAndMakeResourceMRU()
905 void GrResourceCache::notifyARefCntReachedZero(GrGpuResource* resource, in notifyARefCntReachedZero() argument
908 SkASSERT(resource); in notifyARefCntReachedZero()
909 SkASSERT(!resource->wasDestroyed()); in notifyARefCntReachedZero()
910 SkASSERT(this->isInCache(resource)); in notifyARefCntReachedZero()
911 // This resource should always be in the nonpurgeable array when this function is called. It in notifyARefCntReachedZero()
913 SkASSERT(fNonpurgeableResources[*resource->cacheAccess().accessCacheIndex()] == resource); in notifyARefCntReachedZero()
916 if (resource->cacheAccess().isUsableAsScratch()) { in notifyARefCntReachedZero()
917 fScratchMap.insert(resource->resourcePriv().getScratchKey(), resource); in notifyARefCntReachedZero()
921 if (resource->cacheAccess().hasRefOrCommandBufferUsage()) { in notifyARefCntReachedZero()
930 if (resource->resourcePriv().isPurgeable()) { in notifyARefCntReachedZero()
931 fNewlyPurgeableResourceForValidation = resource; in notifyARefCntReachedZero()
934 resource->cacheAccess().setTimestamp(this->getNextTimestamp()); in notifyARefCntReachedZero()
937 if (!resource->resourcePriv().isPurgeable() && in notifyARefCntReachedZero()
938 resource->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted) { in notifyARefCntReachedZero()
942 if (!resource->resourcePriv().isPurgeable()) { in notifyARefCntReachedZero()
947 this->removeFromNonpurgeableArray(resource); in notifyARefCntReachedZero()
948 fPurgeableQueue.insert(resource); in notifyARefCntReachedZero()
949 resource->cacheAccess().setTimeWhenResourceBecomePurgeable(); in notifyARefCntReachedZero()
950 fPurgeableBytes += resource->gpuMemorySize(); in notifyARefCntReachedZero()
952 bool hasUniqueKey = resource->getUniqueKey().isValid(); in notifyARefCntReachedZero()
954 GrBudgetedType budgetedType = resource->resourcePriv().budgetedType(); in notifyARefCntReachedZero()
957 // Purge the resource immediately if we're over budget in notifyARefCntReachedZero()
958 // Also purge if the resource has neither a valid scratch key nor a unique key. in notifyARefCntReachedZero()
959 bool hasKey = resource->resourcePriv().getScratchKey().isValid() || hasUniqueKey; in notifyARefCntReachedZero()
969 // Check whether this resource could still be used as a scratch resource. in notifyARefCntReachedZero()
970 if (!resource->resourcePriv().refsWrappedObjects() && in notifyARefCntReachedZero()
971 resource->resourcePriv().getScratchKey().isValid()) { in notifyARefCntReachedZero()
972 // We won't purge an existing resource to make room for this one. in notifyARefCntReachedZero()
973 if (this->wouldFit(resource->gpuMemorySize())) { in notifyARefCntReachedZero()
974 resource->resourcePriv().makeBudgeted(); in notifyARefCntReachedZero()
981 resource->cacheAccess().release(); in notifyARefCntReachedZero()
982 // We should at least free this resource, perhaps dependent resources as well. in notifyARefCntReachedZero()
987 void GrResourceCache::didChangeBudgetStatus(GrGpuResource* resource) { in didChangeBudgetStatus() argument
989 SkASSERT(resource); in didChangeBudgetStatus()
990 SkASSERT(this->isInCache(resource)); in didChangeBudgetStatus()
992 size_t size = resource->gpuMemorySize(); in didChangeBudgetStatus()
994 // resource become purgeable. However, we should never allow that transition. Wrapped in didChangeBudgetStatus()
997 SkDEBUGCODE(bool wasPurgeable = resource->resourcePriv().isPurgeable()); in didChangeBudgetStatus()
998 if (resource->resourcePriv().budgetedType() == GrBudgetedType::kBudgeted) { in didChangeBudgetStatus()
1005 if (!resource->resourcePriv().isPurgeable() && in didChangeBudgetStatus()
1006 !resource->cacheAccess().hasRefOrCommandBufferUsage()) { in didChangeBudgetStatus()
1009 if (resource->cacheAccess().isUsableAsScratch()) { in didChangeBudgetStatus()
1010 fScratchMap.insert(resource->resourcePriv().getScratchKey(), resource); in didChangeBudgetStatus()
1014 SkASSERT(resource->resourcePriv().budgetedType() != GrBudgetedType::kUnbudgetedCacheable); in didChangeBudgetStatus()
1016 GrPerfMonitorReporter::GetInstance().recordTextureCache(resource->getResourceTag().fName); in didChangeBudgetStatus()
1020 if (!resource->resourcePriv().isPurgeable() && in didChangeBudgetStatus()
1021 !resource->cacheAccess().hasRefOrCommandBufferUsage()) { in didChangeBudgetStatus()
1024 if (!resource->cacheAccess().hasRef() && !resource->getUniqueKey().isValid() && in didChangeBudgetStatus()
1025 resource->resourcePriv().getScratchKey().isValid()) { in didChangeBudgetStatus()
1026 fScratchMap.remove(resource->resourcePriv().getScratchKey(), resource); in didChangeBudgetStatus()
1029 SkASSERT(wasPurgeable == resource->resourcePriv().isPurgeable()); in didChangeBudgetStatus()
1092 GrGpuResource* resource = fPurgeableQueue.peek(); in purgeAsNeeded() local
1093 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeAsNeeded()
1094 resource->cacheAccess().release(); in purgeAsNeeded()
1103 GrGpuResource* resource = fPurgeableQueue.peek(); in purgeAsNeeded() local
1104 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeAsNeeded()
1105 resource->cacheAccess().release(); in purgeAsNeeded()
1129 GrGpuResource* resource = fPurgeableQueue.peek(); in purgeUnlockedResources() local
1131 resource->cacheAccess().timeWhenResourceBecamePurgeable(); in purgeUnlockedResources()
1135 // resource is made non-purgeable again. So, at this point all the remaining in purgeUnlockedResources()
1141 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeUnlockedResources()
1142 resource->cacheAccess().release(); in purgeUnlockedResources()
1161 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeUnlockedResources() local
1163 resource->cacheAccess().timeWhenResourceBecamePurgeable(); in purgeUnlockedResources()
1168 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeUnlockedResources()
1169 if (!resource->getUniqueKey().isValid()) { in purgeUnlockedResources()
1170 *scratchResources.append() = resource; in purgeUnlockedResources()
1199 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeUnlockAndSafeCacheGpuResources() local
1200 if (!resource) { in purgeUnlockAndSafeCacheGpuResources()
1203 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeUnlockAndSafeCacheGpuResources()
1204 if (!resource->getUniqueKey().isValid()) { in purgeUnlockAndSafeCacheGpuResources()
1205 *scratchResources.append() = resource; in purgeUnlockAndSafeCacheGpuResources()
1209 //Delete the scatch resource. This must be done as a separate pass in purgeUnlockAndSafeCacheGpuResources()
1234 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeCacheBetweenFrames() local
1235 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeCacheBetweenFrames()
1236 if (exitedPidSet.find(resource->getResourceTag().fPid) != exitedPidSet.end()) { in purgeCacheBetweenFrames()
1237 resource->cacheAccess().release(); in purgeCacheBetweenFrames()
1254 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeCacheBetweenFrames() local
1255 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeCacheBetweenFrames()
1256 if (protectedPidSet.find(resource->getResourceTag().fPid) == protectedPidSet.end() && in purgeCacheBetweenFrames()
1257 (!scratchResourcesOnly || !resource->getUniqueKey().isValid())) { in purgeCacheBetweenFrames()
1258 resource->cacheAccess().release(); in purgeCacheBetweenFrames()
1279 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeUnlockedResourcesByPid() local
1280 if (!resource) { in purgeUnlockedResourcesByPid()
1283 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeUnlockedResourcesByPid()
1284 if (exitedPidSet.count(resource->getResourceTag().fPid)) { in purgeUnlockedResourcesByPid()
1285 *exitPidResources.append() = resource; in purgeUnlockedResourcesByPid()
1286 } else if (!resource->getUniqueKey().isValid()) { in purgeUnlockedResourcesByPid()
1287 *scratchResources.append() = resource; in purgeUnlockedResourcesByPid()
1291 //Delete the exited pid and scatch resource. This must be done as a separate pass in purgeUnlockedResourcesByPid()
1317 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeUnlockedResourcesByTag() local
1318 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeUnlockedResourcesByTag()
1319 if (tag.filter(resource->getResourceTag()) && in purgeUnlockedResourcesByTag()
1320 (!scratchResourcesOnly || !resource->getUniqueKey().isValid())) { in purgeUnlockedResourcesByTag()
1321 *scratchResources.append() = resource; in purgeUnlockedResourcesByTag()
1325 //Delete the scatch resource. This must be done as a separate pass in purgeUnlockedResourcesByTag()
1347 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeToMakeHeadroom() local
1348 if (GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType()) { in purgeToMakeHeadroom()
1349 projectedBudget -= resource->gpuMemorySize(); in purgeToMakeHeadroom()
1367 for (GrGpuResource* resource : resources) { in purgeToMakeHeadroom()
1368 resource->cacheAccess().release(); in purgeToMakeHeadroom()
1386 GrGpuResource* resource = fPurgeableQueue.at(i); in purgeUnlockedResources() local
1387 SkASSERT(resource->resourcePriv().isPurgeable()); in purgeUnlockedResources()
1388 if (!resource->getUniqueKey().isValid()) { in purgeUnlockedResources()
1389 *scratchResources.append() = resource; in purgeUnlockedResources()
1390 scratchByteCount += resource->gpuMemorySize(); in purgeUnlockedResources()
1451 void GrResourceCache::addToNonpurgeableArray(GrGpuResource* resource) { in addToNonpurgeableArray() argument
1453 *fNonpurgeableResources.append() = resource; in addToNonpurgeableArray()
1454 *resource->cacheAccess().accessCacheIndex() = index; in addToNonpurgeableArray()
1457 void GrResourceCache::removeFromNonpurgeableArray(GrGpuResource* resource) { in removeFromNonpurgeableArray() argument
1458 int* index = resource->cacheAccess().accessCacheIndex(); in removeFromNonpurgeableArray()
1462 SkASSERT(fNonpurgeableResources[*index] == resource); in removeFromNonpurgeableArray()
1501 // Correct the index in the nonpurgeable array stored on the resource post-sort. in getNextTimestamp()
1538 GrGpuResource* resource = fPurgeableQueue.at(i); in dumpAllResource() local
1539 if (resource == nullptr) { in dumpAllResource()
1542 if (strcmp(resource->getResourceType(), "VkImage") != 0) { in dumpAllResource()
1545 dump << i << " " << resource->getResourceType() << " "; in dumpAllResource()
1546 resource->dumpVkImageInfo(dump); in dumpAllResource()
1550 GrGpuResource* resource = fNonpurgeableResources[i]; in dumpAllResource() local
1551 if (resource == nullptr) { in dumpAllResource()
1554 if (strcmp(resource->getResourceType(), "VkImage") != 0) { in dumpAllResource()
1557 dump << i << " " << resource->getResourceType() << " "; in dumpAllResource()
1558 resource->dumpVkImageInfo(dump); in dumpAllResource()
1576 auto resource = resources.getAt(i); in dumpMemoryStatistics() local
1577 if (!resource || resource->wasDestroyed()) { in dumpMemoryStatistics()
1580 resource->dumpMemoryStatistics(traceMemoryDump); in dumpMemoryStatistics()
1647 // Reduce the frequency of validations for large resource counts. in validate()
1671 void update(GrGpuResource* resource) { in validate()
1672 fBytes += resource->gpuMemorySize(); in validate()
1674 if (!resource->resourcePriv().isPurgeable()) { in validate()
1678 const GrScratchKey& scratchKey = resource->resourcePriv().getScratchKey(); in validate()
1679 const GrUniqueKey& uniqueKey = resource->getUniqueKey(); in validate()
1681 if (resource->cacheAccess().isUsableAsScratch()) { in validate()
1683 SkASSERT(GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType()); in validate()
1684 SkASSERT(!resource->cacheAccess().hasRef()); in validate()
1687 SkASSERT(!resource->resourcePriv().refsWrappedObjects()); in validate()
1689 SkASSERT(GrBudgetedType::kBudgeted != resource->resourcePriv().budgetedType() || in validate()
1690 uniqueKey.isValid() || resource->cacheAccess().hasRef()); in validate()
1691 SkASSERT(!resource->resourcePriv().refsWrappedObjects()); in validate()
1692 SkASSERT(!fScratchMap->has(resource, scratchKey)); in validate()
1696 SkASSERT(fUniqueHash->find(uniqueKey) == resource); in validate()
1697 SkASSERT(GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType() || in validate()
1698 resource->resourcePriv().refsWrappedObjects()); in validate()
1701 if (GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType()) { in validate()
1703 fBudgetedBytes += resource->gpuMemorySize(); in validate()
1710 fScratchMap.foreach([&](const GrGpuResource& resource) { in validate() argument
1711 SkASSERT(resource.cacheAccess().isUsableAsScratch()); in validate()
1767 bool GrResourceCache::isInCache(const GrGpuResource* resource) const { in isInCache()
1768 int index = *resource->cacheAccess().accessCacheIndex(); in isInCache()
1772 if (index < fPurgeableQueue.count() && fPurgeableQueue.at(index) == resource) { in isInCache()
1775 if (index < fNonpurgeableResources.count() && fNonpurgeableResources[index] == resource) { in isInCache()
1778 SkDEBUGFAIL("Resource index should be -1 or the resource should be in the cache."); in isInCache()
1788 fUniqueHash.foreach([&](const GrGpuResource& resource){ in countUniqueKeysWithTag() argument
1789 if (0 == strcmp(tag, resource.getUniqueKey().tag())) { in countUniqueKeysWithTag()