OLD | NEW |
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/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 "chrome/common/child_process.h" | 10 #include "chrome/common/child_process.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/file_system/file_system_dispatcher.h" | 12 #include "chrome/common/file_system/file_system_dispatcher.h" |
13 #include "chrome/common/notification_service.h" | |
14 #include "chrome/common/plugin_messages.h" | |
15 #include "chrome/common/socket_stream_dispatcher.h" | 13 #include "chrome/common/socket_stream_dispatcher.h" |
| 14 #include "content/common/child_process_messages.h" |
| 15 #include "content/common/notification_service.h" |
16 #include "content/common/resource_dispatcher.h" | 16 #include "content/common/resource_dispatcher.h" |
17 #include "ipc/ipc_logging.h" | 17 #include "ipc/ipc_logging.h" |
18 #include "ipc/ipc_message.h" | |
19 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
20 #include "ipc/ipc_sync_message_filter.h" | 19 #include "ipc/ipc_sync_message_filter.h" |
21 #include "ipc/ipc_switches.h" | 20 #include "ipc/ipc_switches.h" |
22 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
23 | 22 |
24 ChildThread::ChildThread() { | 23 ChildThread::ChildThread() { |
25 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 24 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
26 switches::kProcessChannelID); | 25 switches::kProcessChannelID); |
27 Init(); | 26 Init(); |
28 } | 27 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Resource responses are sent to the resource dispatcher. | 142 // Resource responses are sent to the resource dispatcher. |
144 if (resource_dispatcher_->OnMessageReceived(msg)) | 143 if (resource_dispatcher_->OnMessageReceived(msg)) |
145 return true; | 144 return true; |
146 if (socket_stream_dispatcher_->OnMessageReceived(msg)) | 145 if (socket_stream_dispatcher_->OnMessageReceived(msg)) |
147 return true; | 146 return true; |
148 if (file_system_dispatcher_->OnMessageReceived(msg)) | 147 if (file_system_dispatcher_->OnMessageReceived(msg)) |
149 return true; | 148 return true; |
150 | 149 |
151 bool handled = true; | 150 bool handled = true; |
152 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) | 151 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) |
153 IPC_MESSAGE_HANDLER(PluginProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown) | 152 IPC_MESSAGE_HANDLER(ChildProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown) |
154 IPC_MESSAGE_HANDLER(PluginProcessMsg_Shutdown, OnShutdown) | 153 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) |
155 #if defined(IPC_MESSAGE_LOG_ENABLED) | 154 #if defined(IPC_MESSAGE_LOG_ENABLED) |
156 IPC_MESSAGE_HANDLER(PluginProcessMsg_SetIPCLoggingEnabled, | 155 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, |
157 OnSetIPCLoggingEnabled) | 156 OnSetIPCLoggingEnabled) |
158 #endif | 157 #endif |
159 IPC_MESSAGE_UNHANDLED(handled = false) | 158 IPC_MESSAGE_UNHANDLED(handled = false) |
160 IPC_END_MESSAGE_MAP() | 159 IPC_END_MESSAGE_MAP() |
161 | 160 |
162 if (handled) | 161 if (handled) |
163 return true; | 162 return true; |
164 | 163 |
165 if (msg.routing_id() == MSG_ROUTING_CONTROL) | 164 if (msg.routing_id() == MSG_ROUTING_CONTROL) |
166 return OnControlMessageReceived(msg); | 165 return OnControlMessageReceived(msg); |
(...skipping 29 matching lines...) Expand all Loading... |
196 void ChildThread::OnProcessFinalRelease() { | 195 void ChildThread::OnProcessFinalRelease() { |
197 if (on_channel_error_called_ || !check_with_browser_before_shutdown_) { | 196 if (on_channel_error_called_ || !check_with_browser_before_shutdown_) { |
198 MessageLoop::current()->Quit(); | 197 MessageLoop::current()->Quit(); |
199 return; | 198 return; |
200 } | 199 } |
201 | 200 |
202 // The child process shutdown sequence is a request response based mechanism, | 201 // The child process shutdown sequence is a request response based mechanism, |
203 // where we send out an initial feeler request to the child process host | 202 // where we send out an initial feeler request to the child process host |
204 // instance in the browser to verify if it's ok to shutdown the child process. | 203 // instance in the browser to verify if it's ok to shutdown the child process. |
205 // The browser then sends back a response if it's ok to shutdown. | 204 // The browser then sends back a response if it's ok to shutdown. |
206 Send(new PluginProcessHostMsg_ShutdownRequest); | 205 Send(new ChildProcessHostMsg_ShutdownRequest); |
207 } | 206 } |
OLD | NEW |