| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/net/passive_log_collector.h" | 5 #include "chrome/browser/net/passive_log_collector.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 313 } |
| 314 | 314 |
| 315 return ACTION_NONE; | 315 return ACTION_NONE; |
| 316 } | 316 } |
| 317 | 317 |
| 318 void PassiveLogCollector::ConnectJobTracker::AppendLogEntries( | 318 void PassiveLogCollector::ConnectJobTracker::AppendLogEntries( |
| 319 RequestInfo* out_info, bool unbounded, uint32 connect_id) { | 319 RequestInfo* out_info, bool unbounded, uint32 connect_id) { |
| 320 RequestInfo* connect_info = GetRequestInfo(connect_id); | 320 RequestInfo* connect_info = GetRequestInfo(connect_id); |
| 321 if (!connect_info) { | 321 if (!connect_info) { |
| 322 net::NetLogStringParameter* text = new net::NetLogStringParameter( | 322 net::NetLogStringParameter* text = new net::NetLogStringParameter( |
| 323 StringPrintf("Used ConnectJob id=%u", connect_id)); | 323 "todo", StringPrintf("Used ConnectJob id=%u", connect_id)); |
| 324 Entry new_entry(0, net::NetLog::TYPE_TODO_STRING, base::TimeTicks(), | 324 Entry new_entry(0, net::NetLog::TYPE_TODO_STRING, base::TimeTicks(), |
| 325 net::NetLog::Source(net::NetLog::SOURCE_CONNECT_JOB, | 325 net::NetLog::Source(net::NetLog::SOURCE_CONNECT_JOB, |
| 326 connect_id), | 326 connect_id), |
| 327 net::NetLog::PHASE_NONE, text); | 327 net::NetLog::PHASE_NONE, text); |
| 328 AddEntryToRequestInfo(new_entry, unbounded, out_info); | 328 AddEntryToRequestInfo(new_entry, unbounded, out_info); |
| 329 return; | 329 return; |
| 330 } | 330 } |
| 331 | 331 |
| 332 AppendToRequestInfo(*connect_info, unbounded, out_info); | 332 AppendToRequestInfo(*connect_info, unbounded, out_info); |
| 333 std::sort(out_info->entries.begin(), out_info->entries.end(), | 333 std::sort(out_info->entries.begin(), out_info->entries.end(), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 break; | 376 break; |
| 377 } | 377 } |
| 378 return ACTION_NONE; | 378 return ACTION_NONE; |
| 379 } | 379 } |
| 380 | 380 |
| 381 void PassiveLogCollector::SocketTracker::AppendLogEntries( | 381 void PassiveLogCollector::SocketTracker::AppendLogEntries( |
| 382 RequestInfo* out_info, bool unbounded, uint32 socket_id, bool clear) { | 382 RequestInfo* out_info, bool unbounded, uint32 socket_id, bool clear) { |
| 383 RequestInfo* socket_info = GetRequestInfo(socket_id); | 383 RequestInfo* socket_info = GetRequestInfo(socket_id); |
| 384 if (!socket_info) { | 384 if (!socket_info) { |
| 385 net::NetLogStringParameter* text = new net::NetLogStringParameter( | 385 net::NetLogStringParameter* text = new net::NetLogStringParameter( |
| 386 StringPrintf("Used Socket id=%u.", socket_id)); | 386 "todo", StringPrintf("Used Socket id=%u.", socket_id)); |
| 387 Entry new_entry(0, net::NetLog::TYPE_TODO_STRING, base::TimeTicks(), | 387 Entry new_entry(0, net::NetLog::TYPE_TODO_STRING, base::TimeTicks(), |
| 388 net::NetLog::Source(net::NetLog::SOURCE_SOCKET, socket_id), | 388 net::NetLog::Source(net::NetLog::SOURCE_SOCKET, socket_id), |
| 389 net::NetLog::PHASE_NONE, text); | 389 net::NetLog::PHASE_NONE, text); |
| 390 AddEntryToRequestInfo(new_entry, unbounded, out_info); | 390 AddEntryToRequestInfo(new_entry, unbounded, out_info); |
| 391 return; | 391 return; |
| 392 } | 392 } |
| 393 | 393 |
| 394 AppendToRequestInfo(*socket_info, unbounded, out_info); | 394 AppendToRequestInfo(*socket_info, unbounded, out_info); |
| 395 out_info->num_entries_truncated += socket_info->num_entries_truncated; | 395 out_info->num_entries_truncated += socket_info->num_entries_truncated; |
| 396 | 396 |
| 397 // Synthesize a log entry for bytes sent and received. | 397 // Synthesize a log entry for bytes sent and received. |
| 398 if (socket_info->bytes_transmitted > 0 || socket_info->bytes_received > 0) { | 398 if (socket_info->bytes_transmitted > 0 || socket_info->bytes_received > 0) { |
| 399 net::NetLogStringParameter* text = new net::NetLogStringParameter( | 399 net::NetLogStringParameter* text = new net::NetLogStringParameter( |
| 400 "stats", |
| 400 StringPrintf("Tx/Rx: %"PRIu64"/%"PRIu64" [%"PRIu64"/%"PRIu64 | 401 StringPrintf("Tx/Rx: %"PRIu64"/%"PRIu64" [%"PRIu64"/%"PRIu64 |
| 401 " total on socket] (Bytes)", | 402 " total on socket] (Bytes)", |
| 402 socket_info->bytes_transmitted, | 403 socket_info->bytes_transmitted, |
| 403 socket_info->bytes_received, | 404 socket_info->bytes_received, |
| 404 socket_info->total_bytes_transmitted, | 405 socket_info->total_bytes_transmitted, |
| 405 socket_info->total_bytes_received)); | 406 socket_info->total_bytes_received)); |
| 406 Entry new_entry(socket_info->last_tx_rx_position, | 407 Entry new_entry(socket_info->last_tx_rx_position, |
| 407 net::NetLog::TYPE_TODO_STRING, | 408 net::NetLog::TYPE_TODO_STRING, |
| 408 socket_info->last_tx_rx_time, | 409 socket_info->last_tx_rx_time, |
| 409 net::NetLog::Source(net::NetLog::SOURCE_SOCKET, socket_id), | 410 net::NetLog::Source(net::NetLog::SOURCE_SOCKET, socket_id), |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 562 } |
| 562 entries_.push_back(entry); | 563 entries_.push_back(entry); |
| 563 } | 564 } |
| 564 | 565 |
| 565 // Safety net: INIT_PROXY_RESOLVER shouldn't generate many messages, but in | 566 // Safety net: INIT_PROXY_RESOLVER shouldn't generate many messages, but in |
| 566 // case something goes wrong, avoid exploding the memory usage. | 567 // case something goes wrong, avoid exploding the memory usage. |
| 567 if (entries_.size() > kMaxNumEntriesPerLog) | 568 if (entries_.size() > kMaxNumEntriesPerLog) |
| 568 entries_.clear(); | 569 entries_.clear(); |
| 569 } | 570 } |
| 570 | 571 |
| OLD | NEW |