| OLD | NEW | 
|---|
| 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 "content/child/service_worker/service_worker_network_provider.h" | 5 #include "content/child/service_worker/service_worker_network_provider.h" | 
| 6 | 6 | 
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" | 
| 8 #include "content/child/child_thread_impl.h" | 8 #include "content/child/child_thread_impl.h" | 
| 9 #include "content/child/service_worker/service_worker_provider_context.h" | 9 #include "content/child/service_worker/service_worker_provider_context.h" | 
| 10 #include "content/common/service_worker/service_worker_messages.h" | 10 #include "content/common/service_worker/service_worker_messages.h" | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 109 ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { | 109 ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { | 
| 110   if (provider_id_ == kInvalidServiceWorkerProviderId) | 110   if (provider_id_ == kInvalidServiceWorkerProviderId) | 
| 111     return; | 111     return; | 
| 112   if (!ChildThreadImpl::current()) | 112   if (!ChildThreadImpl::current()) | 
| 113     return;  // May be null in some tests. | 113     return;  // May be null in some tests. | 
| 114   ChildThreadImpl::current()->Send( | 114   ChildThreadImpl::current()->Send( | 
| 115       new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_)); | 115       new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_)); | 
| 116 } | 116 } | 
| 117 | 117 | 
| 118 void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId( | 118 void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId( | 
| 119     int64_t version_id) { | 119     int64_t version_id, | 
|  | 120     int embedded_worker_id) { | 
| 120   DCHECK_NE(kInvalidServiceWorkerProviderId, provider_id_); | 121   DCHECK_NE(kInvalidServiceWorkerProviderId, provider_id_); | 
| 121   if (!ChildThreadImpl::current()) | 122   if (!ChildThreadImpl::current()) | 
| 122     return;  // May be null in some tests. | 123     return;  // May be null in some tests. | 
| 123   ChildThreadImpl::current()->Send( | 124   ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_SetVersionId( | 
| 124       new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); | 125       provider_id_, version_id, embedded_worker_id)); | 
| 125 } | 126 } | 
| 126 | 127 | 
| 127 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { | 128 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { | 
| 128   return context() && context()->controller(); | 129   return context() && context()->controller(); | 
| 129 } | 130 } | 
| 130 | 131 | 
| 131 }  // namespace content | 132 }  // namespace content | 
| OLD | NEW | 
|---|