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

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

Issue 198073003: Remove some content_child dependency from content_common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d4f3d343 Initial. 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.h ('k') | content/child/webmessageportchannel_impl.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/child_thread.h" 5 #include "content/child/child_thread.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 void QuitMainThreadMessageLoop() { 187 void QuitMainThreadMessageLoop() {
188 base::MessageLoop::current()->Quit(); 188 base::MessageLoop::current()->Quit();
189 } 189 }
190 190
191 #endif 191 #endif
192 192
193 } // namespace 193 } // namespace
194 194
195 ChildThread::ChildThread() 195 ChildThread::ChildThread()
196 : channel_connected_factory_(this), 196 : router_(this),
197 channel_connected_factory_(this),
197 in_browser_process_(false) { 198 in_browser_process_(false) {
198 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 199 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
199 switches::kProcessChannelID); 200 switches::kProcessChannelID);
200 Init(); 201 Init();
201 } 202 }
202 203
203 ChildThread::ChildThread(const std::string& channel_name) 204 ChildThread::ChildThread(const std::string& channel_name)
204 : channel_name_(channel_name), 205 : channel_name_(channel_name),
206 router_(this),
205 channel_connected_factory_(this), 207 channel_connected_factory_(this),
206 in_browser_process_(true) { 208 in_browser_process_(true) {
207 Init(); 209 Init();
208 } 210 }
209 211
210 void ChildThread::Init() { 212 void ChildThread::Init() {
211 g_lazy_tls.Pointer()->Set(this); 213 g_lazy_tls.Pointer()->Set(this);
212 on_channel_error_called_ = false; 214 on_channel_error_called_ = false;
213 message_loop_ = base::MessageLoop::current(); 215 message_loop_ = base::MessageLoop::current();
214 #ifdef IPC_MESSAGE_LOG_ENABLED 216 #ifdef IPC_MESSAGE_LOG_ENABLED
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 bool ChildThread::Send(IPC::Message* msg) { 344 bool ChildThread::Send(IPC::Message* msg) {
343 DCHECK(base::MessageLoop::current() == message_loop()); 345 DCHECK(base::MessageLoop::current() == message_loop());
344 if (!channel_) { 346 if (!channel_) {
345 delete msg; 347 delete msg;
346 return false; 348 return false;
347 } 349 }
348 350
349 return channel_->Send(msg); 351 return channel_->Send(msg);
350 } 352 }
351 353
352 void ChildThread::AddRoute(int32 routing_id, IPC::Listener* listener) {
353 DCHECK(base::MessageLoop::current() == message_loop());
354
355 router_.AddRoute(routing_id, listener);
356 }
357
358 void ChildThread::RemoveRoute(int32 routing_id) {
359 DCHECK(base::MessageLoop::current() == message_loop());
360
361 router_.RemoveRoute(routing_id);
362 }
piman 2014/03/13 00:58:05 nit: we could keep those calls for the DCHECKs. Al
363
364 webkit_glue::ResourceLoaderBridge* ChildThread::CreateBridge( 354 webkit_glue::ResourceLoaderBridge* ChildThread::CreateBridge(
365 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { 355 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
366 return resource_dispatcher()->CreateBridge(request_info); 356 return resource_dispatcher()->CreateBridge(request_info);
367 } 357 }
368 358
369 base::SharedMemory* ChildThread::AllocateSharedMemory(size_t buf_size) { 359 base::SharedMemory* ChildThread::AllocateSharedMemory(size_t buf_size) {
370 return AllocateSharedMemory(buf_size, this); 360 return AllocateSharedMemory(buf_size, this);
371 } 361 }
372 362
373 // static 363 // static
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // inflight that would addref it. 522 // inflight that would addref it.
533 Send(new ChildProcessHostMsg_ShutdownRequest); 523 Send(new ChildProcessHostMsg_ShutdownRequest);
534 } 524 }
535 525
536 void ChildThread::EnsureConnected() { 526 void ChildThread::EnsureConnected() {
537 VLOG(0) << "ChildThread::EnsureConnected()"; 527 VLOG(0) << "ChildThread::EnsureConnected()";
538 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 528 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
539 } 529 }
540 530
541 } // namespace content 531 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread.h ('k') | content/child/webmessageportchannel_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698