| 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/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebFrameScheduler.h" | 10 #include "public/platform/WebFrameScheduler.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 WebTaskRunner* TaskRunnerHelper::get(TaskType type, ExecutionContext* executionC
ontext) | 49 WebTaskRunner* TaskRunnerHelper::get(TaskType type, ExecutionContext* executionC
ontext) |
| 50 { | 50 { |
| 51 return get(type, executionContext && executionContext->isDocument() ? static
_cast<Document*>(executionContext) : nullptr); | 51 return get(type, executionContext && executionContext->isDocument() ? static
_cast<Document*>(executionContext) : nullptr); |
| 52 } | 52 } |
| 53 | 53 |
| 54 WebTaskRunner* TaskRunnerHelper::get(TaskType type, ScriptState* scriptState) | 54 WebTaskRunner* TaskRunnerHelper::get(TaskType type, ScriptState* scriptState) |
| 55 { | 55 { |
| 56 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr)
; | 56 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr)
; |
| 57 } | 57 } |
| 58 | 58 |
| 59 WebTaskRunner* TaskRunnerHelper::getUnthrottledTaskRunner(LocalFrame* frame) | |
| 60 { | |
| 61 return frame ? frame->frameScheduler()->unthrottledTaskRunner() : Platform::
current()->currentThread()->getWebTaskRunner(); | |
| 62 } | |
| 63 | |
| 64 WebTaskRunner* TaskRunnerHelper::getTimerTaskRunner(LocalFrame* frame) | |
| 65 { | |
| 66 return frame ? frame->frameScheduler()->timerTaskRunner() : Platform::curren
t()->currentThread()->getWebTaskRunner(); | |
| 67 } | |
| 68 | |
| 69 WebTaskRunner* TaskRunnerHelper::getLoadingTaskRunner(LocalFrame* frame) | |
| 70 { | |
| 71 return frame ? frame->frameScheduler()->loadingTaskRunner() : Platform::curr
ent()->currentThread()->getWebTaskRunner(); | |
| 72 } | |
| 73 | |
| 74 WebTaskRunner* TaskRunnerHelper::getUnthrottledTaskRunner(Document* document) | |
| 75 { | |
| 76 return getUnthrottledTaskRunner(document ? document->frame() : nullptr); | |
| 77 } | |
| 78 | |
| 79 WebTaskRunner* TaskRunnerHelper::getTimerTaskRunner(Document* document) | |
| 80 { | |
| 81 return getTimerTaskRunner(document ? document->frame() : nullptr); | |
| 82 } | |
| 83 | |
| 84 WebTaskRunner* TaskRunnerHelper::getLoadingTaskRunner(Document* document) | |
| 85 { | |
| 86 return getLoadingTaskRunner(document ? document->frame() : nullptr); | |
| 87 } | |
| 88 | |
| 89 WebTaskRunner* TaskRunnerHelper::getUnthrottledTaskRunner(ExecutionContext* exec
utionContext) | |
| 90 { | |
| 91 return getUnthrottledTaskRunner(executionContext && executionContext->isDocu
ment() ? static_cast<Document*>(executionContext) : nullptr); | |
| 92 } | |
| 93 | |
| 94 WebTaskRunner* TaskRunnerHelper::getUnthrottledTaskRunner(ScriptState* scriptSta
te) | |
| 95 { | |
| 96 return getUnthrottledTaskRunner(scriptState ? scriptState->getExecutionConte
xt() : nullptr); | |
| 97 } | |
| 98 | |
| 99 } // namespace blink | 59 } // namespace blink |
| OLD | NEW |