diff options
author | danakj <danakj@chromium.org> | 2014-09-11 10:49:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-11 10:49:52 -0700 |
commit | 790ffe3feb90370318f42b28eb9c6af6e38cd4f9 (patch) | |
tree | 57b311f69b8ac26a87bcebf843bdac301cf5efb1 /src/core/SkResourceCache.h | |
parent | 33a30503d76fdd989358cedd78445ba96bb809dd (diff) |
Make SkBitmapCache remove invalid bitmaps from the SkResourceCache.
This adds SkResourceCache::Remove() which will remove a resource from
its cache. The resource is required to be unlocked at the time Remove()
is called.
Then SkBitmapCache::Find() makes use of this to Remove() bitmaps from
the cache whose pixels have been evicted. This allows the bitmap to be
re-added to the cache with pixels again.
After this change, background a tab (and discarding all the bitmaps'
contents) no longer disables image caching for those discarded images
once the tab is visible again.
BUG=skia:2926
NOTRY=true
R=reed@android.com, tomhudson@google.com, reed@google.com
Author: danakj@chromium.org
Review URL: https://codereview.chromium.org/561953002
Diffstat (limited to 'src/core/SkResourceCache.h')
-rw-r--r-- | src/core/SkResourceCache.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h index f2fd8fc047..93f2ca49e6 100644 --- a/src/core/SkResourceCache.h +++ b/src/core/SkResourceCache.h @@ -76,7 +76,6 @@ public: Rec* fNext; Rec* fPrev; int32_t fLockCount; - int32_t fPad; friend class SkResourceCache; }; @@ -98,6 +97,7 @@ public: static const Rec* AddAndLock(Rec*); static void Add(Rec*); static void Unlock(ID); + static void Remove(ID); static size_t GetTotalBytesUsed(); static size_t GetTotalByteLimit(); @@ -140,6 +140,7 @@ public: const Rec* findAndLock(const Key& key); const Rec* addAndLock(Rec*); void add(Rec*); + void remove(Rec*); /** * Given a non-null ID ptr returned by either findAndLock or addAndLock, @@ -189,7 +190,6 @@ private: size_t fSingleAllocationByteLimit; int fCount; - void purgeRec(Rec*); void purgeAsNeeded(); // linklist management |