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

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: update comments 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..eb9a78541a351b4a1c5785f1ceacd820d2f72819 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) {
+ // ServiceWorker is never associated with any document's frame. We have a
falken 2016/11/28 01:37:44 "never associated" may be confusing since typicall
nhiroki 2016/11/28 02:26:59 Updated the comments.
+ // dummy document for loading but it doesn't really represent the frame of
+ // associated document(s). Here we intentionally populate the task runners
+ // with null document that will end up using the thread's default task runner.
+ m_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr);
+}
void ServiceWorkerGlobalScopeProxy::detach() {
m_embeddedWorker = nullptr;
« no previous file with comments | « third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698