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

Side by Side Diff: src/gpu/GrTextBlobCache.h

Issue 1300813007: wire up reduced atlas and zero textblob cache to test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | tests/TextBlobCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrTextBlobCache_DEFINED 8 #ifndef GrTextBlobCache_DEFINED
9 #define GrTextBlobCache_DEFINED 9 #define GrTextBlobCache_DEFINED
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 private: 112 private:
113 typedef SkTInternalLList<GrAtlasTextBlob> BitmapBlobList; 113 typedef SkTInternalLList<GrAtlasTextBlob> BitmapBlobList;
114 114
115 void checkPurge(GrAtlasTextBlob* blob = NULL) { 115 void checkPurge(GrAtlasTextBlob* blob = NULL) {
116 // If we are overbudget, then unref until we are below budget again 116 // If we are overbudget, then unref until we are below budget again
117 if (fPool.size() > fBudget) { 117 if (fPool.size() > fBudget) {
118 BitmapBlobList::Iter iter; 118 BitmapBlobList::Iter iter;
119 iter.init(fBlobList, BitmapBlobList::Iter::kTail_IterStart); 119 iter.init(fBlobList, BitmapBlobList::Iter::kTail_IterStart);
120 GrAtlasTextBlob* lruBlob = iter.get(); 120 GrAtlasTextBlob* lruBlob = NULL;
121 SkASSERT(lruBlob);
122 while (fPool.size() > fBudget && (lruBlob = iter.get()) && lruBlob ! = blob) { 121 while (fPool.size() > fBudget && (lruBlob = iter.get()) && lruBlob ! = blob) {
123 fCache.remove(lruBlob->fKey); 122 fCache.remove(lruBlob->fKey);
124 123
125 // Backup the iterator before removing and unrefing the blob 124 // Backup the iterator before removing and unrefing the blob
126 iter.prev(); 125 iter.prev();
127 fBlobList.remove(lruBlob); 126 fBlobList.remove(lruBlob);
128 lruBlob->unref(); 127 lruBlob->unref();
129 } 128 }
130 129
131 // If we break out of the loop with lruBlob == blob, then we haven't purged enough 130 // If we break out of the loop with lruBlob == blob, then we haven't purged enough
(...skipping 18 matching lines...) Expand all
150 static const int kDefaultBudget = 1 << 22; 149 static const int kDefaultBudget = 1 << 22;
151 BitmapBlobList fBlobList; 150 BitmapBlobList fBlobList;
152 SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key> fCache; 151 SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key> fCache;
153 GrMemoryPool fPool; 152 GrMemoryPool fPool;
154 PFOverBudgetCB fCallback; 153 PFOverBudgetCB fCallback;
155 void* fData; 154 void* fData;
156 size_t fBudget; 155 size_t fBudget;
157 }; 156 };
158 157
159 #endif 158 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | tests/TextBlobCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698