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

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

Issue 2513413003: Worker: Provide a way to access parent frame task runners from a worker thread (Closed)
Patch Set: Created 4 years, 1 month 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/ServiceWorkerGlobalScopeProxy.cpp
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index b3d1850adf7115988cb12ace8c85a4223eb20caa..920f1b79cda39d3dc4961a0748c19933db1f1952 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -38,6 +38,7 @@
#include "core/dom/MessagePort.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/origin_trials/OriginTrials.h"
+#include "core/workers/ParentFrameTaskRunners.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerThread.h"
#include "modules/background_sync/SyncEvent.h"
@@ -86,6 +87,7 @@ ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() {
DEFINE_TRACE(ServiceWorkerGlobalScopeProxy) {
visitor->trace(m_document);
+ visitor->trace(m_parentFrameTaskRunners);
visitor->trace(m_pendingPreloadFetchEvents);
}
@@ -357,6 +359,11 @@ void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(
crossThreadUnretained(m_embeddedWorker), message));
}
+ParentFrameTaskRunners*
+ServiceWorkerGlobalScopeProxy::getParentFrameTaskRunners() {
+ return m_parentFrameTaskRunners.get();
+}
+
void ServiceWorkerGlobalScopeProxy::didCreateWorkerGlobalScope(
WorkerOrWorkletGlobalScope* workerGlobalScope) {
DCHECK(!m_workerGlobalScope);
@@ -416,7 +423,13 @@ ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(
: m_embeddedWorker(&embeddedWorker),
m_document(&document),
m_client(&client),
- m_workerGlobalScope(nullptr) {}
+ m_workerGlobalScope(nullptr) {
+ // 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_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr);
haraken 2016/11/22 01:26:17 When is the correct document set to m_parentFrameT
nhiroki 2016/11/22 03:27:20 In my understanding, there is no correct document
+}
void ServiceWorkerGlobalScopeProxy::detach() {
m_embeddedWorker = nullptr;

Powered by Google App Engine
This is Rietveld 408576698