| 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/thread_task_runner_handle.h" |
| 9 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| 10 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 11 #include "content/child/child_thread_impl.h" | 12 #include "content/child/child_thread_impl.h" |
| 12 #include "content/child/service_worker/service_worker_handle_reference.h" | 13 #include "content/child/service_worker/service_worker_handle_reference.h" |
| 13 #include "content/child/service_worker/service_worker_provider_context.h" | 14 #include "content/child/service_worker/service_worker_provider_context.h" |
| 14 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" | 15 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" |
| 15 #include "content/child/service_worker/web_service_worker_impl.h" | 16 #include "content/child/service_worker/web_service_worker_impl.h" |
| 16 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 17 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 17 #include "content/child/thread_safe_sender.h" | 18 #include "content/child/thread_safe_sender.h" |
| 18 #include "content/child/webmessageportchannel_impl.h" | 19 #include "content/child/webmessageportchannel_impl.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 "Thread ID", thread_id); | 630 "Thread ID", thread_id); |
| 630 | 631 |
| 631 ProviderClientMap::iterator found = provider_clients_.find(provider_id); | 632 ProviderClientMap::iterator found = provider_clients_.find(provider_id); |
| 632 if (found == provider_clients_.end()) { | 633 if (found == provider_clients_.end()) { |
| 633 // For now we do no queueing for messages sent to nonexistent / unattached | 634 // For now we do no queueing for messages sent to nonexistent / unattached |
| 634 // client. | 635 // client. |
| 635 return; | 636 return; |
| 636 } | 637 } |
| 637 | 638 |
| 638 blink::WebMessagePortChannelArray ports = | 639 blink::WebMessagePortChannelArray ports = |
| 639 WebMessagePortChannelImpl::CreatePorts(sent_message_ports, | 640 WebMessagePortChannelImpl::CreatePorts( |
| 640 new_routing_ids, | 641 sent_message_ports, new_routing_ids, |
| 641 base::MessageLoopProxy::current()); | 642 base::ThreadTaskRunnerHandle::Get()); |
| 642 | 643 |
| 643 found->second->dispatchMessageEvent(message, ports); | 644 found->second->dispatchMessageEvent(message, ports); |
| 644 } | 645 } |
| 645 | 646 |
| 646 void ServiceWorkerDispatcher::AddServiceWorker( | 647 void ServiceWorkerDispatcher::AddServiceWorker( |
| 647 int handle_id, WebServiceWorkerImpl* worker) { | 648 int handle_id, WebServiceWorkerImpl* worker) { |
| 648 DCHECK(!ContainsKey(service_workers_, handle_id)); | 649 DCHECK(!ContainsKey(service_workers_, handle_id)); |
| 649 service_workers_[handle_id] = worker; | 650 service_workers_[handle_id] = worker; |
| 650 } | 651 } |
| 651 | 652 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 bool adopt_handle = true; | 688 bool adopt_handle = true; |
| 688 WebServiceWorkerRegistrationImpl* registration = | 689 WebServiceWorkerRegistrationImpl* registration = |
| 689 CreateServiceWorkerRegistration(info, adopt_handle); | 690 CreateServiceWorkerRegistration(info, adopt_handle); |
| 690 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); | 691 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); |
| 691 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); | 692 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); |
| 692 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); | 693 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); |
| 693 return registration; | 694 return registration; |
| 694 } | 695 } |
| 695 | 696 |
| 696 } // namespace content | 697 } // namespace content |
| OLD | NEW |