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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 9389020: Add simple trace logging of received IPC messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change ipclist instead Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/tools/ipclist/ipclist.cc ('k') | no next file » | 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) 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/debug/trace_event.h"
7 #include "base/location.h" 8 #include "base/location.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
11 #include "ipc/ipc_logging.h" 12 #include "ipc/ipc_logging.h"
12 #include "ipc/ipc_message_utils.h" 13 #include "ipc/ipc_message_utils.h"
13 14
14 namespace IPC { 15 namespace IPC {
15 16
16 // This helper ensures the message is deleted if the task is deleted without 17 // This helper ensures the message is deleted if the task is deleted without
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // Called on the listener's thread 232 // Called on the listener's thread
232 void ChannelProxy::Context::AddFilter(MessageFilter* filter) { 233 void ChannelProxy::Context::AddFilter(MessageFilter* filter) {
233 base::AutoLock auto_lock(pending_filters_lock_); 234 base::AutoLock auto_lock(pending_filters_lock_);
234 pending_filters_.push_back(make_scoped_refptr(filter)); 235 pending_filters_.push_back(make_scoped_refptr(filter));
235 ipc_message_loop_->PostTask( 236 ipc_message_loop_->PostTask(
236 FROM_HERE, base::Bind(&Context::OnAddFilter, this)); 237 FROM_HERE, base::Bind(&Context::OnAddFilter, this));
237 } 238 }
238 239
239 // Called on the listener's thread 240 // Called on the listener's thread
240 void ChannelProxy::Context::OnDispatchMessage(const Message& message) { 241 void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
242 #ifdef IPC_MESSAGE_LOG_ENABLED
243 Logging* logger = Logging::GetInstance();
244 std::string name;
245 logger->GetMessageText(message.type(), &name, &message, NULL);
246 TRACE_EVENT1("task", "ChannelProxy::Context::OnDispatchMessage",
247 "name", name);
248 #else
249 TRACE_EVENT1("task", "ChannelProxy::Context::OnDispatchMessage",
250 "type", message.type());
251 #endif
252
241 if (!listener_) 253 if (!listener_)
242 return; 254 return;
243 255
244 OnDispatchConnected(); 256 OnDispatchConnected();
245 257
246 #ifdef IPC_MESSAGE_LOG_ENABLED 258 #ifdef IPC_MESSAGE_LOG_ENABLED
247 Logging* logger = Logging::GetInstance();
248 if (message.type() == IPC_LOGGING_ID) { 259 if (message.type() == IPC_LOGGING_ID) {
249 logger->OnReceivedLoggingMessage(message); 260 logger->OnReceivedLoggingMessage(message);
250 return; 261 return;
251 } 262 }
252 263
253 if (logger->Enabled()) 264 if (logger->Enabled())
254 logger->OnPreDispatchMessage(message); 265 logger->OnPreDispatchMessage(message);
255 #endif 266 #endif
256 267
257 listener_->OnMessageReceived(message); 268 listener_->OnMessageReceived(message);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 Channel* channel = context_.get()->channel_.get(); 407 Channel* channel = context_.get()->channel_.get();
397 // Channel must have been created first. 408 // Channel must have been created first.
398 DCHECK(channel) << context_.get()->channel_id_; 409 DCHECK(channel) << context_.get()->channel_id_;
399 return channel->GetClientEuid(client_euid); 410 return channel->GetClientEuid(client_euid);
400 } 411 }
401 #endif 412 #endif
402 413
403 //----------------------------------------------------------------------------- 414 //-----------------------------------------------------------------------------
404 415
405 } // namespace IPC 416 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/tools/ipclist/ipclist.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698