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_provider_context.h" | 5 #include "content/child/service_worker/service_worker_provider_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Remove this context from the dispatcher living on the main thread. | 168 // Remove this context from the dispatcher living on the main thread. |
169 dispatcher->RemoveProviderContext(this); | 169 dispatcher->RemoveProviderContext(this); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void ServiceWorkerProviderContext::OnAssociateRegistration( | 173 void ServiceWorkerProviderContext::OnAssociateRegistration( |
174 std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, | 174 std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, |
175 std::unique_ptr<ServiceWorkerHandleReference> installing, | 175 std::unique_ptr<ServiceWorkerHandleReference> installing, |
176 std::unique_ptr<ServiceWorkerHandleReference> waiting, | 176 std::unique_ptr<ServiceWorkerHandleReference> waiting, |
177 std::unique_ptr<ServiceWorkerHandleReference> active) { | 177 std::unique_ptr<ServiceWorkerHandleReference> active) { |
178 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 178 DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); |
179 delegate_->AssociateRegistration(std::move(registration), | 179 delegate_->AssociateRegistration(std::move(registration), |
180 std::move(installing), std::move(waiting), | 180 std::move(installing), std::move(waiting), |
181 std::move(active)); | 181 std::move(active)); |
182 } | 182 } |
183 | 183 |
184 void ServiceWorkerProviderContext::OnDisassociateRegistration() { | 184 void ServiceWorkerProviderContext::OnDisassociateRegistration() { |
185 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 185 DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); |
186 delegate_->DisassociateRegistration(); | 186 delegate_->DisassociateRegistration(); |
187 } | 187 } |
188 | 188 |
189 void ServiceWorkerProviderContext::OnSetControllerServiceWorker( | 189 void ServiceWorkerProviderContext::OnSetControllerServiceWorker( |
190 std::unique_ptr<ServiceWorkerHandleReference> controller, | 190 std::unique_ptr<ServiceWorkerHandleReference> controller, |
191 const std::set<uint32_t>& used_features) { | 191 const std::set<uint32_t>& used_features) { |
192 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 192 DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); |
193 delegate_->SetController(std::move(controller)); | 193 delegate_->SetController(std::move(controller)); |
194 used_features_ = used_features; | 194 used_features_ = used_features; |
195 } | 195 } |
196 | 196 |
197 void ServiceWorkerProviderContext::GetAssociatedRegistration( | 197 void ServiceWorkerProviderContext::GetAssociatedRegistration( |
198 ServiceWorkerRegistrationObjectInfo* info, | 198 ServiceWorkerRegistrationObjectInfo* info, |
199 ServiceWorkerVersionAttributes* attrs) { | 199 ServiceWorkerVersionAttributes* attrs) { |
200 DCHECK(!main_thread_task_runner_->RunsTasksOnCurrentThread()); | 200 DCHECK(!main_thread_task_runner_->RunsTasksInCurrentSequence()); |
201 delegate_->GetAssociatedRegistration(info, attrs); | 201 delegate_->GetAssociatedRegistration(info, attrs); |
202 } | 202 } |
203 | 203 |
204 bool ServiceWorkerProviderContext::HasAssociatedRegistration() { | 204 bool ServiceWorkerProviderContext::HasAssociatedRegistration() { |
205 return delegate_->HasAssociatedRegistration(); | 205 return delegate_->HasAssociatedRegistration(); |
206 } | 206 } |
207 | 207 |
208 ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() { | 208 ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() { |
209 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 209 DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); |
210 return delegate_->controller(); | 210 return delegate_->controller(); |
211 } | 211 } |
212 | 212 |
213 void ServiceWorkerProviderContext::DestructOnMainThread() const { | 213 void ServiceWorkerProviderContext::DestructOnMainThread() const { |
214 if (!main_thread_task_runner_->RunsTasksOnCurrentThread() && | 214 if (!main_thread_task_runner_->RunsTasksInCurrentSequence() && |
215 main_thread_task_runner_->DeleteSoon(FROM_HERE, this)) { | 215 main_thread_task_runner_->DeleteSoon(FROM_HERE, this)) { |
216 return; | 216 return; |
217 } | 217 } |
218 delete this; | 218 delete this; |
219 } | 219 } |
220 | 220 |
221 } // namespace content | 221 } // namespace content |
OLD | NEW |