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

Issue 561953002: Make SkBitmapCache remove invalid bitmaps from the SkResourceCache. (Closed)

Created:
6 years, 3 months ago by danakj
Modified:
6 years, 3 months ago
Reviewers:
reed, tomhudson, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

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 Committed: https://skia.googlesource.com/skia/+/790ffe3feb90370318f42b28eb9c6af6e38cd4f9

Patch Set 1 #

Total comments: 5

Patch Set 2 : cache: remove-purgeRec #

Patch Set 3 : cache: doubleassert #

Patch Set 4 : cache: doubleassert #

Total comments: 2

Patch Set 5 : cache: nit #

Patch Set 6 : cache: addtestbehindif0 #

Patch Set 7 : cache: #

Unified diffs Side-by-side diffs Delta from patch set Stats (+79 lines, -22 lines) Patch
M gyp/common.gypi View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkBitmapCache.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M src/core/SkResourceCache.h View 1 2 3 4 5 6 4 chunks +2 lines, -2 lines 0 comments Download
M src/core/SkResourceCache.cpp View 1 2 3 4 3 chunks +41 lines, -18 lines 0 comments Download
M tests/SkResourceCacheTest.cpp View 1 2 3 4 5 2 chunks +33 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (8 generated)
danakj
6 years, 3 months ago (2014-09-10 22:20:32 UTC) #2
danakj
I found SkResouceCacheTest.cpp, and will try to figure out how to discard a bitmap's pixels ...
6 years, 3 months ago (2014-09-10 22:30:44 UTC) #3
tomhudson
Hmm, what's with all the purple trybots?
6 years, 3 months ago (2014-09-11 00:37:30 UTC) #4
reed1
good catch. https://codereview.chromium.org/561953002/diff/1/src/core/SkResourceCache.cpp File src/core/SkResourceCache.cpp (right): https://codereview.chromium.org/561953002/diff/1/src/core/SkResourceCache.cpp#newcode289 src/core/SkResourceCache.cpp:289: void SkResourceCache::remove(SkResourceCache::ID id) { I think we ...
6 years, 3 months ago (2014-09-11 13:40:31 UTC) #6
reed1
I realize this is a good fix as is, even though I would reorg parts ...
6 years, 3 months ago (2014-09-11 14:33:33 UTC) #7
danakj
https://codereview.chromium.org/561953002/diff/1/src/core/SkResourceCache.cpp File src/core/SkResourceCache.cpp (right): https://codereview.chromium.org/561953002/diff/1/src/core/SkResourceCache.cpp#newcode289 src/core/SkResourceCache.cpp:289: void SkResourceCache::remove(SkResourceCache::ID id) { On 2014/09/11 14:33:32, reed1 wrote: ...
6 years, 3 months ago (2014-09-11 14:42:30 UTC) #8
danakj
PTAL - renamed purgeRec() to remove() and moved the old contents of remove() into Remove()
6 years, 3 months ago (2014-09-11 15:00:07 UTC) #9
reed1
thanks, the new version is simpler / easier to read. I still want to think ...
6 years, 3 months ago (2014-09-11 15:11:17 UTC) #10
danakj
I also added a unit test, though it's behind #if 0 :( https://codereview.chromium.org/561953002/diff/60001/src/core/SkResourceCache.cpp File src/core/SkResourceCache.cpp ...
6 years, 3 months ago (2014-09-11 17:01:32 UTC) #11
danakj
If you're happy with this can you please commit for me? I'm not a committer. ...
6 years, 3 months ago (2014-09-11 17:03:53 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/561953002/100001
6 years, 3 months ago (2014-09-11 17:18:23 UTC) #14
danakj
Hm.. [17:20:14.097038] In file included from ../../src/core/SkResourceCache.cpp:9: [17:20:14.097193] ../../src/core/SkResourceCache.h:79:17: error: private field 'fPad' is not ...
6 years, 3 months ago (2014-09-11 17:23:32 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/561953002/120001
6 years, 3 months ago (2014-09-11 17:24:13 UTC) #17
danakj
On 2014/09/11 17:23:32, danakj wrote: > This variable appears unused before and after my change ...
6 years, 3 months ago (2014-09-11 17:24:37 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/561953002/120001
6 years, 3 months ago (2014-09-11 17:34:33 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: Test-Ubuntu13.10-GCE-NoGPU-x86_64-Debug-Trybot on tryserver.skia (http://108.170.220.120:10117/builders/Test-Ubuntu13.10-GCE-NoGPU-x86_64-Debug-Trybot/builds/645)
6 years, 3 months ago (2014-09-11 17:49:26 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/561953002/120001
6 years, 3 months ago (2014-09-11 17:49:44 UTC) #25
commit-bot: I haz the power
6 years, 3 months ago (2014-09-11 17:49:58 UTC) #26
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as 790ffe3feb90370318f42b28eb9c6af6e38cd4f9

Powered by Google App Engine
This is Rietveld 408576698