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

Unified Diff: third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp

Issue 2669883003: Scheduler: Enqueue non-JS-timer tasks into the unthrottled task runner (Closed)
Patch Set: unthrottle TaskType::UnspecedTimer Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp
diff --git a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp
index a9c1d1d1d906e828e44761cb200ea91de98abd2c..8e5d0af5b9246e96d0dfae688dd9a52f04365dc5 100644
--- a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp
+++ b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp
@@ -16,6 +16,18 @@ namespace blink {
RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, LocalFrame* frame) {
// TODO(haraken): Optimize the mapping from TaskTypes to task runners.
switch (type) {
+ case TaskType::Timer:
+ return frame ? frame->frameScheduler()->timerTaskRunner()
+ : Platform::current()->currentThread()->getWebTaskRunner();
+ case TaskType::UnspecedLoading:
+ case TaskType::Networking:
+ return frame ? frame->frameScheduler()->loadingTaskRunner()
+ : Platform::current()->currentThread()->getWebTaskRunner();
+ // Throttling following tasks may break existing web pages, so tentatively
+ // these are unthrottled.
+ // TODO(nhiroki): Throttle them again after we're convinced that it's safe
+ // or provide a mechanism that web pages can opt-out it if throttling is not
+ // desirable.
case TaskType::DOMManipulation:
case TaskType::UserInteraction:
case TaskType::HistoryTraversal:
@@ -33,15 +45,8 @@ RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, LocalFrame* frame) {
case TaskType::Sensor:
case TaskType::PerformanceTimeline:
case TaskType::WebGL:
- case TaskType::Timer:
case TaskType::UnspecedTimer:
case TaskType::MiscPlatformAPI:
- return frame ? frame->frameScheduler()->timerTaskRunner()
- : Platform::current()->currentThread()->getWebTaskRunner();
- case TaskType::UnspecedLoading:
- case TaskType::Networking:
- return frame ? frame->frameScheduler()->loadingTaskRunner()
- : Platform::current()->currentThread()->getWebTaskRunner();
case TaskType::Unthrottled:
return frame ? frame->frameScheduler()->unthrottledTaskRunner()
: Platform::current()->currentThread()->getWebTaskRunner();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698