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

Unified Diff: include/core/SkPixelRef.h

Issue 960563002: only notify bitmaps that have been added to the cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address reviewer comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmapCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPixelRef.h
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 5027a353294c3546599970ae67dd5ab745e90e27..01303e5be5f1d156f235c336a1348f976152257a 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -245,6 +245,12 @@ public:
// Takes ownership of listener.
void addGenIDChangeListener(GenIDChangeListener* listener);
+ // Call when this pixelref is part of the key to a resourcecache entry. This allows the cache
+ // to know automatically those entries can be purged when this pixelref is changed or deleted.
+ void notifyAddedToCache() {
+ fAddedToCache.store(true);
+ }
+
protected:
/**
* On success, returns true and fills out the LockRec for the pixels. On
@@ -315,6 +321,7 @@ private:
mutable SkAtomic<uint32_t> fGenerationID;
mutable SkAtomic<bool> fUniqueGenerationID;
+ SkAtomic<bool> fAddedToCache;
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
const uint32_t fStableID;
#endif
« no previous file with comments | « no previous file | src/core/SkBitmapCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698