Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 std::string name = "N/A (IPC Logging disabled)"; | |
|
jbates
2012/02/13 23:26:25
To avoid the overhead of this string, I would move
| |
| 243 #ifdef IPC_MESSAGE_LOG_ENABLED | |
| 244 Logging* logger = Logging::GetInstance(); | |
| 245 logger->GetMessageText(message.type(), &name, &message, NULL); | |
| 246 #endif | |
| 247 TRACE_EVENT2("task", "ChannelProxy::Context::OnDispatchMessage", | |
| 248 "type", message.type(), | |
| 249 "name", name); | |
| 250 | |
| 241 if (!listener_) | 251 if (!listener_) |
| 242 return; | 252 return; |
| 243 | 253 |
| 244 OnDispatchConnected(); | 254 OnDispatchConnected(); |
| 245 | 255 |
| 246 #ifdef IPC_MESSAGE_LOG_ENABLED | 256 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 247 Logging* logger = Logging::GetInstance(); | |
| 248 if (message.type() == IPC_LOGGING_ID) { | 257 if (message.type() == IPC_LOGGING_ID) { |
| 249 logger->OnReceivedLoggingMessage(message); | 258 logger->OnReceivedLoggingMessage(message); |
| 250 return; | 259 return; |
| 251 } | 260 } |
| 252 | 261 |
| 253 if (logger->Enabled()) | 262 if (logger->Enabled()) |
| 254 logger->OnPreDispatchMessage(message); | 263 logger->OnPreDispatchMessage(message); |
| 255 #endif | 264 #endif |
| 256 | 265 |
| 257 listener_->OnMessageReceived(message); | 266 listener_->OnMessageReceived(message); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 Channel* channel = context_.get()->channel_.get(); | 405 Channel* channel = context_.get()->channel_.get(); |
| 397 // Channel must have been created first. | 406 // Channel must have been created first. |
| 398 DCHECK(channel) << context_.get()->channel_id_; | 407 DCHECK(channel) << context_.get()->channel_id_; |
| 399 return channel->GetClientEuid(client_euid); | 408 return channel->GetClientEuid(client_euid); |
| 400 } | 409 } |
| 401 #endif | 410 #endif |
| 402 | 411 |
| 403 //----------------------------------------------------------------------------- | 412 //----------------------------------------------------------------------------- |
| 404 | 413 |
| 405 } // namespace IPC | 414 } // namespace IPC |
| OLD | NEW |