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

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

Issue 643673004: Revert of Fix bug in plot locking system (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/GrLayerCache.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 2014 Google Inc. 2 * Copyright 2014 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 GrLayerCache_DEFINED 8 #ifndef GrLayerCache_DEFINED
9 #define GrLayerCache_DEFINED 9 #define GrLayerCache_DEFINED
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key> fLayerHash; 225 SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key> fLayerHash;
226 226
227 SkMessageBus<GrPictureDeletedMessage>::Inbox fPictDeletionInbox; 227 SkMessageBus<GrPictureDeletedMessage>::Inbox fPictDeletionInbox;
228 228
229 SkAutoTUnref<SkPicture::DeletionListener> fDeletionListener; 229 SkAutoTUnref<SkPicture::DeletionListener> fDeletionListener;
230 230
231 // This implements a plot-centric locking mechanism (since the atlas 231 // This implements a plot-centric locking mechanism (since the atlas
232 // backing texture is always locked). Each layer that is locked (i.e., 232 // backing texture is always locked). Each layer that is locked (i.e.,
233 // needed for the current rendering) in a plot increments the plot lock 233 // needed for the current rendering) in a plot increments the plot lock
234 // count for that plot for each time it is used. Similarly, once a 234 // count for that plot. Similarly, once a rendering is complete all the
235 // rendering is complete all the layers used in it decrement the lock 235 // layers used in it decrement the lock count for the used plots.
236 // count for the used plots. Plots with a 0 lock count are open for 236 // Plots with a 0 lock count are open for recycling/purging.
237 // recycling/purging.
238 int fPlotLocks[kNumPlotsX * kNumPlotsY]; 237 int fPlotLocks[kNumPlotsX * kNumPlotsY];
239 238
240 void initAtlas(); 239 void initAtlas();
241 GrCachedLayer* createLayer(uint32_t pictureID, int start, int stop, 240 GrCachedLayer* createLayer(uint32_t pictureID, int start, int stop,
242 const SkMatrix& ctm, const SkPaint* paint); 241 const SkMatrix& ctm, const SkPaint* paint);
243 242
244 void purgeAll(); 243 void purgeAll();
245 244
246 // Remove all the layers (and unlock any resources) associated with 'picture ID' 245 // Remove all the layers (and unlock any resources) associated with 'picture ID'
247 void purge(uint32_t pictureID); 246 void purge(uint32_t pictureID);
248 247
249 static bool PlausiblyAtlasable(int width, int height) { 248 static bool PlausiblyAtlasable(int width, int height) {
250 return width <= kPlotWidth && height <= kPlotHeight; 249 return width <= kPlotWidth && height <= kPlotHeight;
251 } 250 }
252 251
253 void purgePlot(GrPlot* plot); 252 void purgePlot(GrPlot* plot);
254 253
255 // Try to find a purgeable plot and clear it out. Return true if a plot 254 // Try to find a purgeable plot and clear it out. Return true if a plot
256 // was purged; false otherwise. 255 // was purged; false otherwise.
257 bool purgePlot(); 256 bool purgePlot();
258 257
259 void incPlotLock(int plotIdx) { ++fPlotLocks[plotIdx]; }
260 void decPlotLock(int plotIdx) {
261 SkASSERT(fPlotLocks[plotIdx] > 0);
262 --fPlotLocks[plotIdx];
263 }
264
265 // for testing 258 // for testing
266 friend class TestingAccess; 259 friend class TestingAccess;
267 int numLayers() const { return fLayerHash.count(); } 260 int numLayers() const { return fLayerHash.count(); }
268 }; 261 };
269 262
270 #endif 263 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698