| Index: src/gpu/GrLayerCache.h
|
| diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
|
| index 3d4c98a0d7034e84557a767c3e7b482c049fd4f0..0fdd6c97b60bea0e7c0f58f185488353a556ccfc 100644
|
| --- a/src/gpu/GrLayerCache.h
|
| +++ b/src/gpu/GrLayerCache.h
|
| @@ -16,9 +16,15 @@
|
| #include "GrRect.h"
|
| #include "SkChecksum.h"
|
| #include "SkTDynamicHash.h"
|
| +#include "SkMessageBus.h"
|
|
|
| class SkPicture;
|
|
|
| +// The layer cache listens for these messages to purge picture-related resources.
|
| +struct GrPictureDeletedMessage {
|
| + uint32_t pictureID;
|
| +};
|
| +
|
| // GrPictureInfo stores the atlas plots used by a single picture. A single
|
| // plot may be used to store layers from multiple pictures.
|
| struct GrPictureInfo {
|
| @@ -146,8 +152,11 @@ public:
|
| // Inform the cache that layer's cached image is not currently required
|
| void unlock(GrCachedLayer* layer);
|
|
|
| - // Remove all the layers (and unlock any resources) associated with 'picture'
|
| - void purge(const SkPicture* picture);
|
| + // Setup to be notified when 'picture' is deleted
|
| + void trackPicture(const SkPicture* picture);
|
| +
|
| + // Cleanup after any SkPicture deletions
|
| + void processDeletedPictures();
|
|
|
| SkDEBUGCODE(void validate() const;)
|
|
|
| @@ -167,11 +176,18 @@ private:
|
|
|
| SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key> fLayerHash;
|
|
|
| + SkMessageBus<GrPictureDeletedMessage>::Inbox fPictDeletionInbox;
|
| +
|
| + SkAutoTUnref<SkPicture::DeletionListener> fDeletionListener;
|
| +
|
| void initAtlas();
|
| GrCachedLayer* createLayer(const SkPicture* picture, int layerID);
|
|
|
| + // Remove all the layers (and unlock any resources) associated with 'pictureID'
|
| + void purge(uint32_t pictureID);
|
| +
|
| // for testing
|
| - friend class GetNumLayers;
|
| + friend class TestingAccess;
|
| int numLayers() const { return fLayerHash.count(); }
|
| };
|
|
|
|
|