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

Unified Diff: src/core/SkImageCacherator.h

Issue 1352883004: Purge cached resources on SkImage destruction. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 3 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 | « src/core/SkBitmapProvider.cpp ('k') | src/core/SkImageCacherator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageCacherator.h
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index dc6b0f2c1a0cfcadc867124a7253e8e5510f29af..6812c72fccb092b1b0172d6f251f37cbc0bb0d19 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -14,6 +14,7 @@
class GrContext;
class SkBitmap;
+class SkImage;
/*
* Internal class to manage caching the output of an ImageGenerator.
@@ -29,16 +30,22 @@ public:
/**
* On success (true), bitmap will point to the pixels for this generator. If this returns
* false, the bitmap will be reset to empty.
+ *
+ * If not NULL, the client will be notified (->notifyAddedToCache()) when resources are
+ * added to the cache on its behalf.
*/
- bool lockAsBitmap(SkBitmap*);
+ bool lockAsBitmap(SkBitmap*, const SkImage* client);
/**
* Returns a ref() on the texture produced by this generator. The caller must call unref()
* when it is done. Will return nullptr on failure.
*
+ * If not NULL, the client will be notified (->notifyAddedToCache()) when resources are
+ * added to the cache on its behalf.
+ *
* The caller is responsible for calling texture->unref() when they are done.
*/
- GrTexture* lockAsTexture(GrContext*, SkImageUsageType);
+ GrTexture* lockAsTexture(GrContext*, SkImageUsageType, const SkImage* client);
/**
* If the underlying src naturally is represented by an encoded blob (in SkData), this returns
@@ -50,7 +57,7 @@ private:
SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, uint32_t uniqueID);
bool generateBitmap(SkBitmap*);
- bool tryLockAsBitmap(SkBitmap*);
+ bool tryLockAsBitmap(SkBitmap*, const SkImage*);
class ScopedGenerator {
SkImageCacherator* fCacher;
« no previous file with comments | « src/core/SkBitmapProvider.cpp ('k') | src/core/SkImageCacherator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698