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

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

Issue 7888024: Move handle dumpage to the renderer process (so that it works correctly) and factor out redundant... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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) 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"
11 #include "content/common/child_process_messages.h" 11 #include "content/common/child_process_messages.h"
12 #include "content/common/child_trace_message_filter.h" 12 #include "content/common/child_trace_message_filter.h"
13 #include "content/common/content_switches.h" 13 #include "content/common/content_switches.h"
14 #include "content/common/file_system/file_system_dispatcher.h" 14 #include "content/common/file_system/file_system_dispatcher.h"
15 #include "content/common/handle_enumerator.h"
15 #include "content/common/notification_service.h" 16 #include "content/common/notification_service.h"
16 #include "content/common/quota_dispatcher.h" 17 #include "content/common/quota_dispatcher.h"
17 #include "content/common/resource_dispatcher.h" 18 #include "content/common/resource_dispatcher.h"
18 #include "content/common/socket_stream_dispatcher.h" 19 #include "content/common/socket_stream_dispatcher.h"
19 #include "ipc/ipc_logging.h" 20 #include "ipc/ipc_logging.h"
20 #include "ipc/ipc_sync_channel.h" 21 #include "ipc/ipc_sync_channel.h"
21 #include "ipc/ipc_sync_message_filter.h" 22 #include "ipc/ipc_sync_message_filter.h"
22 #include "ipc/ipc_switches.h" 23 #include "ipc/ipc_switches.h"
23 #include "webkit/glue/webkit_glue.h" 24 #include "webkit/glue/webkit_glue.h"
24 25
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return true; 152 return true;
152 153
153 bool handled = true; 154 bool handled = true;
154 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) 155 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg)
155 IPC_MESSAGE_HANDLER(ChildProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown) 156 IPC_MESSAGE_HANDLER(ChildProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown)
156 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) 157 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown)
157 #if defined(IPC_MESSAGE_LOG_ENABLED) 158 #if defined(IPC_MESSAGE_LOG_ENABLED)
158 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, 159 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled,
159 OnSetIPCLoggingEnabled) 160 OnSetIPCLoggingEnabled)
160 #endif 161 #endif
162 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles)
161 IPC_MESSAGE_UNHANDLED(handled = false) 163 IPC_MESSAGE_UNHANDLED(handled = false)
162 IPC_END_MESSAGE_MAP() 164 IPC_END_MESSAGE_MAP()
163 165
164 if (handled) 166 if (handled)
165 return true; 167 return true;
166 168
167 if (msg.routing_id() == MSG_ROUTING_CONTROL) 169 if (msg.routing_id() == MSG_ROUTING_CONTROL)
168 return OnControlMessageReceived(msg); 170 return OnControlMessageReceived(msg);
169 171
170 return router_.OnMessageReceived(msg); 172 return router_.OnMessageReceived(msg);
(...skipping 13 matching lines...) Expand all
184 186
185 #if defined(IPC_MESSAGE_LOG_ENABLED) 187 #if defined(IPC_MESSAGE_LOG_ENABLED)
186 void ChildThread::OnSetIPCLoggingEnabled(bool enable) { 188 void ChildThread::OnSetIPCLoggingEnabled(bool enable) {
187 if (enable) 189 if (enable)
188 IPC::Logging::GetInstance()->Enable(); 190 IPC::Logging::GetInstance()->Enable();
189 else 191 else
190 IPC::Logging::GetInstance()->Disable(); 192 IPC::Logging::GetInstance()->Disable();
191 } 193 }
192 #endif // IPC_MESSAGE_LOG_ENABLED 194 #endif // IPC_MESSAGE_LOG_ENABLED
193 195
196 void ChildThread::OnDumpHandles() {
197 #if defined(OS_WIN)
198 scoped_refptr<content::HandleEnumerator> handle_enum(
199 new content::HandleEnumerator(
200 CommandLine::ForCurrentProcess()->HasSwitch(
201 switches::kAuditAllHandles)));
202 handle_enum->EnumerateHandles();
203 Send(new ChildProcessHostMsg_DumpHandlesDone);
204 return;
205 #endif
206
207 NOTIMPLEMENTED();
208 }
209
194 ChildThread* ChildThread::current() { 210 ChildThread* ChildThread::current() {
195 return ChildProcess::current()->main_thread(); 211 return ChildProcess::current()->main_thread();
196 } 212 }
197 213
198 void ChildThread::OnProcessFinalRelease() { 214 void ChildThread::OnProcessFinalRelease() {
199 if (on_channel_error_called_ || !check_with_browser_before_shutdown_) { 215 if (on_channel_error_called_ || !check_with_browser_before_shutdown_) {
200 MessageLoop::current()->Quit(); 216 MessageLoop::current()->Quit();
201 return; 217 return;
202 } 218 }
203 219
204 // The child process shutdown sequence is a request response based mechanism, 220 // The child process shutdown sequence is a request response based mechanism,
205 // where we send out an initial feeler request to the child process host 221 // where we send out an initial feeler request to the child process host
206 // instance in the browser to verify if it's ok to shutdown the child process. 222 // instance in the browser to verify if it's ok to shutdown the child process.
207 // The browser then sends back a response if it's ok to shutdown. 223 // The browser then sends back a response if it's ok to shutdown.
208 Send(new ChildProcessHostMsg_ShutdownRequest); 224 Send(new ChildProcessHostMsg_ShutdownRequest);
209 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698