| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_dispatcher.h" | 5 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (attrs.active.handle_id != kInvalidServiceWorkerHandleId) | 316 if (attrs.active.handle_id != kInvalidServiceWorkerHandleId) |
| 317 worker_to_provider_[attrs.active.handle_id] = provider->second; | 317 worker_to_provider_[attrs.active.handle_id] = provider->second; |
| 318 } | 318 } |
| 319 | 319 |
| 320 void ServiceWorkerDispatcher::OnDisassociateRegistration( | 320 void ServiceWorkerDispatcher::OnDisassociateRegistration( |
| 321 int thread_id, | 321 int thread_id, |
| 322 int provider_id) { | 322 int provider_id) { |
| 323 ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); | 323 ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); |
| 324 if (provider == provider_contexts_.end()) | 324 if (provider == provider_contexts_.end()) |
| 325 return; | 325 return; |
| 326 provider->second->OnDisassociateRegistration(); | |
| 327 worker_to_provider_.erase(provider->second->installing_handle_id()); | 326 worker_to_provider_.erase(provider->second->installing_handle_id()); |
| 328 worker_to_provider_.erase(provider->second->waiting_handle_id()); | 327 worker_to_provider_.erase(provider->second->waiting_handle_id()); |
| 329 worker_to_provider_.erase(provider->second->active_handle_id()); | 328 worker_to_provider_.erase(provider->second->active_handle_id()); |
| 330 worker_to_provider_.erase(provider->second->controller_handle_id()); | 329 worker_to_provider_.erase(provider->second->controller_handle_id()); |
| 330 provider->second->OnDisassociateRegistration(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void ServiceWorkerDispatcher::OnRegistered( | 333 void ServiceWorkerDispatcher::OnRegistered( |
| 334 int thread_id, | 334 int thread_id, |
| 335 int request_id, | 335 int request_id, |
| 336 const ServiceWorkerRegistrationObjectInfo& info, | 336 const ServiceWorkerRegistrationObjectInfo& info, |
| 337 const ServiceWorkerVersionAttributes& attrs) { | 337 const ServiceWorkerVersionAttributes& attrs) { |
| 338 TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker", | 338 TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker", |
| 339 "ServiceWorkerDispatcher::RegisterServiceWorker", | 339 "ServiceWorkerDispatcher::RegisterServiceWorker", |
| 340 request_id, | 340 request_id, |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 attrs.installing, thread_safe_sender_.get()); | 704 attrs.installing, thread_safe_sender_.get()); |
| 705 ServiceWorkerHandleReference::Adopt( | 705 ServiceWorkerHandleReference::Adopt( |
| 706 attrs.waiting, thread_safe_sender_.get()); | 706 attrs.waiting, thread_safe_sender_.get()); |
| 707 ServiceWorkerHandleReference::Adopt( | 707 ServiceWorkerHandleReference::Adopt( |
| 708 attrs.active, thread_safe_sender_.get()); | 708 attrs.active, thread_safe_sender_.get()); |
| 709 } | 709 } |
| 710 return registration; | 710 return registration; |
| 711 } | 711 } |
| 712 | 712 |
| 713 } // namespace content | 713 } // namespace content |
| OLD | NEW |