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'. |