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

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

Issue 2269513002: Use per-frame task runner in XHR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make XHRPT own a clone of WebTaskRunner Created 4 years, 4 months 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
Index: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
index 9bfb0444231bbee6dabf724534e563861e2038a0..b485a2fb89ae1416d6ff8ab98aeec7ce782599b4 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
@@ -27,6 +27,7 @@
#include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h"
#include "core/EventTypeNames.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/events/ProgressEvent.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h"
@@ -41,6 +42,12 @@ namespace blink {
static const double kMinimumProgressEventDispatchingIntervalInSeconds = .05; // 50 ms per specification.
+// static
+XMLHttpRequestProgressEventThrottle* XMLHttpRequestProgressEventThrottle::create(XMLHttpRequest* eventTarget)
+{
+ return new XMLHttpRequestProgressEventThrottle(eventTarget, TaskRunnerHelper::get(TaskType::Networking, eventTarget->getExecutionContext())->clone());
+}
+
XMLHttpRequestProgressEventThrottle::DeferredEvent::DeferredEvent()
{
clear();
@@ -73,8 +80,9 @@ Event* XMLHttpRequestProgressEventThrottle::DeferredEvent::take()
return event;
}
-XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttpRequest* target)
- : TimerBase(Platform::current()->currentThread()->scheduler()->timerTaskRunner())
+XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(XMLHttpRequest* target, std::unique_ptr<WebTaskRunner> taskRunner)
+ : TimerBase(taskRunner.get())
+ , m_taskRunner(std::move(taskRunner))
dcheng 2016/08/24 23:30:34 I'm a bit confused why we need to clone() and keep
haraken 2016/08/24 23:51:58 It's normally a problem today. Currently we need t
, m_target(target)
, m_hasDispatchedProgressProgressEvent(false)
{

Powered by Google App Engine
This is Rietveld 408576698