Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp |
| index 631c5de8c0ec7a26c67b96aea14956e1c38bf507..5cece113001eea219e23994abc6170e34b7e46ed 100644 |
| --- a/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp |
| +++ b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp |
| @@ -7,6 +7,7 @@ |
| #include "core/dom/Document.h" |
| #include "core/dom/ExecutionContext.h" |
| #include "core/frame/LocalFrame.h" |
| +#include "core/workers/MainThreadWorkletGlobalScope.h" |
| #include "core/workers/WorkerOrWorkletGlobalScope.h" |
| #include "core/workers/WorkerThread.h" |
| #include "platform/WebFrameScheduler.h" |
| @@ -66,15 +67,19 @@ RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, Document* document) { |
| RefPtr<WebTaskRunner> TaskRunnerHelper::Get( |
| TaskType type, |
| - ExecutionContext* executionContext) { |
| - if (!executionContext) |
| - return Get(type, ToDocument(executionContext)); |
| - if (executionContext->IsDocument()) |
| - return Get(type, ToDocument(executionContext)); |
| - if (executionContext->IsWorkerOrWorkletGlobalScope()) |
| - return Get(type, ToWorkerOrWorkletGlobalScope(executionContext)); |
| - executionContext = nullptr; |
| - return Get(type, ToDocument(executionContext)); |
| + ExecutionContext* execution_context) { |
| + if (!execution_context) |
| + return Get(type, ToDocument(execution_context)); |
| + if (execution_context->IsDocument()) |
| + return Get(type, ToDocument(execution_context)); |
| + if (execution_context->IsMainThreadWorkletGlobalScope()) { |
| + return Get(type, |
| + ToMainThreadWorkletGlobalScope(execution_context)->GetFrame()); |
| + } |
| + if (execution_context->IsWorkerOrWorkletGlobalScope()) |
| + return Get(type, ToWorkerOrWorkletGlobalScope(execution_context)); |
| + execution_context = nullptr; |
| + return Get(type, ToDocument(execution_context)); |
|
kinuko (google)
2017/05/10 01:04:46
would Get(type, ToDocument(nullptr)) work?
actual
nhiroki
2017/05/10 01:15:41
I tried it before but the compiler complained:
htt
|
| } |
| RefPtr<WebTaskRunner> TaskRunnerHelper::Get(TaskType type, |