| Index: src/core/SkPicture.cpp
 | 
| diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
 | 
| index d57de97d78c5f67a3c3da1c9a0087b9497e7a052..0b7a1dbcc592702ec3cf9185f3bfcded0b32bf79 100644
 | 
| --- a/src/core/SkPicture.cpp
 | 
| +++ b/src/core/SkPicture.cpp
 | 
| @@ -144,7 +144,9 @@ static SkPicture* backport(const SkRecord& src, int width, int height) {
 | 
|  }
 | 
|  
 | 
|  // fRecord OK
 | 
| -SkPicture::~SkPicture() {}
 | 
| +SkPicture::~SkPicture() {
 | 
| +    this->callDeletionListeners();
 | 
| +}
 | 
|  
 | 
|  #ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE
 | 
|  // fRecord TODO, fix by deleting this method
 | 
| @@ -492,3 +494,21 @@ SkPicture::SkPicture(int width, int height, SkRecord* record)
 | 
|      , fRecordWillPlayBackBitmaps(SkRecordWillPlaybackBitmaps(*record)) {
 | 
|      this->needsNewGenID();
 | 
|  }
 | 
| +
 | 
| +// Note that we are assuming that this entry point will only be called from
 | 
| +// one thread. Currently the only client of this method is 
 | 
| +// SkGpuDevice::EXPERIMENTAL_optimize which should be only called from a single
 | 
| +// thread.
 | 
| +void SkPicture::addDeletionListener(DeletionListener* listener) const {
 | 
| +    SkASSERT(NULL != listener);
 | 
| +
 | 
| +    *fDeletionListeners.append() = SkRef(listener);
 | 
| +}
 | 
| +
 | 
| +void SkPicture::callDeletionListeners() {
 | 
| +    for (int i = 0; i < fDeletionListeners.count(); ++i) {
 | 
| +        fDeletionListeners[i]->onDeletion(this->uniqueID());
 | 
| +    }
 | 
| +
 | 
| +    fDeletionListeners.unrefAll();
 | 
| +}
 | 
| 
 |