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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 registration->SetActive(GetServiceWorker(attrs.active, false)); | 632 registration->SetActive(GetServiceWorker(attrs.active, false)); |
633 } | 633 } |
634 | 634 |
635 // Resolve the .ready promise with the registration object. | 635 // Resolve the .ready promise with the registration object. |
636 client->second->setReadyRegistration(registration); | 636 client->second->setReadyRegistration(registration); |
637 } | 637 } |
638 | 638 |
639 void ServiceWorkerDispatcher::OnSetControllerServiceWorker( | 639 void ServiceWorkerDispatcher::OnSetControllerServiceWorker( |
640 int thread_id, | 640 int thread_id, |
641 int provider_id, | 641 int provider_id, |
642 const ServiceWorkerObjectInfo& info) { | 642 const ServiceWorkerObjectInfo& info, |
| 643 bool should_notify_controllerchange) { |
643 TRACE_EVENT2("ServiceWorker", | 644 TRACE_EVENT2("ServiceWorker", |
644 "ServiceWorkerDispatcher::OnSetControllerServiceWorker", | 645 "ServiceWorkerDispatcher::OnSetControllerServiceWorker", |
645 "Thread ID", thread_id, | 646 "Thread ID", thread_id, |
646 "Provider ID", provider_id); | 647 "Provider ID", provider_id); |
647 ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); | 648 ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); |
648 if (provider != provider_contexts_.end()) { | 649 if (provider != provider_contexts_.end()) { |
649 provider->second->OnSetControllerServiceWorker( | 650 provider->second->OnSetControllerServiceWorker( |
650 provider->second->registration_handle_id(), info); | 651 provider->second->registration_handle_id(), info); |
651 worker_to_provider_[info.handle_id] = provider->second; | 652 worker_to_provider_[info.handle_id] = provider->second; |
652 } | 653 } |
653 | 654 |
654 ScriptClientMap::iterator found = script_clients_.find(provider_id); | 655 ScriptClientMap::iterator found = script_clients_.find(provider_id); |
655 if (found != script_clients_.end()) { | 656 if (found != script_clients_.end()) { |
656 // Populate the .controller field with the new worker object. | 657 // Populate the .controller field with the new worker object. |
657 found->second->setController(GetServiceWorker(info, false)); | 658 found->second->setController(GetServiceWorker(info, false), |
| 659 should_notify_controllerchange); |
658 } | 660 } |
659 } | 661 } |
660 | 662 |
661 void ServiceWorkerDispatcher::OnPostMessage( | 663 void ServiceWorkerDispatcher::OnPostMessage( |
662 int thread_id, | 664 int thread_id, |
663 int provider_id, | 665 int provider_id, |
664 const base::string16& message, | 666 const base::string16& message, |
665 const std::vector<int>& sent_message_port_ids, | 667 const std::vector<int>& sent_message_port_ids, |
666 const std::vector<int>& new_routing_ids) { | 668 const std::vector<int>& new_routing_ids) { |
667 // Make sure we're on the main document thread. (That must be the only | 669 // Make sure we're on the main document thread. (That must be the only |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 attrs.installing, thread_safe_sender_.get()); | 759 attrs.installing, thread_safe_sender_.get()); |
758 ServiceWorkerHandleReference::Adopt( | 760 ServiceWorkerHandleReference::Adopt( |
759 attrs.waiting, thread_safe_sender_.get()); | 761 attrs.waiting, thread_safe_sender_.get()); |
760 ServiceWorkerHandleReference::Adopt( | 762 ServiceWorkerHandleReference::Adopt( |
761 attrs.active, thread_safe_sender_.get()); | 763 attrs.active, thread_safe_sender_.get()); |
762 } | 764 } |
763 return registration; | 765 return registration; |
764 } | 766 } |
765 | 767 |
766 } // namespace content | 768 } // namespace content |
OLD | NEW |