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

Unified Diff: src/gpu/GrLayerCache.h

Issue 654463004: Fix bug in aggressive layer cache purging (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerCache.h
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index 632cd0054028547722a91c2caa35931e918abd5d..69b59cf747b948a795119aa10fc512426195c09a 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -30,16 +30,44 @@ struct GrPictureDeletedMessage {
// plot may be used to store layers from multiple pictures.
struct GrPictureInfo {
public:
+ static const int kNumPlots = 4;
+
// for SkTDynamicHash - just use the pictureID as the hash key
static const uint32_t& GetKey(const GrPictureInfo& pictInfo) { return pictInfo.fPictureID; }
static uint32_t Hash(const uint32_t& key) { return SkChecksum::Mix(key); }
// GrPictureInfo proper
- GrPictureInfo(uint32_t pictureID) : fPictureID(pictureID) { }
+ GrPictureInfo(uint32_t pictureID) : fPictureID(pictureID) {
+#if !GR_CACHE_HOISTED_LAYERS
+ memset(fPlotUses, 0, sizeof(fPlotUses));
+#endif
+ }
- const uint32_t fPictureID;
+#if !GR_CACHE_HOISTED_LAYERS
+ void incPlotUsage(int plotID) {
+ SkASSERT(plotID < kNumPlots);
+ fPlotUses[plotID]++;
+ }
+
+ void decPlotUsage(int plotID) {
+ SkASSERT(plotID < kNumPlots);
+ SkASSERT(fPlotUses[plotID] > 0);
+ fPlotUses[plotID]--;
+ }
+ int plotUsage(int plotID) const {
+ SkASSERT(plotID < kNumPlots);
+ return fPlotUses[plotID];
+ }
+#endif
+
+ const uint32_t fPictureID;
GrAtlas::ClientPlotUsage fPlotUsage;
+
+#if !GR_CACHE_HOISTED_LAYERS
+private:
+ int fPlotUses[kNumPlots];
+#endif
};
// GrCachedLayer encapsulates the caching information for a single saveLayer.
« 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