Unreviewed, rolling out r243551.
[WebKit-https.git] / Source / WebCore / xml / XMLHttpRequestUpload.cpp
index f71b76b..8c06583 100644 (file)
 #include "config.h"
 #include "XMLHttpRequestUpload.h"
 
-#include "Event.h"
-#include "EventException.h"
 #include "EventNames.h"
-#include "XMLHttpRequest.h"
 #include "XMLHttpRequestProgressEvent.h"
 #include <wtf/Assertions.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
 
-XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest)
-    : m_xmlHttpRequest(xmlHttpRequest)
+XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest& request)
+    : m_request(request)
 {
 }
 
-const AtomicString& XMLHttpRequestUpload::interfaceName() const
+void XMLHttpRequestUpload::dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total)
 {
-    return eventNames().interfaceForXMLHttpRequestUpload;
-}
+    m_lengthComputable = lengthComputable;
+    m_loaded = loaded;
+    m_total = total;
 
-ScriptExecutionContext* XMLHttpRequestUpload::scriptExecutionContext() const
-{
-    return m_xmlHttpRequest->scriptExecutionContext();
+    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));
 }
 
-EventTargetData* XMLHttpRequestUpload::eventTargetData()
+void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type)
 {
-    return &m_eventTargetData;
-}
+    ASSERT(type == eventNames().loadstartEvent || type == eventNames().progressEvent || type == eventNames().loadEvent || type == eventNames().loadendEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent);
 
-EventTargetData& XMLHttpRequestUpload::ensureEventTargetData()
-{
-    return m_eventTargetData;
-}
+    if (type == eventNames().loadstartEvent) {
+        m_lengthComputable = false;
+        m_loaded = 0;
+        m_total = 0;
+    }
 
-void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
-{
-    ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent);
-
-    dispatchEvent(event);
-    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
+    dispatchEvent(XMLHttpRequestProgressEvent::create(type, m_lengthComputable, m_loaded, m_total));
 }
 
-
-
 } // namespace WebCore