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

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

Issue 2777983005: Reland "Add enable_ipc_logging build argument" (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_process_host_impl.h" 5 #include "content/common/child_process_host_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 bool ChildProcessHostImpl::InitChannel() { 152 bool ChildProcessHostImpl::InitChannel() {
153 if (!channel_->Connect()) 153 if (!channel_->Connect())
154 return false; 154 return false;
155 155
156 for (size_t i = 0; i < filters_.size(); ++i) 156 for (size_t i = 0; i < filters_.size(); ++i)
157 filters_[i]->OnFilterAdded(channel_.get()); 157 filters_[i]->OnFilterAdded(channel_.get());
158 delegate_->OnChannelInitialized(channel_.get()); 158 delegate_->OnChannelInitialized(channel_.get());
159 159
160 // Make sure these messages get sent first. 160 // Make sure these messages get sent first.
161 #if defined(IPC_MESSAGE_LOG_ENABLED) 161 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
162 bool enabled = IPC::Logging::GetInstance()->Enabled(); 162 bool enabled = IPC::Logging::GetInstance()->Enabled();
163 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled)); 163 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled));
164 #endif 164 #endif
165 165
166 opening_channel_ = true; 166 opening_channel_ = true;
167 167
168 return true; 168 return true;
169 } 169 }
170 170
171 bool ChildProcessHostImpl::IsChannelOpening() { 171 bool ChildProcessHostImpl::IsChannelOpening() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 // The hash value is incremented so that the tracing id is never equal to 208 // The hash value is incremented so that the tracing id is never equal to
209 // MemoryDumpManager::kInvalidTracingProcessId. 209 // MemoryDumpManager::kInvalidTracingProcessId.
210 return static_cast<uint64_t>( 210 return static_cast<uint64_t>(
211 base::Hash(reinterpret_cast<const char*>(&child_process_id), 211 base::Hash(reinterpret_cast<const char*>(&child_process_id),
212 sizeof(child_process_id))) + 212 sizeof(child_process_id))) +
213 1; 213 1;
214 } 214 }
215 215
216 bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { 216 bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) {
217 #ifdef IPC_MESSAGE_LOG_ENABLED 217 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
218 IPC::Logging* logger = IPC::Logging::GetInstance(); 218 IPC::Logging* logger = IPC::Logging::GetInstance();
219 if (msg.type() == IPC_LOGGING_ID) { 219 if (msg.type() == IPC_LOGGING_ID) {
220 logger->OnReceivedLoggingMessage(msg); 220 logger->OnReceivedLoggingMessage(msg);
221 return true; 221 return true;
222 } 222 }
223 223
224 if (logger->Enabled()) 224 if (logger->Enabled())
225 logger->OnPreDispatchMessage(msg); 225 logger->OnPreDispatchMessage(msg);
226 #endif 226 #endif
227 227
(...skipping 10 matching lines...) Expand all
238 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg) 238 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg)
239 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 239 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
240 OnShutdownRequest) 240 OnShutdownRequest)
241 IPC_MESSAGE_UNHANDLED(handled = false) 241 IPC_MESSAGE_UNHANDLED(handled = false)
242 IPC_END_MESSAGE_MAP() 242 IPC_END_MESSAGE_MAP()
243 243
244 if (!handled) 244 if (!handled)
245 handled = delegate_->OnMessageReceived(msg); 245 handled = delegate_->OnMessageReceived(msg);
246 } 246 }
247 247
248 #ifdef IPC_MESSAGE_LOG_ENABLED 248 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
249 if (logger->Enabled()) 249 if (logger->Enabled())
250 logger->OnPostDispatchMessage(msg); 250 logger->OnPostDispatchMessage(msg);
251 #endif 251 #endif
252 return handled; 252 return handled;
253 } 253 }
254 254
255 void ChildProcessHostImpl::OnChannelConnected(int32_t peer_pid) { 255 void ChildProcessHostImpl::OnChannelConnected(int32_t peer_pid) {
256 if (!peer_process_.IsValid()) { 256 if (!peer_process_.IsValid()) {
257 peer_process_ = base::Process::OpenWithExtraPrivileges(peer_pid); 257 peer_process_ = base::Process::OpenWithExtraPrivileges(peer_pid);
258 if (!peer_process_.IsValid()) 258 if (!peer_process_.IsValid())
(...skipping 20 matching lines...) Expand all
279 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { 279 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
280 delegate_->OnBadMessageReceived(message); 280 delegate_->OnBadMessageReceived(message);
281 } 281 }
282 282
283 void ChildProcessHostImpl::OnShutdownRequest() { 283 void ChildProcessHostImpl::OnShutdownRequest() {
284 if (delegate_->CanShutdown()) 284 if (delegate_->CanShutdown())
285 Send(new ChildProcessMsg_Shutdown()); 285 Send(new ChildProcessMsg_Shutdown());
286 } 286 }
287 287
288 } // namespace content 288 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698