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

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

Issue 2745413005: [scheduler] Move DatabaseAccess tasks to loading tq. (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | 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:
24 return frame ? frame->frameScheduler()->loadingTaskRunner() 25 return frame ? frame->frameScheduler()->loadingTaskRunner()
25 : Platform::current()->currentThread()->getWebTaskRunner(); 26 : Platform::current()->currentThread()->getWebTaskRunner();
26 // Throttling following tasks may break existing web pages, so tentatively 27 // Throttling following tasks may break existing web pages, so tentatively
27 // these are unthrottled. 28 // these are unthrottled.
28 // TODO(nhiroki): Throttle them again after we're convinced that it's safe 29 // TODO(nhiroki): Throttle them again after we're convinced that it's safe
29 // or provide a mechanism that web pages can opt-out it if throttling is not 30 // or provide a mechanism that web pages can opt-out it if throttling is not
30 // desirable. 31 // desirable.
31 case TaskType::DOMManipulation: 32 case TaskType::DOMManipulation:
32 case TaskType::UserInteraction: 33 case TaskType::UserInteraction:
33 case TaskType::HistoryTraversal: 34 case TaskType::HistoryTraversal:
34 case TaskType::Embed: 35 case TaskType::Embed:
35 case TaskType::MediaElementEvent: 36 case TaskType::MediaElementEvent:
36 case TaskType::CanvasBlobSerialization: 37 case TaskType::CanvasBlobSerialization:
37 case TaskType::RemoteEvent: 38 case TaskType::RemoteEvent:
38 case TaskType::WebSocket: 39 case TaskType::WebSocket:
39 case TaskType::Microtask: 40 case TaskType::Microtask:
40 case TaskType::PostedMessage: 41 case TaskType::PostedMessage:
41 case TaskType::UnshippedPortMessage: 42 case TaskType::UnshippedPortMessage:
42 case TaskType::FileReading: 43 case TaskType::FileReading:
43 case TaskType::DatabaseAccess:
44 case TaskType::Presentation: 44 case TaskType::Presentation:
45 case TaskType::Sensor: 45 case TaskType::Sensor:
46 case TaskType::UnspecedTimer: 46 case TaskType::UnspecedTimer:
47 case TaskType::MiscPlatformAPI: 47 case TaskType::MiscPlatformAPI:
48 case TaskType::Unthrottled: 48 case TaskType::Unthrottled:
49 return frame ? frame->frameScheduler()->unthrottledTaskRunner() 49 return frame ? frame->frameScheduler()->unthrottledTaskRunner()
50 : Platform::current()->currentThread()->getWebTaskRunner(); 50 : Platform::current()->currentThread()->getWebTaskRunner();
51 } 51 }
52 NOTREACHED(); 52 NOTREACHED();
53 return nullptr; 53 return nullptr;
(...skipping 10 matching lines...) Expand all
64 ? static_cast<Document*>(executionContext) 64 ? static_cast<Document*>(executionContext)
65 : nullptr); 65 : nullptr);
66 } 66 }
67 67
68 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, 68 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type,
69 ScriptState* scriptState) { 69 ScriptState* scriptState) {
70 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr); 70 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr);
71 } 71 }
72 72
73 } // namespace blink 73 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698