Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/tracked_objects.h" | 12 #include "base/tracked_objects.h" |
| 13 #include "content/common/child_process.h" | 13 #include "content/common/child_process.h" |
| 14 #include "content/common/child_process_messages.h" | 14 #include "content/common/child_process_messages.h" |
| 15 #include "content/common/child_trace_message_filter.h" | 15 #include "content/common/child_trace_message_filter.h" |
| 16 #include "content/common/file_system/file_system_dispatcher.h" | 16 #include "content/common/file_system/file_system_dispatcher.h" |
| 17 #include "content/common/quota_dispatcher.h" | 17 #include "content/common/quota_dispatcher.h" |
| 18 #include "content/common/resource_dispatcher.h" | 18 #include "content/common/resource_dispatcher.h" |
| 19 #include "content/common/socket_stream_dispatcher.h" | 19 #include "content/common/socket_stream_dispatcher.h" |
| 20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
| 21 #include "ipc/ipc_logging.h" | 21 #include "ipc/ipc_logging.h" |
| 22 #include "ipc/ipc_sync_channel.h" | 22 #include "ipc/ipc_sync_channel.h" |
| 23 #include "ipc/ipc_sync_message_filter.h" | 23 #include "ipc/ipc_sync_message_filter.h" |
| 24 #include "ipc/ipc_switches.h" | 24 #include "ipc/ipc_switches.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | |
|
jam
2012/02/11 02:32:07
nit: not needed
dgrogan
2012/02/11 03:03:26
Done.
| |
| 25 #include "webkit/glue/webkit_glue.h" | 26 #include "webkit/glue/webkit_glue.h" |
| 26 | 27 |
| 27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 28 #include "content/common/handle_enumerator_win.h" | 29 #include "content/common/handle_enumerator_win.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 ChildThread::ChildThread() { | 32 ChildThread::ChildThread() { |
| 32 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 33 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 33 switches::kProcessChannelID); | 34 switches::kProcessChannelID); |
| 34 Init(); | 35 Init(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 return; | 246 return; |
| 246 #endif | 247 #endif |
| 247 | 248 |
| 248 NOTIMPLEMENTED(); | 249 NOTIMPLEMENTED(); |
| 249 } | 250 } |
| 250 | 251 |
| 251 ChildThread* ChildThread::current() { | 252 ChildThread* ChildThread::current() { |
| 252 return ChildProcess::current()->main_thread(); | 253 return ChildProcess::current()->main_thread(); |
| 253 } | 254 } |
| 254 | 255 |
| 256 bool ChildThread::IsWebFrameValid(WebKit::WebFrame* frame) { | |
| 257 // Return false so that it is overridden in any process in which it is used. | |
| 258 return false; | |
| 259 } | |
| 260 | |
| 255 void ChildThread::OnProcessFinalRelease() { | 261 void ChildThread::OnProcessFinalRelease() { |
| 256 if (on_channel_error_called_) { | 262 if (on_channel_error_called_) { |
| 257 MessageLoop::current()->Quit(); | 263 MessageLoop::current()->Quit(); |
| 258 return; | 264 return; |
| 259 } | 265 } |
| 260 | 266 |
| 261 // The child process shutdown sequence is a request response based mechanism, | 267 // The child process shutdown sequence is a request response based mechanism, |
| 262 // where we send out an initial feeler request to the child process host | 268 // where we send out an initial feeler request to the child process host |
| 263 // instance in the browser to verify if it's ok to shutdown the child process. | 269 // instance in the browser to verify if it's ok to shutdown the child process. |
| 264 // The browser then sends back a response if it's ok to shutdown. This avoids | 270 // The browser then sends back a response if it's ok to shutdown. This avoids |
| 265 // race conditions if the process refcount is 0 but there's an IPC message | 271 // race conditions if the process refcount is 0 but there's an IPC message |
| 266 // inflight that would addref it. | 272 // inflight that would addref it. |
| 267 Send(new ChildProcessHostMsg_ShutdownRequest); | 273 Send(new ChildProcessHostMsg_ShutdownRequest); |
| 268 } | 274 } |
| OLD | NEW |