OLD | NEW |
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/common/child_thread.h" | 5 #include "content/common/child_thread.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 ChildThread::ChildThread(const std::string& channel_name) | 35 ChildThread::ChildThread(const std::string& channel_name) |
36 : channel_name_(channel_name) { | 36 : channel_name_(channel_name) { |
37 Init(); | 37 Init(); |
38 } | 38 } |
39 | 39 |
40 void ChildThread::Init() { | 40 void ChildThread::Init() { |
41 check_with_browser_before_shutdown_ = false; | 41 check_with_browser_before_shutdown_ = false; |
42 on_channel_error_called_ = false; | 42 on_channel_error_called_ = false; |
43 message_loop_ = MessageLoop::current(); | 43 message_loop_ = MessageLoop::current(); |
44 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { | |
45 webkit_glue::SetUserAgent( | |
46 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
47 switches::kUserAgent)); | |
48 } | |
49 | |
50 channel_.reset(new IPC::SyncChannel(channel_name_, | 44 channel_.reset(new IPC::SyncChannel(channel_name_, |
51 IPC::Channel::MODE_CLIENT, this, | 45 IPC::Channel::MODE_CLIENT, this, |
52 ChildProcess::current()->io_message_loop_proxy(), true, | 46 ChildProcess::current()->io_message_loop_proxy(), true, |
53 ChildProcess::current()->GetShutDownEvent())); | 47 ChildProcess::current()->GetShutDownEvent())); |
54 #ifdef IPC_MESSAGE_LOG_ENABLED | 48 #ifdef IPC_MESSAGE_LOG_ENABLED |
55 IPC::Logging::GetInstance()->SetIPCSender(this); | 49 IPC::Logging::GetInstance()->SetIPCSender(this); |
56 #endif | 50 #endif |
57 | 51 |
58 resource_dispatcher_.reset(new ResourceDispatcher(this)); | 52 resource_dispatcher_.reset(new ResourceDispatcher(this)); |
59 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | 53 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 MessageLoop::current()->Quit(); | 213 MessageLoop::current()->Quit(); |
220 return; | 214 return; |
221 } | 215 } |
222 | 216 |
223 // The child process shutdown sequence is a request response based mechanism, | 217 // The child process shutdown sequence is a request response based mechanism, |
224 // where we send out an initial feeler request to the child process host | 218 // where we send out an initial feeler request to the child process host |
225 // instance in the browser to verify if it's ok to shutdown the child process. | 219 // instance in the browser to verify if it's ok to shutdown the child process. |
226 // The browser then sends back a response if it's ok to shutdown. | 220 // The browser then sends back a response if it's ok to shutdown. |
227 Send(new ChildProcessHostMsg_ShutdownRequest); | 221 Send(new ChildProcessHostMsg_ShutdownRequest); |
228 } | 222 } |
OLD | NEW |