diff options
author | xidachen <xidachen@chromium.org> | 2015-12-17 14:12:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-17 14:12:23 -0800 |
commit | f5d1f8dcc841516d7ea63c151b13059af40ca76d (patch) | |
tree | 362de1df4d47a53c5e3ae03d0351cbcdb3c23a18 /include/core | |
parent | e80eb928ba0248a5a5dea6e1f0005aa08ecf8740 (diff) |
Create a hash table from id<-->key in SkImageFilter::CacheImpl
There is memory leak in the SkImageFilter::Cache. There are two sources
of memory leak:
1. The cache filling up quickly.
2. A slow small leak that never stops.
This CL solves the first issue, which prevents the cache filling up quickly.
This CL creates a new hash table that index the
SkImageFilter::uniqueID to an array of keys, and with the existing
key<-->Value hash table, we can have SkImageFilters proactively
purge content derived cached content when destroyed.
BUG=489543
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1514893003
Review URL: https://codereview.chromium.org/1514893003
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImageFilter.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 865fcf8b97..6ece16c841 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -42,6 +42,7 @@ public: virtual bool get(const Key& key, SkBitmap* result, SkIPoint* offset) const = 0; virtual void set(const Key& key, const SkBitmap& result, const SkIPoint& offset) = 0; virtual void purge() {} + virtual void purgeByImageFilterId(uint32_t) {} }; enum SizeConstraint { |