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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/threading/thread_local.h" | 9 #include "base/threading/thread_local.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 if (attrs.active.handle_id != kInvalidServiceWorkerHandleId) | 339 if (attrs.active.handle_id != kInvalidServiceWorkerHandleId) |
340 worker_to_provider_[attrs.active.handle_id] = provider->second; | 340 worker_to_provider_[attrs.active.handle_id] = provider->second; |
341 } | 341 } |
342 | 342 |
343 void ServiceWorkerDispatcher::OnDisassociateRegistration( | 343 void ServiceWorkerDispatcher::OnDisassociateRegistration( |
344 int thread_id, | 344 int thread_id, |
345 int provider_id) { | 345 int provider_id) { |
346 ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); | 346 ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); |
347 if (provider == provider_contexts_.end()) | 347 if (provider == provider_contexts_.end()) |
348 return; | 348 return; |
349 provider->second->OnDisassociateRegistration(); | |
350 worker_to_provider_.erase(provider->second->installing_handle_id()); | 349 worker_to_provider_.erase(provider->second->installing_handle_id()); |
351 worker_to_provider_.erase(provider->second->waiting_handle_id()); | 350 worker_to_provider_.erase(provider->second->waiting_handle_id()); |
352 worker_to_provider_.erase(provider->second->active_handle_id()); | 351 worker_to_provider_.erase(provider->second->active_handle_id()); |
353 worker_to_provider_.erase(provider->second->controller_handle_id()); | 352 worker_to_provider_.erase(provider->second->controller_handle_id()); |
| 353 provider->second->OnDisassociateRegistration(); |
354 } | 354 } |
355 | 355 |
356 void ServiceWorkerDispatcher::OnRegistered( | 356 void ServiceWorkerDispatcher::OnRegistered( |
357 int thread_id, | 357 int thread_id, |
358 int request_id, | 358 int request_id, |
359 const ServiceWorkerRegistrationObjectInfo& info, | 359 const ServiceWorkerRegistrationObjectInfo& info, |
360 const ServiceWorkerVersionAttributes& attrs) { | 360 const ServiceWorkerVersionAttributes& attrs) { |
361 TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker", | 361 TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker", |
362 "ServiceWorkerDispatcher::RegisterServiceWorker", | 362 "ServiceWorkerDispatcher::RegisterServiceWorker", |
363 request_id, | 363 request_id, |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 attrs.installing, thread_safe_sender_.get()); | 729 attrs.installing, thread_safe_sender_.get()); |
730 ServiceWorkerHandleReference::Adopt( | 730 ServiceWorkerHandleReference::Adopt( |
731 attrs.waiting, thread_safe_sender_.get()); | 731 attrs.waiting, thread_safe_sender_.get()); |
732 ServiceWorkerHandleReference::Adopt( | 732 ServiceWorkerHandleReference::Adopt( |
733 attrs.active, thread_safe_sender_.get()); | 733 attrs.active, thread_safe_sender_.get()); |
734 } | 734 } |
735 return registration; | 735 return registration; |
736 } | 736 } |
737 | 737 |
738 } // namespace content | 738 } // namespace content |
OLD | NEW |