| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 859 |
| 860 ProviderClientMap::iterator found = | 860 ProviderClientMap::iterator found = |
| 861 provider_clients_.find(params.provider_id); | 861 provider_clients_.find(params.provider_id); |
| 862 if (found == provider_clients_.end()) { | 862 if (found == provider_clients_.end()) { |
| 863 // For now we do no queueing for messages sent to nonexistent / unattached | 863 // For now we do no queueing for messages sent to nonexistent / unattached |
| 864 // client. | 864 // client. |
| 865 return; | 865 return; |
| 866 } | 866 } |
| 867 | 867 |
| 868 blink::WebMessagePortChannelArray ports = | 868 blink::WebMessagePortChannelArray ports = |
| 869 WebMessagePortChannelImpl::CreatePorts( | 869 WebMessagePortChannelImpl::CreateFromMessagePorts(params.message_ports); |
| 870 params.message_ports, params.new_routing_ids, | |
| 871 base::ThreadTaskRunnerHandle::Get()); | |
| 872 | 870 |
| 873 found->second->dispatchMessageEvent( | 871 found->second->dispatchMessageEvent( |
| 874 WebServiceWorkerImpl::CreateHandle(worker), | 872 WebServiceWorkerImpl::CreateHandle(worker), |
| 875 blink::WebString::fromUTF16(params.message), ports); | 873 blink::WebString::fromUTF16(params.message), std::move(ports)); |
| 876 } | 874 } |
| 877 | 875 |
| 878 void ServiceWorkerDispatcher::AddServiceWorker( | 876 void ServiceWorkerDispatcher::AddServiceWorker( |
| 879 int handle_id, WebServiceWorkerImpl* worker) { | 877 int handle_id, WebServiceWorkerImpl* worker) { |
| 880 DCHECK(!base::ContainsKey(service_workers_, handle_id)); | 878 DCHECK(!base::ContainsKey(service_workers_, handle_id)); |
| 881 service_workers_[handle_id] = worker; | 879 service_workers_[handle_id] = worker; |
| 882 } | 880 } |
| 883 | 881 |
| 884 void ServiceWorkerDispatcher::RemoveServiceWorker(int handle_id) { | 882 void ServiceWorkerDispatcher::RemoveServiceWorker(int handle_id) { |
| 885 DCHECK(base::ContainsKey(service_workers_, handle_id)); | 883 DCHECK(base::ContainsKey(service_workers_, handle_id)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 905 return ServiceWorkerRegistrationHandleReference::Adopt( | 903 return ServiceWorkerRegistrationHandleReference::Adopt( |
| 906 info, thread_safe_sender_.get()); | 904 info, thread_safe_sender_.get()); |
| 907 } | 905 } |
| 908 | 906 |
| 909 std::unique_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( | 907 std::unique_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( |
| 910 const ServiceWorkerObjectInfo& info) { | 908 const ServiceWorkerObjectInfo& info) { |
| 911 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); | 909 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); |
| 912 } | 910 } |
| 913 | 911 |
| 914 } // namespace content | 912 } // namespace content |
| OLD | NEW |