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 5758a11bfc30f5c930b967c96875addd577c297c..e317e49e6157d796b26dd4d6c6e82fb955c6a3b3 100644 |
--- a/third_party/WebKit/Source/core/loader/ImageLoader.h |
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.h |
@@ -41,9 +41,6 @@ class Element; |
class ImageLoader; |
class LayoutImageResource; |
-template<typename T> class EventSender; |
-using ImageEventSender = EventSender<ImageLoader>; |
- |
class CORE_EXPORT ImageLoader : public GarbageCollectedFinalized<ImageLoader>, public ImageResourceObserver { |
USING_PRE_FINALIZER(ImageLoader, dispose); |
public: |
@@ -78,7 +75,7 @@ public: |
Element* element() const { return m_element; } |
bool imageComplete() const |
{ |
- return m_imageComplete && !m_pendingTask; |
+ return m_imageComplete && !m_pendingMicrotask; |
} |
ImageResource* image() const { return m_image.get(); } |
@@ -88,43 +85,46 @@ public: |
bool hasPendingActivity() const |
{ |
- return m_hasPendingLoadEvent || m_hasPendingErrorEvent || m_pendingTask; |
+ return m_hasPendingLoadEvent || hasPendingError() || m_pendingMicrotask; |
} |
bool hasPendingError() const |
{ |
- return m_hasPendingErrorEvent; |
+ return m_loadDelayCounterForError; |
} |
- void dispatchPendingEvent(ImageEventSender*); |
- |
- static void dispatchPendingLoadEvents(); |
- static void dispatchPendingErrorEvents(); |
- |
bool getImageAnimationPolicy(ImageAnimationPolicy&) final; |
+ |
protected: |
- void imageNotifyFinished(ImageResource*) override; |
+ virtual void finishInternal(ImageResource*) { } |
private: |
class Task; |
+ void imageNotifyFinished(ImageResource*) final; |
+ |
// Called from the task or from updateFromElement to initiate the load. |
void doUpdateFromElement(BypassMainWorldBehavior, UpdateFromElementBehavior, ReferrerPolicy = ReferrerPolicyDefault); |
- virtual void dispatchLoadEvent() = 0; |
virtual void noImageResourceToLoad() { } |
void updatedHasPendingEvent(); |
- void dispatchPendingLoadEvent(); |
- void dispatchPendingErrorEvent(); |
+ void cancelPendingFinish(); |
+ void finish(); |
+ |
+ virtual void dispatchLoadEvent() = 0; |
+ |
+ void scheduleErrorEvent(); |
+ void cancelPendingErrorEvent(); |
+ void dispatchErrorEvent(); |
+ void dispatchErrorEventWithoutUpdatedHasPendingEvent(); |
LayoutImageResource* layoutImageResource(); |
void updateLayoutObject(); |
void setImageWithoutConsideringPendingLoadEvent(ImageResource*); |
void clearFailedLoadURL(); |
- void dispatchErrorEvent(); |
void crossSiteOrCSPViolationOccurred(AtomicString); |
void enqueueImageLoadingMicroTask(UpdateFromElementBehavior, ReferrerPolicy); |
@@ -152,10 +152,16 @@ private: |
Timer<ImageLoader> m_derefElementTimer; |
AtomicString m_failedLoadURL; |
- WeakPtr<Task> m_pendingTask; // owned by Microtask |
- OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; |
+ |
+ WeakPtr<Task> m_pendingMicrotask; // owned by Microtask |
+ OwnPtr<CancellableTaskFactory> m_finishTask; |
+ OwnPtr<CancellableTaskFactory> m_dispatchErrorEventTask; |
+ |
+ OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounterForMicrotask; |
+ OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounterForFinish; |
+ OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounterForError; |
+ |
bool m_hasPendingLoadEvent : 1; |
- bool m_hasPendingErrorEvent : 1; |
bool m_imageComplete : 1; |
bool m_loadingImageDocument : 1; |
bool m_elementIsProtected : 1; |