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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 IDMapOwnPointer>; | 189 IDMapOwnPointer>; |
190 using FetchEventCallbacksMap = | 190 using FetchEventCallbacksMap = |
191 IDMap<const base::Callback<void(ServiceWorkerStatusCode, | 191 IDMap<const base::Callback<void(ServiceWorkerStatusCode, |
192 base::Time /* dispatch_event_time */)>, | 192 base::Time /* dispatch_event_time */)>, |
193 IDMapOwnPointer>; | 193 IDMapOwnPointer>; |
194 using NavigationPreloadRequestsMap = | 194 using NavigationPreloadRequestsMap = |
195 IDMap<ServiceWorkerContextClient::NavigationPreloadRequest, | 195 IDMap<ServiceWorkerContextClient::NavigationPreloadRequest, |
196 IDMapOwnPointer>; | 196 IDMapOwnPointer>; |
197 | 197 |
198 explicit WorkerContextData(ServiceWorkerContextClient* owner) | 198 explicit WorkerContextData(ServiceWorkerContextClient* owner) |
199 : interface_registry(service_manager::Identity(), | 199 : weak_factory(owner), proxy_weak_factory(owner->proxy_) {} |
200 service_manager::InterfaceProviderSpec()), | |
201 weak_factory(owner), | |
202 proxy_weak_factory(owner->proxy_) {} | |
203 | 200 |
204 ~WorkerContextData() { | 201 ~WorkerContextData() { |
205 DCHECK(thread_checker.CalledOnValidThread()); | 202 DCHECK(thread_checker.CalledOnValidThread()); |
206 } | 203 } |
207 | 204 |
208 // Pending callbacks for GetClientDocuments(). | 205 // Pending callbacks for GetClientDocuments(). |
209 ClientsCallbacksMap clients_callbacks; | 206 ClientsCallbacksMap clients_callbacks; |
210 | 207 |
211 // Pending callbacks for OpenWindow() and FocusClient(). | 208 // Pending callbacks for OpenWindow() and FocusClient(). |
212 ClientCallbacksMap client_callbacks; | 209 ClientCallbacksMap client_callbacks; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError) | 421 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError) |
425 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Ping, OnPing); | 422 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Ping, OnPing); |
426 IPC_MESSAGE_UNHANDLED(handled = false) | 423 IPC_MESSAGE_UNHANDLED(handled = false) |
427 IPC_END_MESSAGE_MAP() | 424 IPC_END_MESSAGE_MAP() |
428 DCHECK(handled); | 425 DCHECK(handled); |
429 } | 426 } |
430 | 427 |
431 void ServiceWorkerContextClient::BindInterfaceProviders( | 428 void ServiceWorkerContextClient::BindInterfaceProviders( |
432 service_manager::mojom::InterfaceProviderRequest request, | 429 service_manager::mojom::InterfaceProviderRequest request, |
433 service_manager::mojom::InterfaceProviderPtr remote_interfaces) { | 430 service_manager::mojom::InterfaceProviderPtr remote_interfaces) { |
434 context_->interface_registry.Bind(std::move(request), | 431 context_->interface_registry.Bind( |
435 service_manager::Identity(), | 432 std::move(request), service_manager::Identity(), |
436 service_manager::InterfaceProviderSpec()); | 433 service_manager::InterfaceProviderSpec(), service_manager::Identity(), |
| 434 service_manager::InterfaceProviderSpec()); |
437 context_->remote_interfaces.Bind(std::move(remote_interfaces)); | 435 context_->remote_interfaces.Bind(std::move(remote_interfaces)); |
438 } | 436 } |
439 | 437 |
440 blink::WebURL ServiceWorkerContextClient::scope() const { | 438 blink::WebURL ServiceWorkerContextClient::scope() const { |
441 return service_worker_scope_; | 439 return service_worker_scope_; |
442 } | 440 } |
443 | 441 |
444 void ServiceWorkerContextClient::getClient( | 442 void ServiceWorkerContextClient::getClient( |
445 const blink::WebString& id, | 443 const blink::WebString& id, |
446 blink::WebServiceWorkerClientCallbacks* callbacks) { | 444 blink::WebServiceWorkerClientCallbacks* callbacks) { |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 } | 1276 } |
1279 | 1277 |
1280 base::WeakPtr<ServiceWorkerContextClient> | 1278 base::WeakPtr<ServiceWorkerContextClient> |
1281 ServiceWorkerContextClient::GetWeakPtr() { | 1279 ServiceWorkerContextClient::GetWeakPtr() { |
1282 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1280 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1283 DCHECK(context_); | 1281 DCHECK(context_); |
1284 return context_->weak_factory.GetWeakPtr(); | 1282 return context_->weak_factory.GetWeakPtr(); |
1285 } | 1283 } |
1286 | 1284 |
1287 } // namespace content | 1285 } // namespace content |
OLD | NEW |