Chromium Code Reviews| 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; |