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

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

Issue 868463004: ServiceWorker: add ServiceWorkerClients.claim() support (1/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments 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/ServiceWorkerClients.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/Source/modules/serviceworkers/ServiceWorkerClients.cpp
index 6e5ed30b07f19a82d15b58b073abde469a56bf41..b9300cc0844a2c77ab8527605a1256ddaf475ade 100644
--- a/Source/modules/serviceworkers/ServiceWorkerClients.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerClients.cpp
@@ -73,4 +73,20 @@ ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien
return promise;
}
+ScriptPromise ServiceWorkerClients::claim(ScriptState* scriptState)
+{
+ ExecutionContext* executionContext = scriptState->executionContext();
+
+ // FIXME: May be null due to worker termination. http://crbug.coma/413518
falken 2015/01/27 03:25:18 typo: .coma
xiang 2015/01/28 05:57:49 Done.
+ if (!executionContext)
+ return ScriptPromise();
+
+ RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
+ ScriptPromise promise = resolver->promise();
+
+ WebServiceWorkerClientsClaimCallbacks* callbacks = new CallbackPromiseAdapter<void, ServiceWorkerError>(resolver);
+ ServiceWorkerGlobalScopeClient::from(executionContext)->claim(callbacks);
+ return promise;
+}
+
} // namespace blink
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerClients.h ('k') | Source/modules/serviceworkers/ServiceWorkerError.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698