#define XMLHttpRequestProgressEventThrottle_h
#include "platform/Timer.h"
+#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
namespace WebCore {
enum ProgressEventAction {
DoNotFlushProgressEvent,
+ FlushDeferredProgressEvent,
FlushProgressEvent
};
// This implements the XHR2 progress event dispatching: "dispatch a progress event called progress
// about every 50ms or for every byte received, whichever is least frequent".
-class XMLHttpRequestProgressEventThrottle : public TimerBase {
+class XMLHttpRequestProgressEventThrottle FINAL : public TimerBase {
+ DISALLOW_ALLOCATION();
public:
explicit XMLHttpRequestProgressEventThrottle(EventTarget*);
virtual ~XMLHttpRequestProgressEventThrottle();
void dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
- void dispatchReadyStateChangeEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
- void dispatchEvent(PassRefPtr<Event>);
- void dispatchEventAndLoadEnd(PassRefPtr<Event>);
+ void dispatchReadyStateChangeEvent(PassRefPtrWillBeRawPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
+ void dispatchEvent(PassRefPtrWillBeRawPtr<Event>);
+ void dispatchEventAndLoadEnd(const AtomicString&, bool, unsigned long long, unsigned long long);
void suspend();
void resume();
+ void trace(Visitor*);
+
private:
static const double minimumProgressEventDispatchingIntervalInSeconds;
- virtual void fired();
+ virtual void fired() OVERRIDE;
void dispatchDeferredEvents(Timer<XMLHttpRequestProgressEventThrottle>*);
- void flushProgressEvent();
+ bool flushDeferredProgressEvent();
+ void deliverProgressEvent();
bool hasEventToDispatch() const;
unsigned long long m_total;
bool m_deferEvents;
- RefPtr<Event> m_deferredProgressEvent;
- Vector<RefPtr<Event> > m_deferredEvents;
+ RefPtrWillBeMember<Event> m_deferredProgressEvent;
+ WillBeHeapVector<RefPtrWillBeMember<Event> > m_deferredEvents;
Timer<XMLHttpRequestProgressEventThrottle> m_dispatchDeferredEventsTimer;
};