| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 587 |
| 588 // Create a content::ServiceWorkerNetworkProvider for this data source so | 588 // Create a content::ServiceWorkerNetworkProvider for this data source so |
| 589 // we can observe its requests. | 589 // we can observe its requests. |
| 590 std::unique_ptr<ServiceWorkerNetworkProvider> provider( | 590 std::unique_ptr<ServiceWorkerNetworkProvider> provider( |
| 591 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, | 591 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, |
| 592 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | 592 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, |
| 593 true /* is_parent_frame_secure */)); | 593 true /* is_parent_frame_secure */)); |
| 594 provider_context_ = provider->context(); | 594 provider_context_ = provider->context(); |
| 595 | 595 |
| 596 // Tell the network provider about which version to load. | 596 // Tell the network provider about which version to load. |
| 597 provider->SetServiceWorkerVersionId(service_worker_version_id_); | 597 provider->SetServiceWorkerVersionId(service_worker_version_id_, |
| 598 embedded_worker_id_); |
| 598 | 599 |
| 599 // The provider is kept around for the lifetime of the DataSource | 600 // The provider is kept around for the lifetime of the DataSource |
| 600 // and ownership is transferred to the DataSource. | 601 // and ownership is transferred to the DataSource. |
| 601 DataSourceExtraData* extra_data = new DataSourceExtraData(); | 602 DataSourceExtraData* extra_data = new DataSourceExtraData(); |
| 602 data_source->setExtraData(extra_data); | 603 data_source->setExtraData(extra_data); |
| 603 ServiceWorkerNetworkProvider::AttachToDocumentState(extra_data, | 604 ServiceWorkerNetworkProvider::AttachToDocumentState(extra_data, |
| 604 std::move(provider)); | 605 std::move(provider)); |
| 605 | 606 |
| 606 // Blink is responsible for deleting the returned object. | 607 // Blink is responsible for deleting the returned object. |
| 607 return new WebServiceWorkerNetworkProviderImpl(); | 608 return new WebServiceWorkerNetworkProviderImpl(); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 } | 1035 } |
| 1035 | 1036 |
| 1036 base::WeakPtr<ServiceWorkerContextClient> | 1037 base::WeakPtr<ServiceWorkerContextClient> |
| 1037 ServiceWorkerContextClient::GetWeakPtr() { | 1038 ServiceWorkerContextClient::GetWeakPtr() { |
| 1038 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1039 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1039 DCHECK(context_); | 1040 DCHECK(context_); |
| 1040 return context_->weak_factory.GetWeakPtr(); | 1041 return context_->weak_factory.GetWeakPtr(); |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 } // namespace content | 1044 } // namespace content |
| OLD | NEW |