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/navigation_params.h" | 10 #include "content/common/navigation_params.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { | 129 ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { |
130 if (provider_id_ == kInvalidServiceWorkerProviderId) | 130 if (provider_id_ == kInvalidServiceWorkerProviderId) |
131 return; | 131 return; |
132 if (!ChildThreadImpl::current()) | 132 if (!ChildThreadImpl::current()) |
133 return; // May be null in some tests. | 133 return; // May be null in some tests. |
134 ChildThreadImpl::current()->Send( | 134 ChildThreadImpl::current()->Send( |
135 new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_)); | 135 new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_)); |
136 } | 136 } |
137 | 137 |
138 void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId( | 138 void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId( |
139 int64 version_id) { | 139 int64_t version_id) { |
140 DCHECK_NE(kInvalidServiceWorkerProviderId, provider_id_); | 140 DCHECK_NE(kInvalidServiceWorkerProviderId, provider_id_); |
141 if (!ChildThreadImpl::current()) | 141 if (!ChildThreadImpl::current()) |
142 return; // May be null in some tests. | 142 return; // May be null in some tests. |
143 ChildThreadImpl::current()->Send( | 143 ChildThreadImpl::current()->Send( |
144 new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); | 144 new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); |
145 } | 145 } |
146 | 146 |
147 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { | 147 bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const { |
148 return context() && context()->controller(); | 148 return context() && context()->controller(); |
149 } | 149 } |
150 | 150 |
151 } // namespace content | 151 } // namespace content |
OLD | NEW |