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

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

Issue 1439333002: Service Worker: Add Clients.get(id) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add layout test Created 4 years, 12 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: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp
index ff907d2e33cf8a5dcc584a4ca7a8d8ed251671e4..8b55a4ed59e424c5a07a061bab42973a59f532b9 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp
@@ -71,6 +71,21 @@ ServiceWorkerClients::ServiceWorkerClients()
{
}
+ScriptPromise ServiceWorkerClients::get(ScriptState* scriptState, const String& id)
+{
+ ExecutionContext* executionContext = scriptState->executionContext();
+ // FIXME: May be null due to worker termination: http://crbug.com/413518.
+ if (!executionContext)
+ return ScriptPromise();
+
+ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
+ ScriptPromise promise = resolver->promise();
+
+ // TODO(jungkees): Use ServiceWorkerClient for typename S of CallBackPromiseAdpater.
zino 2016/01/04 09:05:27 I'm not sure but you are already done?
+ ServiceWorkerGlobalScopeClient::from(executionContext)->getClient(id, new CallbackPromiseAdapter<ServiceWorkerClient, ServiceWorkerError>(resolver));
+ return promise;
+}
+
ScriptPromise ServiceWorkerClients::matchAll(ScriptState* scriptState, const ClientQueryOptions& options)
{
ExecutionContext* executionContext = scriptState->executionContext();

Powered by Google App Engine
This is Rietveld 408576698