| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 blink::WebURL WebServiceWorkerImpl::url() const { | 58 blink::WebURL WebServiceWorkerImpl::url() const { |
| 59 return handle_ref_->url(); | 59 return handle_ref_->url(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 blink::WebServiceWorkerState WebServiceWorkerImpl::state() const { | 62 blink::WebServiceWorkerState WebServiceWorkerImpl::state() const { |
| 63 return state_; | 63 return state_; |
| 64 } | 64 } |
| 65 | 65 |
| 66 blink::WebString WebServiceWorkerImpl::id() const { |
| 67 return blink::WebString::fromUTF8(handle_ref_->id()); |
| 68 } |
| 69 |
| 66 void WebServiceWorkerImpl::postMessage(const WebString& message, | 70 void WebServiceWorkerImpl::postMessage(const WebString& message, |
| 67 WebMessagePortChannelArray* channels) { | 71 WebMessagePortChannelArray* channels) { |
| 68 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessageToWorker( | 72 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessageToWorker( |
| 69 handle_ref_->handle_id(), | 73 handle_ref_->handle_id(), |
| 70 message, | 74 message, |
| 71 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels))); | 75 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels))); |
| 72 } | 76 } |
| 73 | 77 |
| 74 void WebServiceWorkerImpl::terminate() { | 78 void WebServiceWorkerImpl::terminate() { |
| 75 thread_safe_sender_->Send( | 79 thread_safe_sender_->Send( |
| 76 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id())); | 80 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id())); |
| 77 } | 81 } |
| 78 | 82 |
| 79 } // namespace content | 83 } // namespace content |
| OLD | NEW |