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

Unified Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1455513002: [XHR] Decrease readyStateChange event dispatching during loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 8badf1f5f4dcd5aa361d7f1ffd989ce3d14ef1e7..8b302c8215b172312e8939667b77915e2f523e41 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -488,17 +488,11 @@ void XMLHttpRequest::trackProgress(long long length)
{
m_receivedLength += length;
- if (m_state != LOADING) {
- changeState(LOADING);
- } else {
- // Dispatch a readystatechange event because many applications use
- // it to track progress although this is not specified.
- //
- // FIXME: Stop dispatching this event for progress tracking.
- dispatchReadyStateChangeEvent();
- }
- if (m_async)
+ changeState(LOADING);
+ if (m_async) {
+ // readyStateChange event is fired as well.
dispatchProgressEventFromSnapshot(EventTypeNames::progress);
+ }
}
void XMLHttpRequest::changeState(State newState)
@@ -514,8 +508,6 @@ void XMLHttpRequest::dispatchReadyStateChangeEvent()
if (!executionContext())
return;
- // We need this protection because dispatchReadyStateChangeEvent may
- // dispatch multiple events.
ScopedEventDispatchProtect protect(&m_eventDispatchRecursionLevel);
if (m_async || (m_state <= OPENED || m_state == DONE)) {
TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", InspectorXhrReadyStateChangeEvent::data(executionContext(), this));
@@ -1676,6 +1668,7 @@ void XMLHttpRequest::resume()
void XMLHttpRequest::stop()
{
InspectorInstrumentation::didFailXHRLoading(executionContext(), this, this, m_method, m_url);
+ m_progressEventThrottle->stop();
internalAbort();
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698