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

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

Issue 62193004: XHR: separate delayed progress event flushing from dispatching of new. (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/XMLHttpRequestProgressEventThrottle.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/XMLHttpRequestProgressEventThrottle.cpp
diff --git a/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp b/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp
index 212bf9d835f6ac34a12bb0af191d57b750f6b36f..05e8179418323b53da9206d25330766e156f858d 100644
--- a/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp
+++ b/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp
@@ -77,8 +77,10 @@ void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(bool lengthCompu
void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
{
- if (progressEventAction == FlushProgressEvent)
- flushProgressEvent();
+ if (progressEventAction == FlushProgressEvent || progressEventAction == FlushDeferredProgressEvent) {
+ if (!flushDeferredProgressEvent() && progressEventAction == FlushProgressEvent)
+ deliverProgressEvent();
+ }
dispatchEvent(event);
}
@@ -104,15 +106,19 @@ void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(PassRefPtr<Eve
dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend));
}
-void XMLHttpRequestProgressEventThrottle::flushProgressEvent()
+bool XMLHttpRequestProgressEventThrottle::flushDeferredProgressEvent()
{
if (m_deferEvents && m_deferredProgressEvent) {
// Move the progress event to the queue, to get it in the right order on resume.
m_deferredEvents.append(m_deferredProgressEvent);
m_deferredProgressEvent = 0;
- return;
+ return true;
}
+ return false;
+}
+void XMLHttpRequestProgressEventThrottle::deliverProgressEvent()
+{
if (!hasEventToDispatch())
return;
« no previous file with comments | « Source/core/xml/XMLHttpRequestProgressEventThrottle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698