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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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') | src/gpu/GrTextContext.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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 void setBudget(size_t budget) { 107 void setBudget(size_t budget) {
108 fBudget = budget; 108 fBudget = budget;
109 this->checkPurge(); 109 this->checkPurge();
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 = nullptr) {
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 = NULL; 120 GrAtlasTextBlob* lruBlob = nullptr;
121 while (fPool.size() > fBudget && (lruBlob = iter.get()) && lruBlob ! = blob) { 121 while (fPool.size() > fBudget && (lruBlob = iter.get()) && lruBlob ! = blob) {
122 fCache.remove(lruBlob->fKey); 122 fCache.remove(lruBlob->fKey);
123 123
124 // Backup the iterator before removing and unrefing the blob 124 // Backup the iterator before removing and unrefing the blob
125 iter.prev(); 125 iter.prev();
126 fBlobList.remove(lruBlob); 126 fBlobList.remove(lruBlob);
127 lruBlob->unref(); 127 lruBlob->unref();
128 } 128 }
129 129
130 // 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
149 static const int kDefaultBudget = 1 << 22; 149 static const int kDefaultBudget = 1 << 22;
150 BitmapBlobList fBlobList; 150 BitmapBlobList fBlobList;
151 SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key> fCache; 151 SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key> fCache;
152 GrMemoryPool fPool; 152 GrMemoryPool fPool;
153 PFOverBudgetCB fCallback; 153 PFOverBudgetCB fCallback;
154 void* fData; 154 void* fData;
155 size_t fBudget; 155 size_t fBudget;
156 }; 156 };
157 157
158 #endif 158 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/GrTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698