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" |
11 #include "content/child/child_thread.h" | 11 #include "content/child/child_thread_impl.h" |
12 #include "content/child/service_worker/service_worker_handle_reference.h" | 12 #include "content/child/service_worker/service_worker_handle_reference.h" |
13 #include "content/child/service_worker/service_worker_provider_context.h" | 13 #include "content/child/service_worker/service_worker_provider_context.h" |
14 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" | 14 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" |
15 #include "content/child/service_worker/web_service_worker_impl.h" | 15 #include "content/child/service_worker/web_service_worker_impl.h" |
16 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 16 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
17 #include "content/child/thread_safe_sender.h" | 17 #include "content/child/thread_safe_sender.h" |
18 #include "content/child/webmessageportchannel_impl.h" | 18 #include "content/child/webmessageportchannel_impl.h" |
19 #include "content/common/service_worker/service_worker_messages.h" | 19 #include "content/common/service_worker/service_worker_messages.h" |
20 #include "content/common/service_worker/service_worker_types.h" | 20 #include "content/common/service_worker/service_worker_types.h" |
21 #include "content/public/common/url_utils.h" | 21 #include "content/public/common/url_utils.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } | 631 } |
632 | 632 |
633 void ServiceWorkerDispatcher::OnPostMessage( | 633 void ServiceWorkerDispatcher::OnPostMessage( |
634 int thread_id, | 634 int thread_id, |
635 int provider_id, | 635 int provider_id, |
636 const base::string16& message, | 636 const base::string16& message, |
637 const std::vector<int>& sent_message_port_ids, | 637 const std::vector<int>& sent_message_port_ids, |
638 const std::vector<int>& new_routing_ids) { | 638 const std::vector<int>& new_routing_ids) { |
639 // Make sure we're on the main document thread. (That must be the only | 639 // Make sure we're on the main document thread. (That must be the only |
640 // thread we get this message) | 640 // thread we get this message) |
641 DCHECK(ChildThread::current()); | 641 DCHECK(ChildThreadImpl::current()); |
642 TRACE_EVENT1("ServiceWorker", | 642 TRACE_EVENT1("ServiceWorker", |
643 "ServiceWorkerDispatcher::OnPostMessage", | 643 "ServiceWorkerDispatcher::OnPostMessage", |
644 "Thread ID", thread_id); | 644 "Thread ID", thread_id); |
645 | 645 |
646 ProviderClientMap::iterator found = provider_clients_.find(provider_id); | 646 ProviderClientMap::iterator found = provider_clients_.find(provider_id); |
647 if (found == provider_clients_.end()) { | 647 if (found == provider_clients_.end()) { |
648 // For now we do no queueing for messages sent to nonexistent / unattached | 648 // For now we do no queueing for messages sent to nonexistent / unattached |
649 // client. | 649 // client. |
650 return; | 650 return; |
651 } | 651 } |
(...skipping 77 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 |