WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
112374
[chromium] Scale up cache limit in ImageDecodingStore by device scale factor
https://bugs.webkit.org/show_bug.cgi?id=112374
Summary
[chromium] Scale up cache limit in ImageDecodingStore by device scale factor
Hin-Chung Lam
Reported
2013-03-14 11:52:43 PDT
This is a quick solution to solve the problem of cache exhaustion on hidpi devices. These devices are using an explicit up-sampling to provide better quality. Scaled up images are saved in memory and quickly exhaust the cache limit. Bump up the cache limit by device scale factory (or maybe sqaure of it) can help.
Attachments
Patch
(7.16 KB, patch)
2013-03-18 16:52 PDT
,
Hin-Chung Lam
no flags
Details
Formatted Diff
Diff
Patch
(6.57 KB, patch)
2013-03-18 17:13 PDT
,
Hin-Chung Lam
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Hin-Chung Lam
Comment 1
2013-03-18 16:52:01 PDT
Created
attachment 193692
[details]
Patch
Hin-Chung Lam
Comment 2
2013-03-18 16:52:44 PDT
The related bug in crbug.com is here:
https://code.google.com/p/chromium/issues/detail?id=189390
Please let me know if this is the right approach. Or we should have an additional WebKit API to do this.
James Robinson
Comment 3
2013-03-18 17:06:43 PDT
Comment on
attachment 193692
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=193692&action=review
Seems like a bit of a hack, but I don't have a better idea off the top of my head.
> Source/WebCore/platform/graphics/chromium/ImageDecodingStore.cpp:38 > +static const size_t cDefaultCacheLimitInBytes = 32768 * 1024;
we don't use prefixes like this in WebKit
Hin-Chung Lam
Comment 4
2013-03-18 17:13:23 PDT
I agree this is a hack. My plan to fix this is: 1. Find a better way to expose this and set it relative to device scale factor. 2. Better prioritization of decoding tasks in tiling so this hack might not be necessary.
Hin-Chung Lam
Comment 5
2013-03-18 17:13:47 PDT
Created
attachment 193699
[details]
Patch
Alexandre Elias
Comment 6
2013-03-18 17:21:02 PDT
I'm afraid this will cause OOMs on Android phones. Last I checked this cache value was sent down from the embedder, could you apply the multiplication in platform-specific code on the Chromium side?
Hin-Chung Lam
Comment 7
2013-03-18 17:24:10 PDT
I'll look to see if there's a better way.
Nat Duca
Comment 8
2013-03-18 18:07:08 PDT
Why would this oom android phones? They have deferreds, no, so this stuff isn't live?
Hin-Chung Lam
Comment 9
2013-03-18 18:07:59 PDT
If ashmem is exhausted then heap memory is used, not sure if this is the case on Android.
Alexandre Elias
Comment 10
2013-03-18 18:10:39 PDT
I'm not sure whether it's really a problem or not. Min, is it?
Min Qin
Comment 11
2013-03-18 19:55:07 PDT
Yes, heap memory will be used when we can no longer allocate any ashmem. Since there is a file descriptor limit of 128, we could hit that limit and start to allocate in heap. (In reply to
comment #10
)
> I'm not sure whether it's really a problem or not. Min, is it?
Nat Duca
Comment 12
2013-03-18 22:48:12 PDT
As an aside, then, can we maybe do a cleanup of the discardable logic in some way so its either discardable or nothing? Or something a little easier to reason about? I think its really hard to reason about the memory footprint of something that mixes discardables with mallocs depending on the number of outstanding fd's.
Min Qin
Comment 13
2013-03-19 09:57:05 PDT
There could be other reasons we don't favor discardable memory even it is enabled. For example, allocation size. If the allocation size is small, it is better to allocate in heap instead of discardable memory. Currently this is not enforced, but i am planning to add that in the future. (In reply to
comment #12
)
> As an aside, then, can we maybe do a cleanup of the discardable logic in some way so its either discardable or nothing? Or something a little easier to reason about? I think its really hard to reason about the memory footprint of something that mixes discardables with mallocs depending on the number of outstanding fd's.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug