Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(941)

Unified Diff: Source/core/xml/XMLHttpRequestUpload.cpp

Issue 63033008: Move delivery of upload 'progress' events to XMLHttpRequestUpload. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/xml/XMLHttpRequestUpload.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequestUpload.cpp
diff --git a/Source/core/xml/XMLHttpRequestUpload.cpp b/Source/core/xml/XMLHttpRequestUpload.cpp
index d9fd5f615465be2a8a125e62c186700b61f43566..ceaee622dd926e878f48157a24e246748854331b 100644
--- a/Source/core/xml/XMLHttpRequestUpload.cpp
+++ b/Source/core/xml/XMLHttpRequestUpload.cpp
@@ -37,6 +37,8 @@ namespace WebCore {
XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest)
: m_xmlHttpRequest(xmlHttpRequest)
+ , m_lastBytesSent(0)
+ , m_lastTotalBytesToBeSent(0)
{
ScriptWrappable::init(this);
}
@@ -51,6 +53,13 @@ ExecutionContext* XMLHttpRequestUpload::executionContext() const
return m_xmlHttpRequest->executionContext();
}
+void XMLHttpRequestUpload::dispatchProgressEvent(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
+{
+ m_lastBytesSent = bytesSent;
+ m_lastTotalBytesToBeSent = totalBytesToBeSent;
+ dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::progress, true, bytesSent, totalBytesToBeSent));
+}
+
void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
{
ASSERT(event->type() == EventTypeNames::load || event->type() == EventTypeNames::abort || event->type() == EventTypeNames::error || event->type() == EventTypeNames::timeout);
« no previous file with comments | « Source/core/xml/XMLHttpRequestUpload.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698