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