| 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/MainThreadWorkletGlobalScope.h" | 10 #include "core/workers/MainThreadWorkletGlobalScope.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 case TaskType::kMicrotask: | 46 case TaskType::kMicrotask: |
| 47 case TaskType::kPostedMessage: | 47 case TaskType::kPostedMessage: |
| 48 case TaskType::kUnshippedPortMessage: | 48 case TaskType::kUnshippedPortMessage: |
| 49 case TaskType::kFileReading: | 49 case TaskType::kFileReading: |
| 50 case TaskType::kPresentation: | 50 case TaskType::kPresentation: |
| 51 case TaskType::kSensor: | 51 case TaskType::kSensor: |
| 52 case TaskType::kPerformanceTimeline: | 52 case TaskType::kPerformanceTimeline: |
| 53 case TaskType::kWebGL: | 53 case TaskType::kWebGL: |
| 54 case TaskType::kUnspecedTimer: | 54 case TaskType::kUnspecedTimer: |
| 55 case TaskType::kMiscPlatformAPI: | 55 case TaskType::kMiscPlatformAPI: |
| 56 // TODO(altimin): Move all these tasks to suspendable or unthrottled |
| 57 // task runner. |
| 58 return frame |
| 59 ? frame->FrameScheduler()->UnthrottledButBlockableTaskRunner() |
| 60 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
| 56 case TaskType::kUnthrottled: | 61 case TaskType::kUnthrottled: |
| 57 return frame ? frame->FrameScheduler()->UnthrottledTaskRunner() | 62 return frame ? frame->FrameScheduler()->UnthrottledTaskRunner() |
| 58 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); | 63 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
| 59 } | 64 } |
| 60 NOTREACHED(); | 65 NOTREACHED(); |
| 61 return nullptr; | 66 return nullptr; |
| 62 } | 67 } |
| 63 | 68 |
| 64 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, Document* document) { | 69 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, Document* document) { |
| 65 return Get(type, document ? document->GetFrame() : nullptr); | 70 return Get(type, document ? document->GetFrame() : nullptr); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and | 131 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and |
| 127 // move them into other task runners. See also comments in | 132 // move them into other task runners. See also comments in |
| 128 // Get(LocalFrame). (https://crbug.com/670534) | 133 // Get(LocalFrame). (https://crbug.com/670534) |
| 129 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); | 134 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); |
| 130 } | 135 } |
| 131 NOTREACHED(); | 136 NOTREACHED(); |
| 132 return nullptr; | 137 return nullptr; |
| 133 } | 138 } |
| 134 | 139 |
| 135 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |