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

Side by Side Diff: chrome/common/child_thread.cc

Issue 28090: Keeping track of whether WebKit is in the callstack using RenderThread doesn'... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/common/child_thread.h" 5 #include "chrome/common/child_thread.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/common/child_process.h" 9 #include "chrome/common/child_process.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/ipc_logging.h" 11 #include "chrome/common/ipc_logging.h"
12 #include "webkit/glue/webkit_glue.h" 12 #include "webkit/glue/webkit_glue.h"
13 13
14 ChildThread::ChildThread(Thread::Options options) 14 ChildThread::ChildThread(Thread::Options options)
15 : Thread("Chrome_ChildThread"), 15 : Thread("Chrome_ChildThread"),
16 owner_loop_(MessageLoop::current()), 16 owner_loop_(MessageLoop::current()),
17 in_send_(0),
18 options_(options) { 17 options_(options) {
19 DCHECK(owner_loop_); 18 DCHECK(owner_loop_);
20 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue( 19 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue(
21 switches::kProcessChannelID); 20 switches::kProcessChannelID);
22 21
23 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { 22 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) {
24 #if defined(OS_WIN) 23 #if defined(OS_WIN)
25 // TODO(port): calling this connects an, otherwise disconnected, subgraph 24 // TODO(port): calling this connects an, otherwise disconnected, subgraph
26 // of symbols, causing huge numbers of linker errors. 25 // of symbols, causing huge numbers of linker errors.
27 webkit_glue::SetUserAgent(WideToUTF8( 26 webkit_glue::SetUserAgent(WideToUTF8(
(...skipping 12 matching lines...) Expand all
40 void ChildThread::OnChannelError() { 39 void ChildThread::OnChannelError() {
41 owner_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 40 owner_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask());
42 } 41 }
43 42
44 bool ChildThread::Send(IPC::Message* msg) { 43 bool ChildThread::Send(IPC::Message* msg) {
45 if (!channel_.get()) { 44 if (!channel_.get()) {
46 delete msg; 45 delete msg;
47 return false; 46 return false;
48 } 47 }
49 48
50 in_send_++; 49 return channel_->Send(msg);
51 bool rv = channel_->Send(msg);
52 in_send_--;
53 return rv;
54 } 50 }
55 51
56 void ChildThread::AddRoute(int32 routing_id, IPC::Channel::Listener* listener) { 52 void ChildThread::AddRoute(int32 routing_id, IPC::Channel::Listener* listener) {
57 DCHECK(MessageLoop::current() == message_loop()); 53 DCHECK(MessageLoop::current() == message_loop());
58 54
59 router_.AddRoute(routing_id, listener); 55 router_.AddRoute(routing_id, listener);
60 } 56 }
61 57
62 void ChildThread::RemoveRoute(int32 routing_id) { 58 void ChildThread::RemoveRoute(int32 routing_id) {
63 DCHECK(MessageLoop::current() == message_loop()); 59 DCHECK(MessageLoop::current() == message_loop());
(...skipping 23 matching lines...) Expand all
87 } 83 }
88 84
89 void ChildThread::CleanUp() { 85 void ChildThread::CleanUp() {
90 #ifdef IPC_MESSAGE_LOG_ENABLED 86 #ifdef IPC_MESSAGE_LOG_ENABLED
91 IPC::Logging::current()->SetIPCSender(NULL); 87 IPC::Logging::current()->SetIPCSender(NULL);
92 #endif 88 #endif
93 // Need to destruct the SyncChannel to the browser before we go away because 89 // Need to destruct the SyncChannel to the browser before we go away because
94 // it caches a pointer to this thread. 90 // it caches a pointer to this thread.
95 channel_.reset(); 91 channel_.reset();
96 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698