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

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

Issue 239973002: Add blink interface (and code) for setting navigator.serviceWorker.current (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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/ServiceWorkerContainer.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index 64fcd755b72c7d0298f80ec5b3895242a362f8e2..a28c9313c0112c090b29f0d88f835a425a29655c 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -38,6 +38,7 @@
#include "modules/serviceworkers/ServiceWorker.h"
#include "modules/serviceworkers/ServiceWorkerContainerClient.h"
#include "modules/serviceworkers/ServiceWorkerError.h"
+#include "public/platform/WebServiceWorker.h"
#include "public/platform/WebServiceWorkerProvider.h"
#include "public/platform/WebString.h"
#include "public/platform/WebURL.h"
@@ -114,8 +115,16 @@ ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ExecutionContext*
return promise;
}
+void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* serviceWorker)
+{
+ if (!executionContext())
+ return;
+ m_current = ServiceWorker::create(executionContext(), adoptPtr(serviceWorker));
+}
+
ServiceWorkerContainer::ServiceWorkerContainer(ExecutionContext* executionContext)
- : m_provider(0)
+ : ContextLifecycleObserver(executionContext)
+ , m_provider(0)
{
ScriptWrappable::init(this);
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.h ('k') | public/platform/WebServiceWorkerProviderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698