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

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

Issue 2584233002: Specify TaskType of posted Task explicitly in FileAPIs (4) (Closed)
Patch Set: Created 4 years 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
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 WebTaskRunner* TaskRunnerHelper::get(TaskType type, LocalFrame* frame) { 16 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::DOMManipulation: 19 case TaskType::DOMManipulation:
20 case TaskType::UserInteraction: 20 case TaskType::UserInteraction:
21 case TaskType::HistoryTraversal: 21 case TaskType::HistoryTraversal:
22 case TaskType::Embed: 22 case TaskType::Embed:
23 case TaskType::MediaElementEvent: 23 case TaskType::MediaElementEvent:
24 case TaskType::CanvasBlobSerialization: 24 case TaskType::CanvasBlobSerialization:
25 case TaskType::RemoteEvent: 25 case TaskType::RemoteEvent:
26 case TaskType::WebSocket: 26 case TaskType::WebSocket:
27 case TaskType::Microtask: 27 case TaskType::Microtask:
28 case TaskType::PostedMessage: 28 case TaskType::PostedMessage:
29 case TaskType::UnshippedPortMessage: 29 case TaskType::UnshippedPortMessage:
30 case TaskType::FileReading:
30 case TaskType::Timer: 31 case TaskType::Timer:
31 case TaskType::Internal: 32 case TaskType::Internal:
32 case TaskType::Unspecified: 33 case TaskType::Unspecified:
33 return frame ? frame->frameScheduler()->timerTaskRunner() 34 return frame ? frame->frameScheduler()->timerTaskRunner()
34 : Platform::current()->currentThread()->getWebTaskRunner(); 35 : Platform::current()->currentThread()->getWebTaskRunner();
35 case TaskType::Networking: 36 case TaskType::Networking:
36 return frame ? frame->frameScheduler()->loadingTaskRunner() 37 return frame ? frame->frameScheduler()->loadingTaskRunner()
37 : Platform::current()->currentThread()->getWebTaskRunner(); 38 : Platform::current()->currentThread()->getWebTaskRunner();
38 case TaskType::Unthrottled: 39 case TaskType::Unthrottled:
39 return frame ? frame->frameScheduler()->unthrottledTaskRunner() 40 return frame ? frame->frameScheduler()->unthrottledTaskRunner()
(...skipping 12 matching lines...) Expand all
52 return get(type, executionContext && executionContext->isDocument() 53 return get(type, executionContext && executionContext->isDocument()
53 ? static_cast<Document*>(executionContext) 54 ? static_cast<Document*>(executionContext)
54 : nullptr); 55 : nullptr);
55 } 56 }
56 57
57 WebTaskRunner* TaskRunnerHelper::get(TaskType type, ScriptState* scriptState) { 58 WebTaskRunner* TaskRunnerHelper::get(TaskType type, ScriptState* scriptState) {
58 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr); 59 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr);
59 } 60 }
60 61
61 } // namespace blink 62 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/TaskRunnerHelper.h ('k') | third_party/WebKit/Source/core/fileapi/FileReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698