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

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

Issue 916103006: Handle the case when the GrResourceCache timestamp wraps. (Closed) Base URL: https://skia.googlesource.com/skia.git@sharesb
Patch Set: fix warning Created 5 years, 10 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 | « no previous file | src/gpu/GrResourceCache.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef GrResourceCache_DEFINED 9 #ifndef GrResourceCache_DEFINED
10 #define GrResourceCache_DEFINED 10 #define GrResourceCache_DEFINED
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 */ 164 */
165 void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) { 165 void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) {
166 fOverBudgetCB = overBudgetCB; 166 fOverBudgetCB = overBudgetCB;
167 fOverBudgetData = data; 167 fOverBudgetData = data;
168 } 168 }
169 169
170 #if GR_GPU_STATS 170 #if GR_GPU_STATS
171 void dumpStats(SkString*) const; 171 void dumpStats(SkString*) const;
172 #endif 172 #endif
173 173
174 // This function is for unit testing and is only defined in test tools.
175 void changeTimestamp(uint32_t newTimestamp);
176
174 private: 177 private:
175 /////////////////////////////////////////////////////////////////////////// 178 ///////////////////////////////////////////////////////////////////////////
176 /// @name Methods accessible via ResourceAccess 179 /// @name Methods accessible via ResourceAccess
177 //// 180 ////
178 void insertResource(GrGpuResource*); 181 void insertResource(GrGpuResource*);
179 void removeResource(GrGpuResource*); 182 void removeResource(GrGpuResource*);
180 void notifyPurgeable(GrGpuResource*); 183 void notifyPurgeable(GrGpuResource*);
181 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize); 184 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize);
182 void changeUniqueKey(GrGpuResource*, const GrUniqueKey&); 185 void changeUniqueKey(GrGpuResource*, const GrUniqueKey&);
183 void removeUniqueKey(GrGpuResource*); 186 void removeUniqueKey(GrGpuResource*);
184 void willRemoveScratchKey(const GrGpuResource*); 187 void willRemoveScratchKey(const GrGpuResource*);
185 void didChangeBudgetStatus(GrGpuResource*); 188 void didChangeBudgetStatus(GrGpuResource*);
186 void refAndMakeResourceMRU(GrGpuResource*); 189 void refAndMakeResourceMRU(GrGpuResource*);
187 /// @} 190 /// @}
188 191
189 void internalPurgeAsNeeded(); 192 void internalPurgeAsNeeded();
190 void processInvalidUniqueKeys(const SkTArray<GrUniqueKeyInvalidatedMessage>& ); 193 void processInvalidUniqueKeys(const SkTArray<GrUniqueKeyInvalidatedMessage>& );
191 void addToNonpurgeableArray(GrGpuResource*); 194 void addToNonpurgeableArray(GrGpuResource*);
192 void removeFromNonpurgeableArray(GrGpuResource*); 195 void removeFromNonpurgeableArray(GrGpuResource*);
193 bool overBudget() const { return fBudgetedBytes > fMaxBytes || fBudgetedCoun t > fMaxCount; } 196 bool overBudget() const { return fBudgetedBytes > fMaxBytes || fBudgetedCoun t > fMaxCount; }
194 197
198 uint32_t getNextTimestamp();
199
195 #ifdef SK_DEBUG 200 #ifdef SK_DEBUG
196 bool isInCache(const GrGpuResource* r) const; 201 bool isInCache(const GrGpuResource* r) const;
197 void validate() const; 202 void validate() const;
198 #else 203 #else
199 void validate() const {} 204 void validate() const {}
200 #endif 205 #endif
201 206
202 class AutoValidate; 207 class AutoValidate;
203 208
204 class AvailableForScratchUse; 209 class AvailableForScratchUse;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 333
329 friend class GrGpuResource; // To access all the proxy inline methods. 334 friend class GrGpuResource; // To access all the proxy inline methods.
330 friend class GrResourceCache; // To create this type. 335 friend class GrResourceCache; // To create this type.
331 }; 336 };
332 337
333 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { 338 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() {
334 return ResourceAccess(this); 339 return ResourceAccess(this);
335 } 340 }
336 341
337 #endif 342 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698