| OLD | NEW |
| 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 // Need to include this before any other file because it defines | 5 // Need to include this before any other file because it defines |
| 6 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 6 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
| 7 // IPC_MESSAGE_MACROS_LOG_ENABLED so that all_messages.h will generate the | 7 // IPC_MESSAGE_MACROS_LOG_ENABLED so that all_messages.h will generate the |
| 8 // ViewMsgLog et al. functions. | 8 // ViewMsgLog et al. functions. |
| 9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 | 10 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 void AboutIPCDialog::Log(const IPC::LogData& data) { | 289 void AboutIPCDialog::Log(const IPC::LogData& data) { |
| 290 if (disabled_messages.find(data.type) != disabled_messages.end()) | 290 if (disabled_messages.find(data.type) != disabled_messages.end()) |
| 291 return; // Message type is filtered out. | 291 return; // Message type is filtered out. |
| 292 | 292 |
| 293 base::Time sent = base::Time::FromInternalValue(data.sent); | 293 base::Time sent = base::Time::FromInternalValue(data.sent); |
| 294 base::Time::Exploded exploded; | 294 base::Time::Exploded exploded; |
| 295 sent.LocalExplode(&exploded); | 295 sent.LocalExplode(&exploded); |
| 296 if (exploded.hour > 12) | 296 if (exploded.hour > 12) |
| 297 exploded.hour -= 12; | 297 exploded.hour -= 12; |
| 298 | 298 |
| 299 std::wstring sent_str = StringPrintf(L"%02d:%02d:%02d.%03d", | 299 std::wstring sent_str = base::StringPrintf(L"%02d:%02d:%02d.%03d", |
| 300 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); | 300 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); |
| 301 | 301 |
| 302 int count = message_list_.GetItemCount(); | 302 int count = message_list_.GetItemCount(); |
| 303 int index = message_list_.InsertItem(count, sent_str.c_str()); | 303 int index = message_list_.InsertItem(count, sent_str.c_str()); |
| 304 | 304 |
| 305 message_list_.SetItemText(index, kTimeColumn, sent_str.c_str()); | 305 message_list_.SetItemText(index, kTimeColumn, sent_str.c_str()); |
| 306 message_list_.SetItemText(index, kChannelColumn, | 306 message_list_.SetItemText(index, kChannelColumn, |
| 307 ASCIIToWide(data.channel).c_str()); | 307 ASCIIToWide(data.channel).c_str()); |
| 308 | 308 |
| 309 std::string message_name; | 309 std::string message_name; |
| 310 IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL); | 310 IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL); |
| 311 message_list_.SetItemText(index, kMessageColumn, | 311 message_list_.SetItemText(index, kMessageColumn, |
| 312 UTF8ToWide(message_name).c_str()); | 312 UTF8ToWide(message_name).c_str()); |
| 313 message_list_.SetItemText(index, kFlagsColumn, | 313 message_list_.SetItemText(index, kFlagsColumn, |
| 314 UTF8ToWide(data.flags).c_str()); | 314 UTF8ToWide(data.flags).c_str()); |
| 315 | 315 |
| 316 int64 time_to_send = (base::Time::FromInternalValue(data.receive) - | 316 int64 time_to_send = (base::Time::FromInternalValue(data.receive) - |
| 317 sent).InMilliseconds(); | 317 sent).InMilliseconds(); |
| 318 // time can go backwards by a few ms (see Time), don't show that. | 318 // time can go backwards by a few ms (see Time), don't show that. |
| 319 time_to_send = std::max(static_cast<int>(time_to_send), 0); | 319 time_to_send = std::max(static_cast<int>(time_to_send), 0); |
| 320 std::wstring temp = StringPrintf(L"%d", time_to_send); | 320 std::wstring temp = base::StringPrintf(L"%d", time_to_send); |
| 321 message_list_.SetItemText(index, kDispatchColumn, temp.c_str()); | 321 message_list_.SetItemText(index, kDispatchColumn, temp.c_str()); |
| 322 | 322 |
| 323 int64 time_to_process = (base::Time::FromInternalValue(data.dispatch) - | 323 int64 time_to_process = (base::Time::FromInternalValue(data.dispatch) - |
| 324 base::Time::FromInternalValue(data.receive)).InMilliseconds(); | 324 base::Time::FromInternalValue(data.receive)).InMilliseconds(); |
| 325 time_to_process = std::max(static_cast<int>(time_to_process), 0); | 325 time_to_process = std::max(static_cast<int>(time_to_process), 0); |
| 326 temp = StringPrintf(L"%d", time_to_process); | 326 temp = base::StringPrintf(L"%d", time_to_process); |
| 327 message_list_.SetItemText(index, kProcessColumn, temp.c_str()); | 327 message_list_.SetItemText(index, kProcessColumn, temp.c_str()); |
| 328 | 328 |
| 329 message_list_.SetItemText(index, kParamsColumn, | 329 message_list_.SetItemText(index, kParamsColumn, |
| 330 UTF8ToWide(data.params).c_str()); | 330 UTF8ToWide(data.params).c_str()); |
| 331 message_list_.EnsureVisible(index, FALSE); | 331 message_list_.EnsureVisible(index, FALSE); |
| 332 } | 332 } |
| 333 | 333 |
| 334 bool AboutIPCDialog::CanResize() const { | 334 bool AboutIPCDialog::CanResize() const { |
| 335 return true; | 335 return true; |
| 336 } | 336 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 357 | 357 |
| 358 namespace chrome { | 358 namespace chrome { |
| 359 | 359 |
| 360 void ShowAboutIPCDialog() { | 360 void ShowAboutIPCDialog() { |
| 361 AboutIPCDialog::RunDialog(); | 361 AboutIPCDialog::RunDialog(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace chrome | 364 } // namespace chrome |
| 365 | 365 |
| 366 #endif // IPC_MESSAGE_LOG_ENABLED | 366 #endif // IPC_MESSAGE_LOG_ENABLED |
| OLD | NEW |