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

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

Issue 2847003005: Reland "Add enable_ipc_logging build argument" (Closed)
Patch Set: Reland "Add enable_ipc_logging build argument" Created 3 years, 7 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 bool ChildProcessHostImpl::InitChannel() { 150 bool ChildProcessHostImpl::InitChannel() {
151 if (!channel_->Connect()) 151 if (!channel_->Connect())
152 return false; 152 return false;
153 153
154 for (size_t i = 0; i < filters_.size(); ++i) 154 for (size_t i = 0; i < filters_.size(); ++i)
155 filters_[i]->OnFilterAdded(channel_.get()); 155 filters_[i]->OnFilterAdded(channel_.get());
156 delegate_->OnChannelInitialized(channel_.get()); 156 delegate_->OnChannelInitialized(channel_.get());
157 157
158 // Make sure these messages get sent first. 158 // Make sure these messages get sent first.
159 #if defined(IPC_MESSAGE_LOG_ENABLED) 159 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
160 bool enabled = IPC::Logging::GetInstance()->Enabled(); 160 bool enabled = IPC::Logging::GetInstance()->Enabled();
161 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled)); 161 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled));
162 #endif 162 #endif
163 163
164 opening_channel_ = true; 164 opening_channel_ = true;
165 165
166 return true; 166 return true;
167 } 167 }
168 168
169 bool ChildProcessHostImpl::IsChannelOpening() { 169 bool ChildProcessHostImpl::IsChannelOpening() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 // The hash value is incremented so that the tracing id is never equal to 206 // The hash value is incremented so that the tracing id is never equal to
207 // MemoryDumpManager::kInvalidTracingProcessId. 207 // MemoryDumpManager::kInvalidTracingProcessId.
208 return static_cast<uint64_t>( 208 return static_cast<uint64_t>(
209 base::Hash(reinterpret_cast<const char*>(&child_process_id), 209 base::Hash(reinterpret_cast<const char*>(&child_process_id),
210 sizeof(child_process_id))) + 210 sizeof(child_process_id))) +
211 1; 211 1;
212 } 212 }
213 213
214 bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { 214 bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) {
215 #ifdef IPC_MESSAGE_LOG_ENABLED 215 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
216 IPC::Logging* logger = IPC::Logging::GetInstance(); 216 IPC::Logging* logger = IPC::Logging::GetInstance();
217 if (msg.type() == IPC_LOGGING_ID) { 217 if (msg.type() == IPC_LOGGING_ID) {
218 logger->OnReceivedLoggingMessage(msg); 218 logger->OnReceivedLoggingMessage(msg);
219 return true; 219 return true;
220 } 220 }
221 221
222 if (logger->Enabled()) 222 if (logger->Enabled())
223 logger->OnPreDispatchMessage(msg); 223 logger->OnPreDispatchMessage(msg);
224 #endif 224 #endif
225 225
(...skipping 10 matching lines...) Expand all
236 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg) 236 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg)
237 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 237 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
238 OnShutdownRequest) 238 OnShutdownRequest)
239 IPC_MESSAGE_UNHANDLED(handled = false) 239 IPC_MESSAGE_UNHANDLED(handled = false)
240 IPC_END_MESSAGE_MAP() 240 IPC_END_MESSAGE_MAP()
241 241
242 if (!handled) 242 if (!handled)
243 handled = delegate_->OnMessageReceived(msg); 243 handled = delegate_->OnMessageReceived(msg);
244 } 244 }
245 245
246 #ifdef IPC_MESSAGE_LOG_ENABLED 246 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
247 if (logger->Enabled()) 247 if (logger->Enabled())
248 logger->OnPostDispatchMessage(msg); 248 logger->OnPostDispatchMessage(msg);
249 #endif 249 #endif
250 return handled; 250 return handled;
251 } 251 }
252 252
253 void ChildProcessHostImpl::OnChannelConnected(int32_t peer_pid) { 253 void ChildProcessHostImpl::OnChannelConnected(int32_t peer_pid) {
254 if (!peer_process_.IsValid()) { 254 if (!peer_process_.IsValid()) {
255 peer_process_ = base::Process::OpenWithExtraPrivileges(peer_pid); 255 peer_process_ = base::Process::OpenWithExtraPrivileges(peer_pid);
256 if (!peer_process_.IsValid()) 256 if (!peer_process_.IsValid())
(...skipping 20 matching lines...) Expand all
277 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { 277 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
278 delegate_->OnBadMessageReceived(message); 278 delegate_->OnBadMessageReceived(message);
279 } 279 }
280 280
281 void ChildProcessHostImpl::OnShutdownRequest() { 281 void ChildProcessHostImpl::OnShutdownRequest() {
282 if (delegate_->CanShutdown()) 282 if (delegate_->CanShutdown())
283 Send(new ChildProcessMsg_Shutdown()); 283 Send(new ChildProcessMsg_Shutdown());
284 } 284 }
285 285
286 } // namespace content 286 } // 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