Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1140)

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 91453002: Speed up GrResourceCache add and lookup by using TDynamicHash (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrResourceCache.cpp
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 5cf3f82c7d780d1acc5ee53ca20d9f6140b1a7b4..33e398e51939197bf0cdfd5bb6cf0abcc5e4ff46 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -78,7 +78,7 @@ GrResourceCache::~GrResourceCache() {
GrAutoResourceCacheValidate atcv(this);
// remove from our cache
- fCache.remove(entry->fKey, entry);
+ fCache.remove(entry);
// remove from our llist
this->internalDetach(entry);
@@ -209,9 +209,8 @@ void GrResourceCache::addResource(const GrResourceKey& key,
GrResourceEntry* entry = SkNEW_ARGS(GrResourceEntry, (key, resource));
resource->setCacheEntry(entry);
-
this->attachToHead(entry);
- fCache.insert(key, entry);
+ fCache.add(entry);
if (ownershipFlags & kHide_OwnershipFlag) {
this->makeExclusive(entry);
@@ -221,11 +220,10 @@ void GrResourceCache::addResource(const GrResourceKey& key,
void GrResourceCache::makeExclusive(GrResourceEntry* entry) {
GrAutoResourceCacheValidate atcv(this);
-
// When scratch textures are detached (to hide them from future finds) they
// still count against the resource budget
this->internalDetach(entry, kIgnore_BudgetBehavior);
- fCache.remove(entry->key(), entry);
+ fCache.remove(entry);
#ifdef SK_DEBUG
fExclusiveList.addToHead(entry);
@@ -257,7 +255,7 @@ void GrResourceCache::makeNonExclusive(GrResourceEntry* entry) {
// when they have been removed from the cache, re-adding them doesn't
// alter the budget information.
attachToHead(entry, kIgnore_BudgetBehavior);
- fCache.insert(entry->key(), entry);
+ fCache.add(entry);
} else {
this->removeInvalidResource(entry);
}
@@ -321,9 +319,8 @@ void GrResourceCache::purgeInvalidated() {
void GrResourceCache::deleteResource(GrResourceEntry* entry) {
SkASSERT(1 == entry->fResource->getRefCnt());
-
// remove from our cache
- fCache.remove(entry->key(), entry);
+ fCache.remove(entry);
// remove from our llist
this->internalDetach(entry);
@@ -428,9 +425,6 @@ void GrResourceCache::validate() const {
SkASSERT(fClientDetachedCount <= fEntryCount);
SkASSERT((fEntryCount - fClientDetachedCount) == fCache.count());
- fCache.validate();
-
-
EntryList::Iter iter;
// check that the exclusively held entries are okay

Powered by Google App Engine
This is Rietveld 408576698