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" |
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/notification_service.h" | 15 #include "content/common/notification_service.h" |
16 #include "content/common/quota_dispatcher.h" | 16 #include "content/common/quota_dispatcher.h" |
17 #include "content/common/resource_dispatcher.h" | 17 #include "content/common/resource_dispatcher.h" |
18 #include "content/common/set_ipc_fuzzing.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 |
25 ChildThread::ChildThread() { | 26 ChildThread::ChildThread() { |
26 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 27 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
27 switches::kProcessChannelID); | 28 switches::kProcessChannelID); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 sync_message_filter_ = | 60 sync_message_filter_ = |
60 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 61 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
61 channel_->AddFilter(sync_message_filter_.get()); | 62 channel_->AddFilter(sync_message_filter_.get()); |
62 | 63 |
63 #if !defined(NACL_WIN64) | 64 #if !defined(NACL_WIN64) |
64 // This brings in a depenency on gpu, which isn't linked in with NaCl's win64 | 65 // This brings in a depenency on gpu, which isn't linked in with NaCl's win64 |
65 // build. | 66 // build. |
66 channel_->AddFilter(new ChildTraceMessageFilter()); | 67 channel_->AddFilter(new ChildTraceMessageFilter()); |
67 #endif | 68 #endif |
68 | 69 |
70 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
71 switches::kEnableIPCFuzzing)) { | |
72 SetIPCFuzzing(channel_.get()); | |
jam
2011/04/27 21:58:07
the code that you added in content should be in ch
| |
73 } | |
74 | |
69 // When running in unit tests, there is already a NotificationService object. | 75 // When running in unit tests, there is already a NotificationService object. |
70 // Since only one can exist at a time per thread, check first. | 76 // Since only one can exist at a time per thread, check first. |
71 if (!NotificationService::current()) | 77 if (!NotificationService::current()) |
72 notification_service_.reset(new NotificationService); | 78 notification_service_.reset(new NotificationService); |
73 } | 79 } |
74 | 80 |
75 ChildThread::~ChildThread() { | 81 ChildThread::~ChildThread() { |
76 #ifdef IPC_MESSAGE_LOG_ENABLED | 82 #ifdef IPC_MESSAGE_LOG_ENABLED |
77 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 83 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
78 #endif | 84 #endif |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 MessageLoop::current()->Quit(); | 211 MessageLoop::current()->Quit(); |
206 return; | 212 return; |
207 } | 213 } |
208 | 214 |
209 // The child process shutdown sequence is a request response based mechanism, | 215 // The child process shutdown sequence is a request response based mechanism, |
210 // where we send out an initial feeler request to the child process host | 216 // where we send out an initial feeler request to the child process host |
211 // instance in the browser to verify if it's ok to shutdown the child process. | 217 // instance in the browser to verify if it's ok to shutdown the child process. |
212 // The browser then sends back a response if it's ok to shutdown. | 218 // The browser then sends back a response if it's ok to shutdown. |
213 Send(new ChildProcessHostMsg_ShutdownRequest); | 219 Send(new ChildProcessHostMsg_ShutdownRequest); |
214 } | 220 } |
OLD | NEW |