Closed
Bug 1163856
Opened 9 years ago
Closed 9 years ago
Considering delaying the image load event until the size is available instead of performing a sync size decode
Categories
(Core :: Graphics: ImageLib, defect)
Core
Graphics: ImageLib
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: seth, Assigned: seth)
References
(Blocks 1 open bug)
Details
(Whiteboard: gfx-noted)
Attachments
(2 files, 3 obsolete files)
(deleted),
patch
|
tnikkel
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review |
Right now we have a problem: it's not unusual for RasterImage::OnImageDataComplete to get called before RasterImage::SetSize. Generally the size decoder that would call SetSize has already finished running, but in order to actually call RasterImage::SetSize it needs to dispatch a runnable to the main thread, as SetSize is a main-thread-only method. The result is that we do a synchronous size decode in OnImageDataComplete - in other words, we frequently end up doing *two* size decodes for an image. This hurts us, particularly on lower-end devices. Bug 1160423 explores one approach to solving this problem: just allow RasterImage::SetSize to be called off-main-thread. I'm not necessarily convinced this is the ideal solution though, because it forces us to add a lot of locking since we touch RasterImage::mSize everywhere, and because unless we're willing to block the main thread for a potentially unlimited amount of time, we *still* may end up having to do multiple size decodes for each image. Before going in that direction, I'd prefer to try just waiting to send the image's load event until the size is available. I've experimented with this approach before, and AFAIK it works fine; the only real issues are: (1) We have a test that specifically checks for this and fails if we do it; we need to change that test. (2) We need to still do a sync size decode for certain types of images. In particular, it's necessary to do this for imgLoader::DecodeImageData unless we want to just synchronously decode the entire image in that method, which I'd prefer to avoid. So we'll need a new Image initialization flag that keeps the current behavior in this case. (At least until we come up with a better approach.)
Assignee | ||
Comment 1•9 years ago
|
||
Here's the patch. I think we need to see how this looks on try before requesting review.
Assignee | ||
Comment 2•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=976cc0547364
Assignee | ||
Comment 3•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b4b5832ff553
Assignee | ||
Comment 4•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=03476bc04bb7
Updated•9 years ago
|
Whiteboard: gfx-noted
Assignee | ||
Comment 5•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6cdecf0833a5
Assignee | ||
Comment 6•9 years ago
|
||
Looks to me like the issue with those failures is that we're not blocking the document load event until we deliver the image load event in FinalizeDecoder. As long as the Necko is loading the image, the document load event will be blocked because the load group will be nonempty. But if in OnImageDataComplete we decide to delay firing the image load event until FinalizeDecoder, we can't rely on that because the Necko transfer is complete, so we have to manually block the document load event. This version of the patch makes us do that by blocking onload in OnImageDataComplete if we're going to delay the image load event, and unblocking onload in FinalizeDecoder when we fire the delayed image load event.
Assignee | ||
Updated•9 years ago
|
Attachment #8604373 -
Attachment is obsolete: true
Assignee | ||
Comment 7•9 years ago
|
||
I made one other change in the new version of the patch: if we're doing a sync load, we never create the async size decoder, as it's just useless.
Assignee | ||
Comment 8•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=53ca333c0c85
Assignee | ||
Comment 9•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=fc76a7fc62cb
Assignee | ||
Comment 10•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7ae006e27af7
Assignee | ||
Comment 11•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=329d6fdd3423
Assignee | ||
Comment 12•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7f91cc6c3f62
Assignee | ||
Comment 13•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=38a92945065d
Assignee | ||
Updated•9 years ago
|
Attachment #8622770 -
Attachment is obsolete: true
Assignee | ||
Comment 14•9 years ago
|
||
This is the same patch as before, just renamed to "part 1" since a part 2 is getting added.
Assignee | ||
Comment 15•9 years ago
|
||
This part fixes tests busted by part 1.
Attachment #8626344 -
Flags: review?(tnikkel)
Updated•9 years ago
|
Attachment #8626344 -
Flags: review?(tnikkel) → review+
Assignee | ||
Comment 16•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/04239448fe0b https://hg.mozilla.org/integration/mozilla-inbound/rev/62c1c616f21c
Comment 17•9 years ago
|
||
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/cf2d7e67dab0 - basically every Win8 and Win7 debug suite asserted like https://treeherder.mozilla.org/logviewer.html#?job_id=11115761&repo=mozilla-inbound
Comment 18•9 years ago
|
||
And a few random other places, like WinXP m-oth a couple of times and Linux64 m-oth once.
Assignee | ||
Comment 19•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=11a282ab0fdc
Assignee | ||
Comment 20•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=46723db69b4c
Assignee | ||
Comment 21•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=bd4dcbc4ae9e
Assignee | ||
Comment 22•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d4f45ad3b8d https://hg.mozilla.org/integration/mozilla-inbound/rev/86800b7a3362
Assignee | ||
Comment 23•9 years ago
|
||
This updated version of part 1 (which I've just pushed) resolves the oranges that caused the previous backout by ensuring that even when mSyncLoad is set, RasterImage::Init still fails when a RasterImage is created with an invalid MIME type. The old version of part 1 broke this by not creating a size decoder in RasterImage::Init when mSyncLoad was set. The new version still doesn't create a size decoder for sync loaded images, but it checks that there's a decoder type available for the requested MIME type and makes RasterImage::Init fail if there isn't one.
Assignee | ||
Updated•9 years ago
|
Attachment #8626343 -
Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/3d4f45ad3b8d https://hg.mozilla.org/mozilla-central/rev/86800b7a3362
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Assignee | ||
Comment 25•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=eb4eb143e1f3
You need to log in
before you can comment on or make changes to this bug.
Description
•