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

Side by Side Diff: ipc/ipc_channel_proxy.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 | « ipc/ipc_channel_nacl.cc ('k') | ipc/ipc_channel_reader.cc » ('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 "ipc/ipc_channel_proxy.h" 5 #include "ipc/ipc_channel_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 base::AutoLock l(pending_filters_lock_); 72 base::AutoLock l(pending_filters_lock_);
73 for (auto& entry : pending_io_thread_interfaces_) 73 for (auto& entry : pending_io_thread_interfaces_)
74 support->AddGenericAssociatedInterface(entry.first, entry.second); 74 support->AddGenericAssociatedInterface(entry.first, entry.second);
75 pending_io_thread_interfaces_.clear(); 75 pending_io_thread_interfaces_.clear();
76 } 76 }
77 } 77 }
78 78
79 bool ChannelProxy::Context::TryFilters(const Message& message) { 79 bool ChannelProxy::Context::TryFilters(const Message& message) {
80 DCHECK(message_filter_router_); 80 DCHECK(message_filter_router_);
81 #ifdef IPC_MESSAGE_LOG_ENABLED 81 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
82 Logging* logger = Logging::GetInstance(); 82 Logging* logger = Logging::GetInstance();
83 if (logger->Enabled()) 83 if (logger->Enabled())
84 logger->OnPreDispatchMessage(message); 84 logger->OnPreDispatchMessage(message);
85 #endif 85 #endif
86 86
87 if (message_filter_router_->TryFilters(message)) { 87 if (message_filter_router_->TryFilters(message)) {
88 if (message.dispatch_error()) { 88 if (message.dispatch_error()) {
89 listener_task_runner_->PostTask( 89 listener_task_runner_->PostTask(
90 FROM_HERE, base::Bind(&Context::OnDispatchBadMessage, this, message)); 90 FROM_HERE, base::Bind(&Context::OnDispatchBadMessage, this, message));
91 } 91 }
92 #ifdef IPC_MESSAGE_LOG_ENABLED 92 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
93 if (logger->Enabled()) 93 if (logger->Enabled())
94 logger->OnPostDispatchMessage(message); 94 logger->OnPostDispatchMessage(message);
95 #endif 95 #endif
96 return true; 96 return true;
97 } 97 }
98 return false; 98 return false;
99 } 99 }
100 100
101 // Called on the IPC::Channel thread 101 // Called on the IPC::Channel thread
102 void ChannelProxy::Context::PauseChannel() { 102 void ChannelProxy::Context::PauseChannel() {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 FROM_HERE, base::Bind(&Context::OnAddFilter, this)); 308 FROM_HERE, base::Bind(&Context::OnAddFilter, this));
309 } 309 }
310 310
311 // Called on the listener's thread 311 // Called on the listener's thread
312 void ChannelProxy::Context::OnDispatchMessage(const Message& message) { 312 void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
313 if (!listener_) 313 if (!listener_)
314 return; 314 return;
315 315
316 OnDispatchConnected(); 316 OnDispatchConnected();
317 317
318 #ifdef IPC_MESSAGE_LOG_ENABLED 318 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
319 Logging* logger = Logging::GetInstance(); 319 Logging* logger = Logging::GetInstance();
320 if (message.type() == IPC_LOGGING_ID) { 320 if (message.type() == IPC_LOGGING_ID) {
321 logger->OnReceivedLoggingMessage(message); 321 logger->OnReceivedLoggingMessage(message);
322 return; 322 return;
323 } 323 }
324 324
325 if (logger->Enabled()) 325 if (logger->Enabled())
326 logger->OnPreDispatchMessage(message); 326 logger->OnPreDispatchMessage(message);
327 #endif 327 #endif
328 328
329 listener_->OnMessageReceived(message); 329 listener_->OnMessageReceived(message);
330 if (message.dispatch_error()) 330 if (message.dispatch_error())
331 listener_->OnBadMessageReceived(message); 331 listener_->OnBadMessageReceived(message);
332 332
333 #ifdef IPC_MESSAGE_LOG_ENABLED 333 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
334 if (logger->Enabled()) 334 if (logger->Enabled())
335 logger->OnPostDispatchMessage(message); 335 logger->OnPostDispatchMessage(message);
336 #endif 336 #endif
337 } 337 }
338 338
339 // Called on the listener's thread 339 // Called on the listener's thread
340 void ChannelProxy::Context::OnDispatchConnected() { 340 void ChannelProxy::Context::OnDispatchConnected() {
341 if (channel_connected_called_) 341 if (channel_connected_called_)
342 return; 342 return;
343 343
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // tests that call Send() from a wrong thread. See http://crbug.com/163523. 523 // tests that call Send() from a wrong thread. See http://crbug.com/163523.
524 524
525 #ifdef ENABLE_IPC_FUZZER 525 #ifdef ENABLE_IPC_FUZZER
526 // In IPC fuzzing builds, it is possible to define a filter to apply to 526 // In IPC fuzzing builds, it is possible to define a filter to apply to
527 // outgoing messages. It will either rewrite the message and return a new 527 // outgoing messages. It will either rewrite the message and return a new
528 // one, freeing the original, or return the message unchanged. 528 // one, freeing the original, or return the message unchanged.
529 if (outgoing_message_filter()) 529 if (outgoing_message_filter())
530 message = outgoing_message_filter()->Rewrite(message); 530 message = outgoing_message_filter()->Rewrite(message);
531 #endif 531 #endif
532 532
533 #ifdef IPC_MESSAGE_LOG_ENABLED 533 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
534 Logging::GetInstance()->OnSendMessage(message); 534 Logging::GetInstance()->OnSendMessage(message);
535 #endif 535 #endif
536 536
537 context_->Send(message); 537 context_->Send(message);
538 return true; 538 return true;
539 } 539 }
540 540
541 void ChannelProxy::AddFilter(MessageFilter* filter) { 541 void ChannelProxy::AddFilter(MessageFilter* filter) {
542 DCHECK(CalledOnValidThread()); 542 DCHECK(CalledOnValidThread());
543 543
(...skipping 28 matching lines...) Expand all
572 DCHECK(CalledOnValidThread()); 572 DCHECK(CalledOnValidThread());
573 context()->ClearIPCTaskRunner(); 573 context()->ClearIPCTaskRunner();
574 } 574 }
575 575
576 void ChannelProxy::OnChannelInit() { 576 void ChannelProxy::OnChannelInit() {
577 } 577 }
578 578
579 //----------------------------------------------------------------------------- 579 //-----------------------------------------------------------------------------
580 580
581 } // namespace IPC 581 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_nacl.cc ('k') | ipc/ipc_channel_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698