Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp

Issue 2870273002: Worklet: Enable TaskRunnerHelper to handle MainThreadWorkletGlobalScope (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698