Index: Source/core/loader/ImageLoader.h |
diff --git a/Source/core/loader/ImageLoader.h b/Source/core/loader/ImageLoader.h |
index 589d2a8ed8f7ce9febc57df8fe96adc20684c60f..c905c187d2a4b89ae5d733a076817cadafc9aa09 100644 |
--- a/Source/core/loader/ImageLoader.h |
+++ b/Source/core/loader/ImageLoader.h |
@@ -59,7 +59,7 @@ public: |
// This function should be called when the element is attached to a document; starts |
// loading if a load hasn't already been started. |
- void updateFromElement(); |
+ void updateFromElement(bool calledFromTask = false, bool bypassMainWorldCSP = false); |
// This function should be called whenever the 'src' attribute is set, even if its value |
// doesn't change; starts new load unconditionally (matches Firefox and Opera behavior). |
@@ -68,14 +68,14 @@ public: |
void elementDidMoveToNewDocument(); |
Element* element() const { return m_element; } |
- bool imageComplete() const { return m_imageComplete; } |
+ bool imageComplete() const { return m_imageComplete && !m_pendingTask; } |
ImageResource* image() const { return m_image.get(); } |
void setImage(ImageResource*); // Cancels pending load events, and doesn't dispatch new ones. |
void setLoadManually(bool loadManually) { m_loadManually = loadManually; } |
- bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; } |
+ bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent || m_pendingTask; } |
void dispatchPendingEvent(ImageEventSender*); |
@@ -89,6 +89,8 @@ protected: |
virtual void notifyFinished(Resource*) OVERRIDE; |
private: |
+ class Task; |
+ |
virtual void dispatchLoadEvent() = 0; |
virtual String sourceURI(const AtomicString&) const = 0; |
@@ -106,6 +108,10 @@ private: |
void timerFired(Timer<ImageLoader>*); |
+ // Used to determine whether to immediately initiate the load |
+ // or to schedule a microtask. |
+ bool shouldLoadImmediately(const KURL&) const; |
+ |
typedef WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<ImageLoaderClient> > ImageLoaderClientSet; |
Element* m_element; |
@@ -113,6 +119,7 @@ private: |
ImageLoaderClientSet m_clients; |
Timer<ImageLoader> m_derefElementTimer; |
AtomicString m_failedLoadURL; |
+ Task* m_pendingTask; // owned by Microtask |
bool m_hasPendingLoadEvent : 1; |
bool m_hasPendingErrorEvent : 1; |
bool m_imageComplete : 1; |