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

Unified Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp

Issue 2163983004: Pass per-frame task runners to Workers (when possible) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 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
Index: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
index 22c407438ef4e05f82f87dab5525d163671879d2..2497aa406ecea4a222fadadf1715acb33ce44a05 100644
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
@@ -39,6 +39,7 @@
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/loader/FrameLoadRequest.h"
+#include "core/workers/ParentFrameTaskRunners.h"
#include "core/workers/WorkerClients.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerInspectorProxy.h"
@@ -255,6 +256,8 @@ void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message)
void WebEmbeddedWorkerImpl::postTaskToLoader(std::unique_ptr<ExecutionContextTask> task)
{
+ // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and
+ // consider using m_mainThreadTaskRunners->getLoadingTaskRunner() instead.
m_mainFrame->frame()->document()->postTask(BLINK_FROM_HERE, std::move(task));
}
@@ -436,6 +439,12 @@ void WebEmbeddedWorkerImpl::startWorkerThread()
m_mainScriptLoader.clear();
+ // We have a dummy document here for loading but it doesn't really represent
+ // the document/frame of associated document(s) for this worker. Here we
+ // populate the task runners with null document not to confuse the frame
+ // scheduler (which will end up using the thread's default task runner).
+ m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr);
+
m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *document, *m_workerContextClient);
m_loaderProxy = WorkerLoaderProxy::create(this);
m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy);
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698