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

Unified Diff: src/gpu/GrTextStrike.cpp

Issue 43383006: Clean up the GrTHashTable API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: boo, default template arguments on a function are C++11... Created 7 years, 2 months 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
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | src/gpu/GrTextStrike_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextStrike.cpp
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index e21fd482757d6ae446eef1e3b767b0bff6e975c0..a96aab16c8f640f18905d82766590b9104c55563 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -90,6 +90,13 @@ void GrFontCache::freeAll() {
fTail = NULL;
}
+void GrFontCache::purgeStrike(GrTextStrike* strike) {
+ const GrFontCache::Key key(strike->fFontScalerKey);
+ fCache.remove(key, strike);
+ this->detachStrikeFromList(strike);
+ delete strike;
+}
+
void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) {
SkASSERT(NULL != preserveStrike);
GrTextStrike* strike = fTail;
@@ -105,11 +112,7 @@ void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) {
if (purge) {
// keep purging if we won't free up any atlases with this strike.
purge = strikeToPurge->fAtlas.isEmpty();
- int index = fCache.slowFindIndex(strikeToPurge);
- SkASSERT(index >= 0);
- fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash());
- this->detachStrikeFromList(strikeToPurge);
- delete strikeToPurge;
+ this->purgeStrike(strikeToPurge);
}
}
#if FONT_CACHE_STATS
@@ -130,11 +133,7 @@ void GrFontCache::freePlotExceptFor(GrTextStrike* preserveStrike) {
strike = strikeToPurge->fPrev;
if (strikeToPurge->removeUnusedPlots()) {
if (strikeToPurge->fAtlas.isEmpty()) {
- int index = fCache.slowFindIndex(strikeToPurge);
- SkASSERT(index >= 0);
- fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash());
- this->detachStrikeFromList(strikeToPurge);
- delete strikeToPurge;
+ this->purgeStrike(strikeToPurge);
}
break;
}
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | src/gpu/GrTextStrike_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698