| 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/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 9 #include "platform/WebFrameScheduler.h" | 10 #include "platform/WebFrameScheduler.h" |
| 10 #include "platform/WebTaskRunner.h" | 11 #include "platform/WebTaskRunner.h" |
| 11 #include "public/platform/Platform.h" | 12 #include "public/platform/Platform.h" |
| 12 #include "public/platform/WebThread.h" | 13 #include "public/platform/WebThread.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, LocalFrame* frame) { | 17 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, LocalFrame* frame) { |
| 17 // TODO(haraken): Optimize the mapping from TaskTypes to task runners. | 18 // TODO(haraken): Optimize the mapping from TaskTypes to task runners. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 TaskType type, | 66 TaskType type, |
| 66 ExecutionContext* execution_context) { | 67 ExecutionContext* execution_context) { |
| 67 return Get(type, execution_context && execution_context->IsDocument() | 68 return Get(type, execution_context && execution_context->IsDocument() |
| 68 ? static_cast<Document*>(execution_context) | 69 ? static_cast<Document*>(execution_context) |
| 69 : nullptr); | 70 : nullptr); |
| 70 } | 71 } |
| 71 | 72 |
| 72 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, | 73 RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, |
| 73 ScriptState* script_state) { | 74 ScriptState* script_state) { |
| 74 return Get(type, | 75 return Get(type, |
| 75 script_state ? script_state->GetExecutionContext() : nullptr); | 76 script_state ? ExecutionContext::From(script_state) : nullptr); |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace blink | 79 } // namespace blink |
| OLD | NEW |