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/SkPicture.h

Issue 408923002: Add auto purging for SkPicture-related Ganesh resources (esp. layers) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 6 years, 5 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 | « include/core/SkDevice.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPicture.h
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index db996e02e87fa4c29384e6ed0c1e27a7ba608753..21ebef32cd661c17c690a9dabe69b1107e03f052 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -190,6 +190,14 @@ public:
bool suitableForGpuRasterization(GrContext*, const char ** = NULL) const;
#endif
+ class DeletionListener : public SkRefCnt {
+ public:
+ virtual void onDeletion(uint32_t pictureID) = 0;
+ };
+
+ // Takes ref on listener.
+ void addDeletionListener(DeletionListener* listener) const;
+
private:
// V2 : adds SkPixelRef's generation ID.
// V3 : PictInfo tag at beginning, and EOF tag at the end
@@ -237,7 +245,10 @@ private:
int fWidth, fHeight;
mutable SkAutoTUnref<const AccelData> fAccelData;
+ mutable SkTDArray<DeletionListener*> fDeletionListeners; // pointers are refed
+
void needsNewGenID() { fUniqueID = SK_InvalidGenID; }
+ void callDeletionListeners();
// Create a new SkPicture from an existing SkPictureData. The new picture
// takes ownership of 'data'.
« no previous file with comments | « include/core/SkDevice.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698