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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 811793002: ServiceWorker: Expose registration within ServiceWorkerGlobalScope [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
index 9c183f1d61a0c27713f20e0d22fd6e10a9b36dca..12239d8fd05aa9eed8fce8d9d4d03bb8c1acbcda 100644
--- a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
@@ -47,6 +47,7 @@
#include "modules/serviceworkers/InspectorServiceWorkerCacheAgent.h"
#include "modules/serviceworkers/ServiceWorkerClients.h"
#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
+#include "modules/serviceworkers/ServiceWorkerRegistration.h"
#include "modules/serviceworkers/ServiceWorkerThread.h"
#include "modules/serviceworkers/WaitUntilObserver.h"
#include "platform/network/ResourceRequest.h"
@@ -119,6 +120,11 @@ ServiceWorkerClients* ServiceWorkerGlobalScope::clients()
return m_clients;
}
+ServiceWorkerRegistration* ServiceWorkerGlobalScope::registration()
+{
+ return m_registration;
+}
+
void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState)
{
exceptionState.throwDOMException(InvalidAccessError, "Not supported.");
@@ -138,6 +144,15 @@ ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* scriptState)
return promise;
}
+void ServiceWorkerGlobalScope::setRegistration(WebServiceWorkerRegistration* registration)
+{
+ if (!executionContext()) {
+ ServiceWorkerRegistration::dispose(registration);
+ return;
+ }
+ m_registration = ServiceWorkerRegistration::from(executionContext(), registration);
+}
+
bool ServiceWorkerGlobalScope::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
{
if (m_didEvaluateScript) {
@@ -180,6 +195,7 @@ void ServiceWorkerGlobalScope::dispatchExtendableEvent(PassRefPtrWillBeRawPtr<Ev
void ServiceWorkerGlobalScope::trace(Visitor* visitor)
{
visitor->trace(m_clients);
+ visitor->trace(m_registration);
visitor->trace(m_caches);
WorkerGlobalScope::trace(visitor);
}
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerGlobalScope.h ('k') | Source/modules/serviceworkers/ServiceWorkerGlobalScope.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698