| 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 "platform/WebFrameScheduler.h" | 9 #include "platform/WebFrameScheduler.h" |
| 10 #include "platform/WebTaskRunner.h" | 10 #include "platform/WebTaskRunner.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return frame ? frame->frameScheduler()->loadingTaskRunner() | 41 return frame ? frame->frameScheduler()->loadingTaskRunner() |
| 42 : Platform::current()->currentThread()->getWebTaskRunner(); | 42 : Platform::current()->currentThread()->getWebTaskRunner(); |
| 43 case TaskType::Unthrottled: | 43 case TaskType::Unthrottled: |
| 44 return frame ? frame->frameScheduler()->unthrottledTaskRunner() | 44 return frame ? frame->frameScheduler()->unthrottledTaskRunner() |
| 45 : Platform::current()->currentThread()->getWebTaskRunner(); | 45 : Platform::current()->currentThread()->getWebTaskRunner(); |
| 46 } | 46 } |
| 47 NOTREACHED(); | 47 NOTREACHED(); |
| 48 return nullptr; | 48 return nullptr; |
| 49 } | 49 } |
| 50 | 50 |
| 51 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, Frame* frame) { |
| 52 return get(type, frame->isLocalFrame() ? toLocalFrame(frame) : nullptr); |
| 53 } |
| 54 |
| 51 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, Document* document) { | 55 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, Document* document) { |
| 52 return get(type, document ? document->frame() : nullptr); | 56 return get(type, document ? document->frame() : nullptr); |
| 53 } | 57 } |
| 54 | 58 |
| 55 RefPtr<WebTaskRunner> TaskRunnerHelper::get( | 59 RefPtr<WebTaskRunner> TaskRunnerHelper::get( |
| 56 TaskType type, | 60 TaskType type, |
| 57 ExecutionContext* executionContext) { | 61 ExecutionContext* executionContext) { |
| 58 return get(type, executionContext && executionContext->isDocument() | 62 return get(type, executionContext && executionContext->isDocument() |
| 59 ? static_cast<Document*>(executionContext) | 63 ? static_cast<Document*>(executionContext) |
| 60 : nullptr); | 64 : nullptr); |
| 61 } | 65 } |
| 62 | 66 |
| 63 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, | 67 RefPtr<WebTaskRunner> TaskRunnerHelper::get(TaskType type, |
| 64 ScriptState* scriptState) { | 68 ScriptState* scriptState) { |
| 65 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr); | 69 return get(type, scriptState ? scriptState->getExecutionContext() : nullptr); |
| 66 } | 70 } |
| 67 | 71 |
| 68 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |