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

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: Move MessageBus Inbox from GrContext to GrLayerCache 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..3b1ed9b7bb846b9eaaf7955271d9f5d0024f71d9 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -190,6 +190,14 @@ public:
bool suitableForGpuRasterization(GrContext*, const char ** = NULL) const;
#endif
+ struct DeletionListener {
bsalomon 2014/07/22 14:13:48 Should this be ref cnt'ed? would it be sensible to
robertphillips 2014/07/22 16:35:47 Done.
+ virtual ~DeletionListener() {}
+ virtual void onDeletion(uint32_t pictureID) = 0;
+ };
+
+ // Takes ownership of 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 owned
+
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