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