DescriptionMake image load completion async and remove EventSender from ImageLoader
New attempt -> https://codereview.chromium.org/2863763003/
Previously, ImageLoader::notifyFinished() is the point of image completion:
i.e. after that point,
- |img.complete| is true (and thus we can draw the image on a canvas),
- <img>'s load event can be dispatched, and
- the image loading no longer blocks document's load event.
This CL moves the point to ImageLoader::finish(), which is called
asynchronously from ImageLoader::notifyFinished(), by adding an
IncrementLoadEventDelayCount that blocks document load event between
ImageLoader::notifyFinished() and ImageLoader::finish().
This CL
- Fix Issue 382170. The problem was that |img.complete| becomes true before
font (data URL) subresource loading of a SVG completes.
A subsequent CL [1] will start font subresource loading in
SVGImage::dataChanged(), which is called before ImageLoader::notifyFinished()
in successful loading, and thus asynchronous data URL loading is completed
before ImageLoader::finish() and thus before |img.complete| becomes true.
[1] https://codereview.chromium.org/1832333003/
- Remove EventSender singletons in ImageLoader.
loadEventSender()/errorEventSender() are singletons shared among all
ResourceFetchers, and they cause causality between image/document's load
event timing between different ResourceFetcher.
This CL replaces EventSenders with CancellableTasks per ImageLoader.
Observable behavior changes (catched by newly added loading/onload/ tests) are:
- Whether |img.complete| becomes true synchronously when setting |img.src|:
For cached images: Previous Chromium: Yes / Firefox: Yes / This CL: No
(e.g. images with the same URL is loaded multiple times in a page)
For data URLs: Previous Chromium: Yes / Firefox: No / This CL: No
This change causes changes in the layout tests in this CL.
- Whether starting loading a new image in another image's load event blocks
document's load event that would be dispatched otherwise:
Previous Chromium: No / Firefox: Yes / This CL: Yes
BUG=382170
Patch Set 1 #Patch Set 2 : #Patch Set 3 : #Patch Set 4 : #Patch Set 5 : #Patch Set 6 : Rebase #Patch Set 7 : Fix webkit_unit_tests #Patch Set 8 : Fix fast/images/destroyed-image-load-event.html. #Patch Set 9 : Fix multipart tests. #Patch Set 10 : Fix crashes. #Patch Set 11 : Fix layout tets. #Patch Set 12 : #Patch Set 13 : cleanup, fix new layout tests #
Total comments: 8
Patch Set 14 : Rebase. #Patch Set 15 : Rebase. #Patch Set 16 : Reflect comments #Patch Set 17 : #Patch Set 18 : #Patch Set 19 : Rebase. #Patch Set 20 : Add if() statement in cancelPendingFinish() #Patch Set 21 : Rebase. #Depends on Patchset: Messages
Total messages: 77 (41 generated)
|