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

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

Issue 897563002: Unify the three places that patch font loading for PDFium on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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_impl.h"
11 #include "content/common/message_port_messages.h" 11 #include "content/common/message_port_messages.h"
12 #include "third_party/WebKit/public/platform/WebMessagePortChannelClient.h" 12 #include "third_party/WebKit/public/platform/WebMessagePortChannelClient.h"
13 #include "third_party/WebKit/public/platform/WebString.h" 13 #include "third_party/WebKit/public/platform/WebString.h"
14 14
15 using blink::WebMessagePortChannel; 15 using blink::WebMessagePortChannel;
16 using blink::WebMessagePortChannelArray; 16 using blink::WebMessagePortChannelArray;
17 using blink::WebMessagePortChannelClient; 17 using blink::WebMessagePortChannelClient;
18 using blink::WebString; 18 using blink::WebString;
19 19
20 namespace content { 20 namespace content {
(...skipping 28 matching lines...) Expand all
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()->GetRouter()->RemoveRoute(route_id_); 59 ChildThreadImpl::current()->GetRouter()->RemoveRoute(route_id_);
60 } 60 }
61 61
62 // static 62 // static
63 void WebMessagePortChannelImpl::CreatePair( 63 void WebMessagePortChannelImpl::CreatePair(
64 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, 64 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner,
65 blink::WebMessagePortChannel** channel1, 65 blink::WebMessagePortChannel** channel1,
66 blink::WebMessagePortChannel** channel2) { 66 blink::WebMessagePortChannel** channel2) {
67 WebMessagePortChannelImpl* impl1 = 67 WebMessagePortChannelImpl* impl1 =
68 new WebMessagePortChannelImpl(main_thread_task_runner); 68 new WebMessagePortChannelImpl(main_thread_task_runner);
69 WebMessagePortChannelImpl* impl2 = 69 WebMessagePortChannelImpl* impl2 =
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 if (route_id_ == MSG_ROUTING_NONE) { 164 if (route_id_ == MSG_ROUTING_NONE) {
165 DCHECK(message_port_id_ == MSG_ROUTING_NONE); 165 DCHECK(message_port_id_ == MSG_ROUTING_NONE);
166 Send(new MessagePortHostMsg_CreateMessagePort( 166 Send(new MessagePortHostMsg_CreateMessagePort(
167 &route_id_, &message_port_id_)); 167 &route_id_, &message_port_id_));
168 } else if (message_port_id_ != MSG_ROUTING_NONE) { 168 } else if (message_port_id_ != MSG_ROUTING_NONE) {
169 Send(new MessagePortHostMsg_ReleaseMessages(message_port_id_)); 169 Send(new MessagePortHostMsg_ReleaseMessages(message_port_id_));
170 } 170 }
171 171
172 ChildThread::current()->GetRouter()->AddRoute(route_id_, this); 172 ChildThreadImpl::current()->GetRouter()->AddRoute(route_id_, this);
173 } 173 }
174 174
175 void WebMessagePortChannelImpl::Entangle( 175 void WebMessagePortChannelImpl::Entangle(
176 scoped_refptr<WebMessagePortChannelImpl> channel) { 176 scoped_refptr<WebMessagePortChannelImpl> channel) {
177 // The message port ids might not be set up yet, if this channel wasn't 177 // The message port ids might not be set up yet, if this channel wasn't
178 // created on the main thread. So need to wait until we're on the main thread 178 // created on the main thread. So need to wait until we're on the main thread
179 // before getting the other message port id. 179 // before getting the other message port id.
180 if (!main_thread_task_runner_->BelongsToCurrentThread()) { 180 if (!main_thread_task_runner_->BelongsToCurrentThread()) {
181 main_thread_task_runner_->PostTask( 181 main_thread_task_runner_->PostTask(
182 FROM_HERE, 182 FROM_HERE,
(...skipping 26 matching lines...) Expand all
209 209
210 void WebMessagePortChannelImpl::Send(IPC::Message* message) { 210 void WebMessagePortChannelImpl::Send(IPC::Message* message) {
211 if (!main_thread_task_runner_->BelongsToCurrentThread()) { 211 if (!main_thread_task_runner_->BelongsToCurrentThread()) {
212 DCHECK(!message->is_sync()); 212 DCHECK(!message->is_sync());
213 main_thread_task_runner_->PostTask( 213 main_thread_task_runner_->PostTask(
214 FROM_HERE, 214 FROM_HERE,
215 base::Bind(&WebMessagePortChannelImpl::Send, this, message)); 215 base::Bind(&WebMessagePortChannelImpl::Send, this, message));
216 return; 216 return;
217 } 217 }
218 218
219 ChildThread::current()->GetRouter()->Send(message); 219 ChildThreadImpl::current()->GetRouter()->Send(message);
220 } 220 }
221 221
222 bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { 222 bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) {
223 bool handled = true; 223 bool handled = true;
224 IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) 224 IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message)
225 IPC_MESSAGE_HANDLER(MessagePortMsg_Message, OnMessage) 225 IPC_MESSAGE_HANDLER(MessagePortMsg_Message, OnMessage)
226 IPC_MESSAGE_HANDLER(MessagePortMsg_MessagesQueued, OnMessagesQueued) 226 IPC_MESSAGE_HANDLER(MessagePortMsg_MessagesQueued, OnMessagesQueued)
227 IPC_MESSAGE_UNHANDLED(handled = false) 227 IPC_MESSAGE_UNHANDLED(handled = false)
228 IPC_END_MESSAGE_MAP() 228 IPC_END_MESSAGE_MAP()
229 return handled; 229 return handled;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 Release(); 280 Release();
281 ChildProcess::current()->ReleaseProcess(); 281 ChildProcess::current()->ReleaseProcess();
282 } 282 }
283 283
284 WebMessagePortChannelImpl::Message::Message() {} 284 WebMessagePortChannelImpl::Message::Message() {}
285 285
286 WebMessagePortChannelImpl::Message::~Message() {} 286 WebMessagePortChannelImpl::Message::~Message() {}
287 287
288 } // namespace content 288 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698