Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: content/child/service_worker/web_service_worker_impl.cc

Issue 246023007: Chromium-side plumbing for ServiceWorker -> Document postMessage (2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: message port threading fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 blink::WebURL WebServiceWorkerImpl::url() const { 88 blink::WebURL WebServiceWorkerImpl::url() const {
89 return handle_ref_->url(); 89 return handle_ref_->url();
90 } 90 }
91 91
92 blink::WebServiceWorkerState WebServiceWorkerImpl::state() const { 92 blink::WebServiceWorkerState WebServiceWorkerImpl::state() const {
93 return state_; 93 return state_;
94 } 94 }
95 95
96 void WebServiceWorkerImpl::postMessage(const WebString& message, 96 void WebServiceWorkerImpl::postMessage(const WebString& message,
97 WebMessagePortChannelArray* channels) { 97 WebMessagePortChannelArray* channels) {
98 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessage( 98 thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessageToWorker(
99 handle_ref_->handle_id(), 99 handle_ref_->handle_id(),
100 message, 100 message,
101 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels))); 101 WebMessagePortChannelImpl::ExtractMessagePortIDs(channels)));
102 } 102 }
103 103
104 void WebServiceWorkerImpl::ChangeState(blink::WebServiceWorkerState new_state) { 104 void WebServiceWorkerImpl::ChangeState(blink::WebServiceWorkerState new_state) {
105 DCHECK(proxy_); 105 DCHECK(proxy_);
106 DCHECK(proxy_->isReady()); 106 DCHECK(proxy_->isReady());
107 state_ = new_state; 107 state_ = new_state;
108 proxy_->dispatchStateChangeEvent(); 108 proxy_->dispatchStateChangeEvent();
109 } 109 }
110 110
111 } // namespace content 111 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698