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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerClients.cpp

Issue 783663002: Implement ServiceWorkerClient attributes [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/ServiceWorkerClients.h" 6 #include "modules/serviceworkers/ServiceWorkerClients.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
11 #include "modules/serviceworkers/ServiceWorkerClient.h" 11 #include "modules/serviceworkers/ServiceWorkerClient.h"
12 #include "modules/serviceworkers/ServiceWorkerError.h" 12 #include "modules/serviceworkers/ServiceWorkerError.h"
13 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 13 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
14 #include "public/platform/WebServiceWorkerClientsInfo.h" 14 #include "public/platform/WebServiceWorkerClientsInfo.h"
15 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
16 #include "wtf/Vector.h" 16 #include "wtf/Vector.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 namespace { 20 namespace {
21 21
22 class ClientArray { 22 class ClientArray {
23 public: 23 public:
24 typedef blink::WebServiceWorkerClientsInfo WebType; 24 typedef blink::WebServiceWorkerClientsInfo WebType;
25 static HeapVector<Member<ServiceWorkerClient> > take(ScriptPromiseResolv er*, WebType* webClientsRaw) 25 static HeapVector<Member<ServiceWorkerClient> > take(ScriptPromiseResolv er*, WebType* webClientsRaw)
26 { 26 {
27 OwnPtr<WebType> webClients = adoptPtr(webClientsRaw); 27 OwnPtr<WebType> webClients = adoptPtr(webClientsRaw);
28 HeapVector<Member<ServiceWorkerClient> > clients; 28 HeapVector<Member<ServiceWorkerClient> > clients;
29 for (size_t i = 0; i < webClients->clients.size(); ++i) {
30 clients.append(ServiceWorkerClient::create(webClients->clients[i ].clientID));
31 }
29 for (size_t i = 0; i < webClients->clientIDs.size(); ++i) { 32 for (size_t i = 0; i < webClients->clientIDs.size(); ++i) {
30 clients.append(ServiceWorkerClient::create(webClients->clientIDs [i])); 33 clients.append(ServiceWorkerClient::create(webClients->clientIDs [i]));
31 } 34 }
32 return clients; 35 return clients;
33 } 36 }
34 static void dispose(WebType* webClientsRaw) 37 static void dispose(WebType* webClientsRaw)
35 { 38 {
36 delete webClientsRaw; 39 delete webClientsRaw;
37 } 40 }
38 41
(...skipping 22 matching lines...) Expand all
61 // FIXME: Currently we don't support includeUncontrolled=true. 64 // FIXME: Currently we don't support includeUncontrolled=true.
62 resolver->reject(DOMException::create(NotSupportedError, "includeUncontr olled parameter of getAll is not supported.")); 65 resolver->reject(DOMException::create(NotSupportedError, "includeUncontr olled parameter of getAll is not supported."));
63 return promise; 66 return promise;
64 } 67 }
65 68
66 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->getCl ients(new CallbackPromiseAdapter<ClientArray, ServiceWorkerError>(resolver)); 69 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->getCl ients(new CallbackPromiseAdapter<ClientArray, ServiceWorkerError>(resolver));
67 return promise; 70 return promise;
68 } 71 }
69 72
70 } // namespace blink 73 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/serviceworkers/ServiceWorkerContainer.h » ('j') | public/platform/WebServiceWorkerClientsInfo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698