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

Issue 1800153003: Force image-decoding before resolving createImageBitmap promise (Closed)

Created:
4 years, 9 months ago by xidachen
Modified:
4 years, 9 months ago
Reviewers:
Justin Novosad
CC:
chromium-reviews, blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Force image-decoding before resolving createImageBitmap promise In the case of createImageBitmap(HTMLImageElement) without any cropRect and ImageBitmapOptions parameters, the promise seems to be resolved before image-decoding is done. This CL changes such that image-decoding is forced to happen before the promise is resolved. BUG=595090 Committed: https://crrev.com/1247e32994c8f828f3a22ce8dde5b4631d142763 Cr-Commit-Position: refs/heads/master@{#382662}

Patch Set 1 #

Total comments: 1

Patch Set 2 : read a 1*1 pixel subregion to be efficient #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -1 line) Patch
M third_party/WebKit/Source/core/frame/ImageBitmap.cpp View 1 1 chunk +8 lines, -1 line 0 comments Download

Messages

Total messages: 19 (5 generated)
xidachen
PTAL
4 years, 9 months ago (2016-03-15 20:24:53 UTC) #2
Justin Novosad
Could you add a simple benchmark that isolates the run time of calling drawImage with ...
4 years, 9 months ago (2016-03-17 21:27:21 UTC) #3
xidachen
On 2016/03/17 21:27:21, Justin Novosad wrote: > Could you add a simple benchmark that isolates ...
4 years, 9 months ago (2016-03-22 16:01:38 UTC) #4
Justin Novosad
On 2016/03/22 16:01:38, xidachen wrote: > On 2016/03/17 21:27:21, Justin Novosad wrote: > > Could ...
4 years, 9 months ago (2016-03-22 18:50:27 UTC) #5
Justin Novosad
Making a banchmark that correctly isolates the behaviour we're trying to measure is probably overkill ...
4 years, 9 months ago (2016-03-22 18:53:09 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1800153003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1800153003/20001
4 years, 9 months ago (2016-03-22 18:56:09 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 9 months ago (2016-03-22 20:12:15 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1800153003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1800153003/20001
4 years, 9 months ago (2016-03-22 20:13:03 UTC) #12
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 9 months ago (2016-03-22 20:22:09 UTC) #13
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/1247e32994c8f828f3a22ce8dde5b4631d142763 Cr-Commit-Position: refs/heads/master@{#382662}
4 years, 9 months ago (2016-03-22 20:24:47 UTC) #15
Justin Novosad
+scroggo Should have asked earlier, but do you know of a cleaner way of doing ...
4 years, 9 months ago (2016-03-22 20:35:46 UTC) #16
scroggo_chromium
On 2016/03/22 20:35:46, Justin Novosad wrote: > +scroggo > Should have asked earlier, but do ...
4 years, 9 months ago (2016-03-23 14:06:57 UTC) #17
Justin Novosad
On Wed, Mar 23, 2016 at 10:06 AM, <scroggo@chromium.org> wrote: > On 2016/03/22 20:35:46, Justin ...
4 years, 9 months ago (2016-03-23 14:17:12 UTC) #18
Justin Novosad
4 years, 9 months ago (2016-03-23 14:17:14 UTC) #19
Message was sent while issue was closed.
On Wed, Mar 23, 2016 at 10:06 AM, <scroggo@chromium.org> wrote:

> On 2016/03/22 20:35:46, Justin Novosad wrote:
> > +scroggo
> > Should have asked earlier, but do you know of a cleaner way of doing
> this?
> > Basically, we want createImageBitmap to force an immediate decode, so
> that
> once
> > we have a resolved ImageBitmap object, we have a guarantee that it is in
> a
> > pre-decoded state. Right now, we have an SkImage that may be using
> deferred
> > decode, and we could not think of a cleaner way to trigger an immediate
> decode
> > than to peek a pixel.
>
> The way we typically trigger a decode in SkImage is using preroll() [1].
> That
> said, it does not guarantee that the SkImage remains decoded - this
> particular
> SkImage has a DecodingImageGenerator, which will decode into either the
> SkResourceCache, which uses discardable memory (if the image is a single
> frame
> image that is complete on the first call to decode) or into its own cache
> (an
> ImageFrame on an ImageDecoder in the ImageDecodingStore). Either way, it's
> possible that the image will be thrown out of the cache.
>
> vmpstr@ is working on a way to ensure that the image the compositor uses
> is
> locked when it comes time to draw, and as I understand it, it will copy the
> image (actually scale it to the desired size) into memory that is
> guaranteed to
> stick around until it is no longer needed [2]. I don't know if that kind of
> approach makes sense for this case.
>
> [1]
>
>
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/skia/i...
> [2]
>
>
https://docs.google.com/document/d/13UsG1IVEIqRg5yaQ9ZmF7dXQprI6KCrSy82CK7Xwfkw/
>
> https://codereview.chromium.org/1800153003/
>

Thanks. This is very useful information.  I think preroll() makes a lot of
sense.  The contract that ImageBitmap needs to fulfill is to guarantee that
the image is can be drawn "without undue latency".  The spec is
deliberately vague to give implementations some freedom. Having images in a
pre-decoded state is ideal, but making them subject to eviction in low
memory conditions also makes sense, to avoid OOM crashes.
Xida, mind changing this code to use preroll()?

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698