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

Unified Diff: third_party/WebKit/Source/core/loader/ImageLoader.h

Issue 2613853002: Phase III Step 2: Call imageNotifyFinished() and image load event after SVG loading completes (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/ImageLoader.h
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.h b/third_party/WebKit/Source/core/loader/ImageLoader.h
index 2672727e826b3b6c488ed96cec3d5d4dcd34c616..c40679292b69a0a2cc87038e803f05c09ace6f75 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.h
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.h
@@ -108,6 +108,7 @@ class CORE_EXPORT ImageLoader : public GarbageCollectedFinalized<ImageLoader>,
bool getImageAnimationPolicy(ImageAnimationPolicy&) final;
protected:
+ void imageChanged(ImageResourceContent*, const IntRect*) override;
void imageNotifyFinished(ImageResourceContent*) override;
private:
@@ -163,6 +164,23 @@ class CORE_EXPORT ImageLoader : public GarbageCollectedFinalized<ImageLoader>,
AtomicString m_failedLoadURL;
WeakPtr<Task> m_pendingTask; // owned by Microtask
std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter;
kouhei (in TOK) 2017/03/15 11:32:34 m_delayLoadUntilUpdateFromElement?
hiroshige 2017/05/04 22:50:50 Done.
+
+ // Delaying load event: the timeline should be:
+ // (0) ImageResource::fetch() is called.
+ // (1) ResourceFetcher::startLoad(): Resource loading is actually started.
+ // (2) ResourceLoader::didFinishLoading() etc:
+ // Resource loading is finished, but SVG document load might be
+ // incomplete because of asynchronously loaded subresources.
+ // (3) imageNotifyFinished(): Image is completely loaded.
+ // and we must delay Document load event from (1) to (3).
+ // - |ResourceFetcher::m_loaders| delays Document load event from (1) to (2).
+ // - |m_loadDelayCounter| delays Document load event from the first
+ // imageChanged() (at some time between (1) and (2)) until (3).
+ // Ideally, we might want |m_loadDelayCounter2| to delay Document load event
+ // from (1) to (3), but currently we piggybacked on imageChanged() because
+ // adding a callback hook at (1) might complicate the code.
+ std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter2;
kouhei (in TOK) 2017/03/15 11:32:34 Do we have a better name for this? m_delayLoadUnti
fs 2017/03/15 14:22:17 Anything other than ...2 would be an improvement I
hiroshige 2017/05/04 22:50:50 Done.
+
bool m_hasPendingLoadEvent : 1;
bool m_hasPendingErrorEvent : 1;
bool m_imageComplete : 1;

Powered by Google App Engine
This is Rietveld 408576698