OLD | NEW |
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/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/workers/WorkerOrWorkletGlobalScope.h" | 10 #include "core/workers/WorkerOrWorkletGlobalScope.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 return frame ? frame->FrameScheduler()->LoadingTaskRunner() | 27 return frame ? frame->FrameScheduler()->LoadingTaskRunner() |
28 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); | 28 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
29 // Throttling following tasks may break existing web pages, so tentatively | 29 // Throttling following tasks may break existing web pages, so tentatively |
30 // these are unthrottled. | 30 // these are unthrottled. |
31 // TODO(nhiroki): Throttle them again after we're convinced that it's safe | 31 // TODO(nhiroki): Throttle them again after we're convinced that it's safe |
32 // or provide a mechanism that web pages can opt-out it if throttling is not | 32 // or provide a mechanism that web pages can opt-out it if throttling is not |
33 // desirable. | 33 // desirable. |
34 case TaskType::kDatabaseAccess: | 34 case TaskType::kDatabaseAccess: |
35 return frame ? frame->FrameScheduler()->SuspendableTaskRunner() | 35 return frame ? frame->FrameScheduler()->SuspendableTaskRunner() |
36 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); | 36 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
| 37 case TaskType::kAnimationTimer: |
| 38 return frame ? frame->FrameScheduler()->CompositorTaskRunner() |
| 39 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
37 case TaskType::kDOMManipulation: | 40 case TaskType::kDOMManipulation: |
38 case TaskType::kUserInteraction: | 41 case TaskType::kUserInteraction: |
39 case TaskType::kHistoryTraversal: | 42 case TaskType::kHistoryTraversal: |
40 case TaskType::kEmbed: | 43 case TaskType::kEmbed: |
41 case TaskType::kMediaElementEvent: | 44 case TaskType::kMediaElementEvent: |
42 case TaskType::kCanvasBlobSerialization: | 45 case TaskType::kCanvasBlobSerialization: |
43 case TaskType::kRemoteEvent: | 46 case TaskType::kRemoteEvent: |
44 case TaskType::kWebSocket: | 47 case TaskType::kWebSocket: |
45 case TaskType::kMicrotask: | 48 case TaskType::kMicrotask: |
46 case TaskType::kPostedMessage: | 49 case TaskType::kPostedMessage: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 case TaskType::kUnshippedPortMessage: | 112 case TaskType::kUnshippedPortMessage: |
110 case TaskType::kFileReading: | 113 case TaskType::kFileReading: |
111 case TaskType::kDatabaseAccess: | 114 case TaskType::kDatabaseAccess: |
112 case TaskType::kPresentation: | 115 case TaskType::kPresentation: |
113 case TaskType::kSensor: | 116 case TaskType::kSensor: |
114 case TaskType::kPerformanceTimeline: | 117 case TaskType::kPerformanceTimeline: |
115 case TaskType::kWebGL: | 118 case TaskType::kWebGL: |
116 case TaskType::kMiscPlatformAPI: | 119 case TaskType::kMiscPlatformAPI: |
117 case TaskType::kUnspecedTimer: | 120 case TaskType::kUnspecedTimer: |
118 case TaskType::kUnspecedLoading: | 121 case TaskType::kUnspecedLoading: |
| 122 case TaskType::kAnimationTimer: |
119 case TaskType::kUnthrottled: | 123 case TaskType::kUnthrottled: |
120 // UnthrottledTaskRunner is generally discouraged in future. | 124 // UnthrottledTaskRunner is generally discouraged in future. |
121 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and | 125 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and |
122 // move them into other task runners. See also comments in | 126 // move them into other task runners. See also comments in |
123 // Get(LocalFrame). (https://crbug.com/670534) | 127 // Get(LocalFrame). (https://crbug.com/670534) |
124 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); | 128 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); |
125 } | 129 } |
126 NOTREACHED(); | 130 NOTREACHED(); |
127 return nullptr; | 131 return nullptr; |
128 } | 132 } |
129 | 133 |
130 } // namespace blink | 134 } // namespace blink |
OLD | NEW |