Split headerValueForVary into specialized functions for NetworkProcess and WebProcess...
[WebKit-https.git] / Source / WebCore / loader / ImageLoader.h
index cfb48c3..bd4ba9e 100644 (file)
  *
  */
 
-#ifndef ImageLoader_h
-#define ImageLoader_h
+#pragma once
 
 #include "CachedImageClient.h"
 #include "CachedResourceHandle.h"
+#include "JSDOMPromiseDeferred.h"
 #include "Timer.h"
+#include <wtf/Vector.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
@@ -58,7 +59,9 @@ public:
     bool imageComplete() const { return m_imageComplete; }
 
     CachedImage* image() const { return m_image.get(); }
-    void setImage(CachedImage*); // Cancels pending beforeload and load events, and doesn't dispatch new ones.
+    void clearImage(); // Cancels pending beforeload and load events, and doesn't dispatch new ones.
+    
+    void decode(Ref<DeferredPromise>&&);
 
     void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
 
@@ -73,7 +76,7 @@ public:
 
 protected:
     explicit ImageLoader(Element&);
-    virtual void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) override;
 
 private:
     virtual void dispatchLoadEvent() = 0;
@@ -88,15 +91,21 @@ private:
     RenderImageResource* renderImageResource();
     void updateRenderer();
 
-    void setImageWithoutConsideringPendingLoadEvent(CachedImage*);
+    void clearImageWithoutConsideringPendingLoadEvent();
     void clearFailedLoadURL();
 
+    bool hasPendingDecodePromises() const { return !m_decodingPromises.isEmpty(); }
+    void decodeError(const char*);
+    void decode();
+    
     void timerFired();
 
     Element& m_element;
     CachedResourceHandle<CachedImage> m_image;
     Timer m_derefElementTimer;
+    RefPtr<Element> m_protectedElement;
     AtomicString m_failedLoadURL;
+    Vector<RefPtr<DeferredPromise>, 1> m_decodingPromises;
     bool m_hasPendingBeforeLoadEvent : 1;
     bool m_hasPendingLoadEvent : 1;
     bool m_hasPendingErrorEvent : 1;
@@ -106,5 +115,3 @@ private:
 };
 
 }
-
-#endif