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/web_service_worker_impl.h" | 5 #include "content/child/service_worker/web_service_worker_impl.h" |
6 | 6 |
7 #include "content/child/service_worker/service_worker_dispatcher.h" | 7 #include "content/child/service_worker/service_worker_dispatcher.h" |
8 #include "content/child/service_worker/service_worker_handle_reference.h" | 8 #include "content/child/service_worker/service_worker_handle_reference.h" |
9 #include "content/child/thread_safe_sender.h" | 9 #include "content/child/thread_safe_sender.h" |
10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void WebServiceWorkerImpl::postMessage(const WebString& message, | 84 void WebServiceWorkerImpl::postMessage(const WebString& message, |
85 WebMessagePortChannelArray* channels) { | 85 WebMessagePortChannelArray* channels) { |
86 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessageToWorker( | 86 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessageToWorker( |
87 handle_ref_->handle_id(), | 87 handle_ref_->handle_id(), |
88 message, | 88 message, |
89 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels))); | 89 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels))); |
90 } | 90 } |
91 | 91 |
| 92 void WebServiceWorkerImpl::terminate() { |
| 93 thread_safe_sender_->Send( |
| 94 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id())); |
| 95 } |
| 96 |
92 void WebServiceWorkerImpl::CommitState(blink::WebServiceWorkerState new_state) { | 97 void WebServiceWorkerImpl::CommitState(blink::WebServiceWorkerState new_state) { |
93 DCHECK(proxy_); | 98 DCHECK(proxy_); |
94 DCHECK(proxy_->isReady()); | 99 DCHECK(proxy_->isReady()); |
95 state_ = new_state; | 100 state_ = new_state; |
96 proxy_->dispatchStateChangeEvent(); | 101 proxy_->dispatchStateChangeEvent(); |
97 } | 102 } |
98 | 103 |
99 } // namespace content | 104 } // namespace content |
OLD | NEW |