OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_logging.h" | 5 #include "ipc/ipc_logging.h" |
6 | 6 |
7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
8 #ifdef IPC_MESSAGE_LOG_ENABLED | 8 #ifdef IPC_MESSAGE_LOG_ENABLED |
9 // This will cause render_messages.h etc to define ViewMsgLog and friends. | 9 // This will cause render_messages.h etc to define ViewMsgLog and friends. |
10 #define IPC_MESSAGE_MACROS_LOG_ENABLED | 10 #define IPC_MESSAGE_MACROS_LOG_ENABLED |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if (sender_) { | 247 if (sender_) { |
248 queued_logs_.push_back(data); | 248 queued_logs_.push_back(data); |
249 if (!queue_invoke_later_pending_) { | 249 if (!queue_invoke_later_pending_) { |
250 queue_invoke_later_pending_ = true; | 250 queue_invoke_later_pending_ = true; |
251 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod( | 251 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod( |
252 this, &Logging::OnSendLogs), kLogSendDelayMs); | 252 this, &Logging::OnSendLogs), kLogSendDelayMs); |
253 } | 253 } |
254 } | 254 } |
255 } | 255 } |
256 #elif defined(OS_POSIX) | 256 #elif defined(OS_POSIX) |
| 257 std::string message_name; |
| 258 if (data.message_name.empty()) { |
| 259 message_name = StringPrintf("[unknown type %d]", data.type); |
| 260 } else { |
| 261 message_name = WideToASCII(data.message_name); |
| 262 } |
| 263 |
257 // On POSIX, for now, we just dump the log to stderr | 264 // On POSIX, for now, we just dump the log to stderr |
258 fprintf(stderr, "ipc %s %d %d %s %s %s\n", | 265 fprintf(stderr, "ipc %s %d %s %s %s\n", |
259 data.channel.c_str(), | 266 data.channel.c_str(), |
260 data.routing_id, | 267 data.routing_id, |
261 data.type, | 268 WideToASCII(data.flags).c_str(), |
262 WideToUTF8(data.flags).c_str(), | 269 message_name.c_str(), |
263 WideToUTF8(data.message_name).c_str(), | |
264 WideToUTF8(data.params).c_str()); | 270 WideToUTF8(data.params).c_str()); |
265 #endif | 271 #endif |
266 } | 272 } |
267 | 273 |
268 void GenerateLogData(const std::string& channel, const Message& message, | 274 void GenerateLogData(const std::string& channel, const Message& message, |
269 LogData* data) { | 275 LogData* data) { |
270 if (message.is_reply()) { | 276 if (message.is_reply()) { |
271 // "data" should already be filled in. | 277 // "data" should already be filled in. |
272 std::wstring params; | 278 std::wstring params; |
273 Logging::GetMessageText(data->type, NULL, &message, ¶ms); | 279 Logging::GetMessageText(data->type, NULL, &message, ¶ms); |
(...skipping 26 matching lines...) Expand all Loading... |
300 data->receive = message.received_time(); | 306 data->receive = message.received_time(); |
301 data->dispatch = Time::Now().ToInternalValue(); | 307 data->dispatch = Time::Now().ToInternalValue(); |
302 data->params = params; | 308 data->params = params; |
303 data->message_name = message_name; | 309 data->message_name = message_name; |
304 } | 310 } |
305 } | 311 } |
306 | 312 |
307 } | 313 } |
308 | 314 |
309 #endif // IPC_MESSAGE_LOG_ENABLED | 315 #endif // IPC_MESSAGE_LOG_ENABLED |
OLD | NEW |