OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_process_host.h" | 5 #include "chrome/common/child_process_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/common/child_process_info.h" | 10 #include "chrome/common/child_process_info.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 bool ChildProcessHost::CreateChannel() { | 105 bool ChildProcessHost::CreateChannel() { |
106 channel_id_ = ChildProcessInfo::GenerateRandomChannelID(this); | 106 channel_id_ = ChildProcessInfo::GenerateRandomChannelID(this); |
107 channel_.reset(new IPC::Channel( | 107 channel_.reset(new IPC::Channel( |
108 channel_id_, IPC::Channel::MODE_SERVER, &listener_)); | 108 channel_id_, IPC::Channel::MODE_SERVER, &listener_)); |
109 if (!channel_->Connect()) | 109 if (!channel_->Connect()) |
110 return false; | 110 return false; |
111 | 111 |
112 // Make sure these messages get sent first. | 112 // Make sure these messages get sent first. |
113 #if defined(IPC_MESSAGE_LOG_ENABLED) | 113 #if defined(IPC_MESSAGE_LOG_ENABLED) |
114 bool enabled = IPC::Logging::current()->Enabled(); | 114 bool enabled = IPC::Logging::GetInstance()->Enabled(); |
115 SendOnChannel(new PluginProcessMsg_SetIPCLoggingEnabled(enabled)); | 115 SendOnChannel(new PluginProcessMsg_SetIPCLoggingEnabled(enabled)); |
116 #endif | 116 #endif |
117 | 117 |
118 SendOnChannel(new PluginProcessMsg_AskBeforeShutdown()); | 118 SendOnChannel(new PluginProcessMsg_AskBeforeShutdown()); |
119 | 119 |
120 opening_channel_ = true; | 120 opening_channel_ = true; |
121 | 121 |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
(...skipping 17 matching lines...) Expand all Loading... |
142 return false; | 142 return false; |
143 } | 143 } |
144 | 144 |
145 ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) | 145 ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) |
146 : host_(host) { | 146 : host_(host) { |
147 } | 147 } |
148 | 148 |
149 void ChildProcessHost::ListenerHook::OnMessageReceived( | 149 void ChildProcessHost::ListenerHook::OnMessageReceived( |
150 const IPC::Message& msg) { | 150 const IPC::Message& msg) { |
151 #ifdef IPC_MESSAGE_LOG_ENABLED | 151 #ifdef IPC_MESSAGE_LOG_ENABLED |
152 IPC::Logging* logger = IPC::Logging::current(); | 152 IPC::Logging* logger = IPC::Logging::GetInstance(); |
153 if (msg.type() == IPC_LOGGING_ID) { | 153 if (msg.type() == IPC_LOGGING_ID) { |
154 logger->OnReceivedLoggingMessage(msg); | 154 logger->OnReceivedLoggingMessage(msg); |
155 return; | 155 return; |
156 } | 156 } |
157 | 157 |
158 if (logger->Enabled()) | 158 if (logger->Enabled()) |
159 logger->OnPreDispatchMessage(msg); | 159 logger->OnPreDispatchMessage(msg); |
160 #endif | 160 #endif |
161 | 161 |
162 bool handled = host_->InterceptMessageFromChild(msg); | 162 bool handled = host_->InterceptMessageFromChild(msg); |
(...skipping 24 matching lines...) Expand all Loading... |
187 host_->opening_channel_ = false; | 187 host_->opening_channel_ = false; |
188 host_->OnChannelError(); | 188 host_->OnChannelError(); |
189 | 189 |
190 // This will delete host_, which will also destroy this! | 190 // This will delete host_, which will also destroy this! |
191 host_->OnChildDied(); | 191 host_->OnChildDied(); |
192 } | 192 } |
193 | 193 |
194 void ChildProcessHost::ForceShutdown() { | 194 void ChildProcessHost::ForceShutdown() { |
195 SendOnChannel(new PluginProcessMsg_Shutdown()); | 195 SendOnChannel(new PluginProcessMsg_Shutdown()); |
196 } | 196 } |
OLD | NEW |