#include "core/fetch/ImageResource.h"
#include "core/fetch/ImageResourceClient.h"
#include "core/fetch/ResourcePtr.h"
+#include "platform/heap/Handle.h"
#include "wtf/HashSet.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
-class ImageLoaderClient {
+class ImageLoaderClient : public WillBeGarbageCollectedMixin {
public:
virtual void notifyImageSourceChanged() = 0;
// Determines whether the observed ImageResource should have higher priority in the decoded resources cache.
virtual bool requestsHighLiveResourceCachePriority() { return false; }
+ virtual void trace(Visitor*) { }
+
protected:
ImageLoaderClient() { }
};
bool imageComplete() const { return m_imageComplete; }
ImageResource* image() const { return m_image.get(); }
- void setImage(ImageResource*); // Cancels pending beforeload and load events, and doesn't dispatch new ones.
+ void setImage(ImageResource*); // Cancels pending load events, and doesn't dispatch new ones.
void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
- bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
void dispatchPendingEvent(ImageEventSender*);
- static void dispatchPendingBeforeLoadEvents();
static void dispatchPendingLoadEvents();
static void dispatchPendingErrorEvents();
void updatedHasPendingEvent();
- void dispatchPendingBeforeLoadEvent();
void dispatchPendingLoadEvent();
void dispatchPendingErrorEvent();
void timerFired(Timer<ImageLoader>*);
+ typedef WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<ImageLoaderClient> > ImageLoaderClientSet;
+
Element* m_element;
ResourcePtr<ImageResource> m_image;
- HashSet<ImageLoaderClient*> m_clients;
+ ImageLoaderClientSet m_clients;
Timer<ImageLoader> m_derefElementTimer;
AtomicString m_failedLoadURL;
- bool m_hasPendingBeforeLoadEvent : 1;
bool m_hasPendingLoadEvent : 1;
bool m_hasPendingErrorEvent : 1;
bool m_imageComplete : 1;