Chromium Code Reviews| 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 this tasks to suspendable or unthrottled | |
|
Sami
2017/05/22 12:14:44
s/this/these/
altimin
2017/05/30 17:46:38
Done.
| |
| 57 // task runner. | |
| 58 return frame ? frame->FrameScheduler()->GeneralTaskRunner() | |
| 59 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); | |
| 56 case TaskType::kUnthrottled: | 60 case TaskType::kUnthrottled: |
| 57 return frame ? frame->FrameScheduler()->UnthrottledTaskRunner() | 61 return frame ? frame->FrameScheduler()->UnthrottledTaskRunner() |
| 58 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); | 62 : Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
| 59 } | 63 } |
| 60 NOTREACHED(); | 64 NOTREACHED(); |
| 61 return nullptr; | 65 return nullptr; |
| 62 } | 66 } |
| 63 | 67 |
| 64 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, Document* document) { | 68 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, Document* document) { |
| 65 return Get(type, document ? document->GetFrame() : nullptr); | 69 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 | 130 // TODO(nhiroki): Identify which tasks can be throttled / suspendable and |
| 127 // move them into other task runners. See also comments in | 131 // move them into other task runners. See also comments in |
| 128 // Get(LocalFrame). (https://crbug.com/670534) | 132 // Get(LocalFrame). (https://crbug.com/670534) |
| 129 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); | 133 return worker_thread->GetGlobalScopeScheduler()->UnthrottledTaskRunner(); |
| 130 } | 134 } |
| 131 NOTREACHED(); | 135 NOTREACHED(); |
| 132 return nullptr; | 136 return nullptr; |
| 133 } | 137 } |
| 134 | 138 |
| 135 } // namespace blink | 139 } // namespace blink |
| OLD | NEW |