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

Side by Side Diff: content/child/webmessageportchannel_impl.cc

Issue 198073003: Remove some content_child dependency from content_common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ffd442cb fix for bots barfing on clang style checks Created 6 years, 9 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
« no previous file with comments | « content/child/child_thread.cc ('k') | content/common/gpu/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/webmessageportchannel_impl.h" 5 #include "content/child/webmessageportchannel_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "content/child/child_process.h" 9 #include "content/child/child_process.h"
10 #include "content/child/child_thread.h" 10 #include "content/child/child_thread.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 for (size_t i = 0; i < channel_array.size(); i++) { 49 for (size_t i = 0; i < channel_array.size(); i++) {
50 channel_array[i]->destroy(); 50 channel_array[i]->destroy();
51 } 51 }
52 message_queue_.pop(); 52 message_queue_.pop();
53 } 53 }
54 54
55 if (message_port_id_ != MSG_ROUTING_NONE) 55 if (message_port_id_ != MSG_ROUTING_NONE)
56 Send(new MessagePortHostMsg_DestroyMessagePort(message_port_id_)); 56 Send(new MessagePortHostMsg_DestroyMessagePort(message_port_id_));
57 57
58 if (route_id_ != MSG_ROUTING_NONE) 58 if (route_id_ != MSG_ROUTING_NONE)
59 ChildThread::current()->RemoveRoute(route_id_); 59 ChildThread::current()->GetRouter()->RemoveRoute(route_id_);
60 } 60 }
61 61
62 void WebMessagePortChannelImpl::setClient(WebMessagePortChannelClient* client) { 62 void WebMessagePortChannelImpl::setClient(WebMessagePortChannelClient* client) {
63 // Must lock here since client_ is called on the main thread. 63 // Must lock here since client_ is called on the main thread.
64 base::AutoLock auto_lock(lock_); 64 base::AutoLock auto_lock(lock_);
65 client_ = client; 65 client_ = client;
66 } 66 }
67 67
68 void WebMessagePortChannelImpl::destroy() { 68 void WebMessagePortChannelImpl::destroy() {
69 setClient(NULL); 69 setClient(NULL);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 FROM_HERE, base::Bind(&WebMessagePortChannelImpl::Init, this)); 142 FROM_HERE, base::Bind(&WebMessagePortChannelImpl::Init, this));
143 return; 143 return;
144 } 144 }
145 145
146 if (route_id_ == MSG_ROUTING_NONE) { 146 if (route_id_ == MSG_ROUTING_NONE) {
147 DCHECK(message_port_id_ == MSG_ROUTING_NONE); 147 DCHECK(message_port_id_ == MSG_ROUTING_NONE);
148 Send(new MessagePortHostMsg_CreateMessagePort( 148 Send(new MessagePortHostMsg_CreateMessagePort(
149 &route_id_, &message_port_id_)); 149 &route_id_, &message_port_id_));
150 } 150 }
151 151
152 ChildThread::current()->AddRoute(route_id_, this); 152 ChildThread::current()->GetRouter()->AddRoute(route_id_, this);
153 } 153 }
154 154
155 void WebMessagePortChannelImpl::Entangle( 155 void WebMessagePortChannelImpl::Entangle(
156 scoped_refptr<WebMessagePortChannelImpl> channel) { 156 scoped_refptr<WebMessagePortChannelImpl> channel) {
157 if (!child_thread_loop_->BelongsToCurrentThread()) { 157 if (!child_thread_loop_->BelongsToCurrentThread()) {
158 child_thread_loop_->PostTask( 158 child_thread_loop_->PostTask(
159 FROM_HERE, 159 FROM_HERE,
160 base::Bind(&WebMessagePortChannelImpl::Entangle, this, channel)); 160 base::Bind(&WebMessagePortChannelImpl::Entangle, this, channel));
161 return; 161 return;
162 } 162 }
(...skipping 23 matching lines...) Expand all
186 186
187 void WebMessagePortChannelImpl::Send(IPC::Message* message) { 187 void WebMessagePortChannelImpl::Send(IPC::Message* message) {
188 if (!child_thread_loop_->BelongsToCurrentThread()) { 188 if (!child_thread_loop_->BelongsToCurrentThread()) {
189 DCHECK(!message->is_sync()); 189 DCHECK(!message->is_sync());
190 child_thread_loop_->PostTask( 190 child_thread_loop_->PostTask(
191 FROM_HERE, 191 FROM_HERE,
192 base::Bind(&WebMessagePortChannelImpl::Send, this, message)); 192 base::Bind(&WebMessagePortChannelImpl::Send, this, message));
193 return; 193 return;
194 } 194 }
195 195
196 ChildThread::current()->Send(message); 196 ChildThread::current()->GetRouter()->Send(message);
197 } 197 }
198 198
199 bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { 199 bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) {
200 bool handled = true; 200 bool handled = true;
201 IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) 201 IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message)
202 IPC_MESSAGE_HANDLER(MessagePortMsg_Message, OnMessage) 202 IPC_MESSAGE_HANDLER(MessagePortMsg_Message, OnMessage)
203 IPC_MESSAGE_HANDLER(MessagePortMsg_MessagesQueued, OnMessagesQueued) 203 IPC_MESSAGE_HANDLER(MessagePortMsg_MessagesQueued, OnMessagesQueued)
204 IPC_MESSAGE_UNHANDLED(handled = false) 204 IPC_MESSAGE_UNHANDLED(handled = false)
205 IPC_END_MESSAGE_MAP() 205 IPC_END_MESSAGE_MAP()
206 return handled; 206 return handled;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 Release(); 256 Release();
257 ChildProcess::current()->ReleaseProcess(); 257 ChildProcess::current()->ReleaseProcess();
258 } 258 }
259 259
260 WebMessagePortChannelImpl::Message::Message() {} 260 WebMessagePortChannelImpl::Message::Message() {}
261 261
262 WebMessagePortChannelImpl::Message::~Message() {} 262 WebMessagePortChannelImpl::Message::~Message() {}
263 263
264 } // namespace content 264 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread.cc ('k') | content/common/gpu/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698