OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 OnFocusClientResponse) | 264 OnFocusClientResponse) |
265 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting) | 265 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting) |
266 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients) | 266 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients) |
267 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError) | 267 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError) |
268 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Ping, OnPing); | 268 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Ping, OnPing); |
269 IPC_MESSAGE_UNHANDLED(handled = false) | 269 IPC_MESSAGE_UNHANDLED(handled = false) |
270 IPC_END_MESSAGE_MAP() | 270 IPC_END_MESSAGE_MAP() |
271 DCHECK(handled); | 271 DCHECK(handled); |
272 } | 272 } |
273 | 273 |
274 void ServiceWorkerContextClient::BindServiceRegistry( | |
275 mojo::InterfaceRequest<mojo::ServiceProvider> services, | |
276 mojo::ServiceProviderPtr exposed_services) { | |
277 service_registry_.Bind(services.Pass()); | |
278 service_registry_.BindRemoteServiceProvider(exposed_services.Pass()); | |
michaeln
2015/07/15 02:34:22
Script will be running before this happens. Does t
Marijn Kruisselbrink
2015/07/15 18:13:28
The service registry is usable before either Bind
michaeln
2015/07/15 21:18:51
thats neat
| |
279 } | |
280 | |
274 blink::WebURL ServiceWorkerContextClient::scope() const { | 281 blink::WebURL ServiceWorkerContextClient::scope() const { |
275 return service_worker_scope_; | 282 return service_worker_scope_; |
276 } | 283 } |
277 | 284 |
278 void ServiceWorkerContextClient::getClients( | 285 void ServiceWorkerContextClient::getClients( |
279 const blink::WebServiceWorkerClientQueryOptions& weboptions, | 286 const blink::WebServiceWorkerClientQueryOptions& weboptions, |
280 blink::WebServiceWorkerClientsCallbacks* callbacks) { | 287 blink::WebServiceWorkerClientsCallbacks* callbacks) { |
281 DCHECK(callbacks); | 288 DCHECK(callbacks); |
282 int request_id = context_->clients_callbacks.Add(callbacks); | 289 int request_id = context_->clients_callbacks.Add(callbacks); |
283 ServiceWorkerClientQueryOptions options; | 290 ServiceWorkerClientQueryOptions options; |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
964 } | 971 } |
965 | 972 |
966 base::WeakPtr<ServiceWorkerContextClient> | 973 base::WeakPtr<ServiceWorkerContextClient> |
967 ServiceWorkerContextClient::GetWeakPtr() { | 974 ServiceWorkerContextClient::GetWeakPtr() { |
968 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 975 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
969 DCHECK(context_); | 976 DCHECK(context_); |
970 return context_->weak_factory.GetWeakPtr(); | 977 return context_->weak_factory.GetWeakPtr(); |
971 } | 978 } |
972 | 979 |
973 } // namespace content | 980 } // namespace content |
OLD | NEW |