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 "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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { | 416 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { |
417 } | 417 } |
418 | 418 |
419 PassiveLogCollector::SourceTracker::Action | 419 PassiveLogCollector::SourceTracker::Action |
420 PassiveLogCollector::SocketTracker::DoAddEntry(const ChromeNetLog::Entry& entry, | 420 PassiveLogCollector::SocketTracker::DoAddEntry(const ChromeNetLog::Entry& entry, |
421 SourceInfo* out_info) { | 421 SourceInfo* out_info) { |
422 // TODO(eroman): aggregate the byte counts once truncation starts to happen, | 422 // TODO(eroman): aggregate the byte counts once truncation starts to happen, |
423 // to summarize transaction read/writes for each SOCKET_IN_USE | 423 // to summarize transaction read/writes for each SOCKET_IN_USE |
424 // section. | 424 // section. |
425 if (entry.type == net::NetLog::TYPE_SOCKET_BYTES_SENT || | 425 if (entry.type == net::NetLog::TYPE_SOCKET_BYTES_SENT || |
426 entry.type == net::NetLog::TYPE_SOCKET_BYTES_RECEIVED) { | 426 entry.type == net::NetLog::TYPE_SOCKET_BYTES_RECEIVED || |
427 entry.type == net::NetLog::TYPE_SSL_SOCKET_BYTES_SENT || | |
eroman
2011/06/01 19:27:01
good spot!
| |
428 entry.type == net::NetLog::TYPE_SSL_SOCKET_BYTES_RECEIVED) { | |
427 return ACTION_NONE; | 429 return ACTION_NONE; |
428 } | 430 } |
429 | 431 |
430 AddEntryToSourceInfo(entry, out_info); | 432 AddEntryToSourceInfo(entry, out_info); |
431 | 433 |
432 if (entry.type == net::NetLog::TYPE_SOCKET_ALIVE && | 434 if (entry.type == net::NetLog::TYPE_SOCKET_ALIVE && |
433 entry.phase == net::NetLog::PHASE_END) { | 435 entry.phase == net::NetLog::PHASE_END) { |
434 return ACTION_MOVE_TO_GRAVEYARD; | 436 return ACTION_MOVE_TO_GRAVEYARD; |
435 } | 437 } |
436 | 438 |
(...skipping 13 matching lines...) Expand all Loading... | |
450 | 452 |
451 PassiveLogCollector::SourceTracker::Action | 453 PassiveLogCollector::SourceTracker::Action |
452 PassiveLogCollector::RequestTracker::DoAddEntry( | 454 PassiveLogCollector::RequestTracker::DoAddEntry( |
453 const ChromeNetLog::Entry& entry, SourceInfo* out_info) { | 455 const ChromeNetLog::Entry& entry, SourceInfo* out_info) { |
454 if (entry.type == net::NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_JOB) { | 456 if (entry.type == net::NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_JOB) { |
455 const net::NetLog::Source& source_dependency = | 457 const net::NetLog::Source& source_dependency = |
456 static_cast<net::NetLogSourceParameter*>(entry.params.get())->value(); | 458 static_cast<net::NetLogSourceParameter*>(entry.params.get())->value(); |
457 AddReferenceToSourceDependency(source_dependency, out_info); | 459 AddReferenceToSourceDependency(source_dependency, out_info); |
458 } | 460 } |
459 | 461 |
462 // Don't keep read bytes around in the log, to save memory. | |
463 if (entry.type == net::NetLog::TYPE_URL_REQUEST_JOB_FILTERED_BYTES_READ) | |
464 return ACTION_NONE; | |
465 | |
460 AddEntryToSourceInfo(entry, out_info); | 466 AddEntryToSourceInfo(entry, out_info); |
461 | 467 |
462 // If the request has ended, move it to the graveyard. | 468 // If the request has ended, move it to the graveyard. |
463 if (entry.type == net::NetLog::TYPE_REQUEST_ALIVE && | 469 if (entry.type == net::NetLog::TYPE_REQUEST_ALIVE && |
464 entry.phase == net::NetLog::PHASE_END) { | 470 entry.phase == net::NetLog::PHASE_END) { |
465 if (StartsWithASCII(out_info->GetURL(), "chrome://", false)) { | 471 if (StartsWithASCII(out_info->GetURL(), "chrome://", false)) { |
466 // Avoid sending "chrome://" requests to the graveyard, since it just | 472 // Avoid sending "chrome://" requests to the graveyard, since it just |
467 // adds to clutter. | 473 // adds to clutter. |
468 return ACTION_DELETE; | 474 return ACTION_DELETE; |
469 } | 475 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
663 PassiveLogCollector* parent) | 669 PassiveLogCollector* parent) |
664 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, parent) { | 670 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, parent) { |
665 } | 671 } |
666 | 672 |
667 PassiveLogCollector::SourceTracker::Action | 673 PassiveLogCollector::SourceTracker::Action |
668 PassiveLogCollector::ExponentialBackoffThrottlingTracker::DoAddEntry( | 674 PassiveLogCollector::ExponentialBackoffThrottlingTracker::DoAddEntry( |
669 const ChromeNetLog::Entry& entry, SourceInfo* out_info) { | 675 const ChromeNetLog::Entry& entry, SourceInfo* out_info) { |
670 AddEntryToSourceInfo(entry, out_info); | 676 AddEntryToSourceInfo(entry, out_info); |
671 return ACTION_NONE; | 677 return ACTION_NONE; |
672 } | 678 } |
OLD | NEW |