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

Side by Side Diff: third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp

Issue 2754673002: [scheduler] Split suspendable tq from unthrottled tq. (Closed)
Patch Set: For the moment make only database access tasks suspendable Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/EmptyClients.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/TaskRunnerHelper.h" 5 #include "core/dom/TaskRunnerHelper.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "platform/WebFrameScheduler.h" 9 #include "platform/WebFrameScheduler.h"
10 #include "platform/WebTaskRunner.h" 10 #include "platform/WebTaskRunner.h"
11 #include "public/platform/Platform.h" 11 #include "public/platform/Platform.h"
12 #include "public/platform/WebThread.h" 12 #include "public/platform/WebThread.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, LocalFrame* frame) { 16 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, LocalFrame* frame) {
17 // TODO(haraken): Optimize the mapping from TaskTypes to task runners. 17 // TODO(haraken): Optimize the mapping from TaskTypes to task runners.
18 switch (type) { 18 switch (type) {
19 case TaskType::Timer: 19 case TaskType::Timer:
20 return frame ? frame->frameScheduler()->timerTaskRunner() 20 return frame ? frame->frameScheduler()->timerTaskRunner()
21 : Platform::current()->currentThread()->getWebTaskRunner(); 21 : Platform::current()->currentThread()->getWebTaskRunner();
22 case TaskType::UnspecedLoading: 22 case TaskType::UnspecedLoading:
23 case TaskType::Networking: 23 case TaskType::Networking:
24 case TaskType::DatabaseAccess:
25 return frame ? frame->frameScheduler()->loadingTaskRunner() 24 return frame ? frame->frameScheduler()->loadingTaskRunner()
26 : Platform::current()->currentThread()->getWebTaskRunner(); 25 : Platform::current()->currentThread()->getWebTaskRunner();
27 // Throttling following tasks may break existing web pages, so tentatively 26 // Throttling following tasks may break existing web pages, so tentatively
28 // these are unthrottled. 27 // these are unthrottled.
29 // TODO(nhiroki): Throttle them again after we're convinced that it's safe 28 // TODO(nhiroki): Throttle them again after we're convinced that it's safe
30 // or provide a mechanism that web pages can opt-out it if throttling is not 29 // or provide a mechanism that web pages can opt-out it if throttling is not
31 // desirable. 30 // desirable.
31 case TaskType::DatabaseAccess:
32 return frame ? frame->frameScheduler()->suspendableTaskRunner()
33 : Platform::current()->currentThread()->getWebTaskRunner();
32 case TaskType::DOMManipulation: 34 case TaskType::DOMManipulation:
33 case TaskType::UserInteraction: 35 case TaskType::UserInteraction:
34 case TaskType::HistoryTraversal: 36 case TaskType::HistoryTraversal:
35 case TaskType::Embed: 37 case TaskType::Embed:
36 case TaskType::MediaElementEvent: 38 case TaskType::MediaElementEvent:
37 case TaskType::CanvasBlobSerialization: 39 case TaskType::CanvasBlobSerialization:
38 case TaskType::RemoteEvent: 40 case TaskType::RemoteEvent:
39 case TaskType::WebSocket: 41 case TaskType::WebSocket:
40 case TaskType::Microtask: 42 case TaskType::Microtask:
41 case TaskType::PostedMessage: 43 case TaskType::PostedMessage:
(...skipping 24 matching lines...) Expand all
66 ? static_cast<Document*>(executionContext) 68 ? static_cast<Document*>(executionContext)
67 : nullptr); 69 : nullptr);
68 } 70 }
69 71
70 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, 72 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type,
71 ScriptState* scriptState) { 73 ScriptState* scriptState) {
72 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr); 74 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr);
73 } 75 }
74 76
75 } // namespace blink 77 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/EmptyClients.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698