[Webkit-unassigned] [Bug 106842] adding support for DiscardablePixelRef for caching lazily decoded images

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 17 21:56:57 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=106842





--- Comment #23 from Nat Duca <nduca at chromium.org>  2013-01-17 21:58:43 PST ---
This actually confused me for a while too. Let me attempt to explain as I got to understanding it.... maybe the way I understand this isn't how the patch panned out, but its what I have in my head:

1. WebCore paint inserts SkBitmaps(LazyPixelRef) into the deferred canvas
2. When we rasterize the canvas, we discover lazy pixel ref and go find its CacheEntries. Recall, there may be multiple, because each CacheEntry is for a different decode/resize scale.

Thus, you may have the following situation for a single bitmap inserted into the deferred canvas:

   foo.png <Lazy, raw size 512x512>
       CacheEntry:  foo.png <decoded to 128x128, then scaled to 100x100>
       CacheEntry:  foo.png <decoded to 512x512, not scaled>


The cache entry need to store each decoded bitmap data, plus its size/stride/blahblah. So, void* plus a bunch of fields... instead of duplicating those fields, we use a SkBitmap.

Since this cache entry bitmap is the one omnomnoming at memory, its the one we want to die a violent death under memory pressure. So, we replace the SkBitmap-backed-by-void* with a SkBitmap-backed-by-a-WebDiscardable. In an 2D api that used subclassing, the cache entry would have a SkDiscardableBitmap and it'd be easier to grok.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list