Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: chrome/browser/net/passive_log_collector.cc

Issue 6613027: Adds memory cache logging, and updates disk cache logging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Oops Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 trackers_[net::NetLog::SOURCE_SOCKET_STREAM] = &socket_stream_tracker_; 64 trackers_[net::NetLog::SOURCE_SOCKET_STREAM] = &socket_stream_tracker_;
65 trackers_[net::NetLog::SOURCE_CONNECT_JOB] = &connect_job_tracker_; 65 trackers_[net::NetLog::SOURCE_CONNECT_JOB] = &connect_job_tracker_;
66 trackers_[net::NetLog::SOURCE_SOCKET] = &socket_tracker_; 66 trackers_[net::NetLog::SOURCE_SOCKET] = &socket_tracker_;
67 trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] = 67 trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] =
68 &init_proxy_resolver_tracker_; 68 &init_proxy_resolver_tracker_;
69 trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_; 69 trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_;
70 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] = 70 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] =
71 &dns_request_tracker_; 71 &dns_request_tracker_;
72 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_; 72 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_;
73 trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_; 73 trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_;
74 trackers_[net::NetLog::SOURCE_MEMORY_CACHE_ENTRY] = &mem_cache_entry_tracker_;
74 trackers_[net::NetLog::SOURCE_HTTP_STREAM_JOB] = &http_stream_job_tracker_; 75 trackers_[net::NetLog::SOURCE_HTTP_STREAM_JOB] = &http_stream_job_tracker_;
75 // Make sure our mapping is up-to-date. 76 // Make sure our mapping is up-to-date.
76 for (size_t i = 0; i < arraysize(trackers_); ++i) 77 for (size_t i = 0; i < arraysize(trackers_); ++i)
77 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i; 78 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i;
78 } 79 }
79 80
80 PassiveLogCollector::~PassiveLogCollector() { 81 PassiveLogCollector::~PassiveLogCollector() {
81 } 82 }
82 83
83 void PassiveLogCollector::OnAddEntry( 84 void PassiveLogCollector::OnAddEntry(
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 PassiveLogCollector::DiskCacheEntryTracker::DiskCacheEntryTracker() 572 PassiveLogCollector::DiskCacheEntryTracker::DiskCacheEntryTracker()
572 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { 573 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
573 } 574 }
574 575
575 PassiveLogCollector::SourceTracker::Action 576 PassiveLogCollector::SourceTracker::Action
576 PassiveLogCollector::DiskCacheEntryTracker::DoAddEntry( 577 PassiveLogCollector::DiskCacheEntryTracker::DoAddEntry(
577 const ChromeNetLog::Entry& entry, SourceInfo* out_info) { 578 const ChromeNetLog::Entry& entry, SourceInfo* out_info) {
578 AddEntryToSourceInfo(entry, out_info); 579 AddEntryToSourceInfo(entry, out_info);
579 580
580 // If the request has ended, move it to the graveyard. 581 // If the request has ended, move it to the graveyard.
581 if (entry.type == net::NetLog::TYPE_DISK_CACHE_ENTRY && 582 if (entry.type == net::NetLog::TYPE_DISK_CACHE_ENTRY_IMPL &&
582 entry.phase == net::NetLog::PHASE_END) { 583 entry.phase == net::NetLog::PHASE_END) {
583 return ACTION_MOVE_TO_GRAVEYARD; 584 return ACTION_MOVE_TO_GRAVEYARD;
584 } 585 }
585 586
586 return ACTION_NONE; 587 return ACTION_NONE;
587 } 588 }
588 589
589 //---------------------------------------------------------------------------- 590 //----------------------------------------------------------------------------
591 // MemCacheEntryTracker
592 //----------------------------------------------------------------------------
593
594 const size_t PassiveLogCollector::MemCacheEntryTracker::kMaxNumSources = 100;
595 const size_t PassiveLogCollector::MemCacheEntryTracker::kMaxGraveyardSize = 25;
596
597 PassiveLogCollector::MemCacheEntryTracker::MemCacheEntryTracker()
598 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
599 }
600
601 PassiveLogCollector::SourceTracker::Action
602 PassiveLogCollector::MemCacheEntryTracker::DoAddEntry(
603 const ChromeNetLog::Entry& entry, SourceInfo* out_info) {
604 AddEntryToSourceInfo(entry, out_info);
605
606 // If the request has ended, move it to the graveyard.
607 if (entry.type == net::NetLog::TYPE_DISK_CACHE_MEM_ENTRY_IMPL &&
608 entry.phase == net::NetLog::PHASE_END) {
609 return ACTION_MOVE_TO_GRAVEYARD;
610 }
611
612 return ACTION_NONE;
613 }
614
615 //----------------------------------------------------------------------------
590 // HttpStreamJobTracker 616 // HttpStreamJobTracker
591 //---------------------------------------------------------------------------- 617 //----------------------------------------------------------------------------
592 618
593 const size_t PassiveLogCollector::HttpStreamJobTracker::kMaxNumSources = 100; 619 const size_t PassiveLogCollector::HttpStreamJobTracker::kMaxNumSources = 100;
594 const size_t PassiveLogCollector::HttpStreamJobTracker::kMaxGraveyardSize = 25; 620 const size_t PassiveLogCollector::HttpStreamJobTracker::kMaxGraveyardSize = 25;
595 621
596 PassiveLogCollector::HttpStreamJobTracker::HttpStreamJobTracker( 622 PassiveLogCollector::HttpStreamJobTracker::HttpStreamJobTracker(
597 PassiveLogCollector* parent) 623 PassiveLogCollector* parent)
598 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, parent) { 624 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, parent) {
599 } 625 }
(...skipping 11 matching lines...) Expand all
611 AddEntryToSourceInfo(entry, out_info); 637 AddEntryToSourceInfo(entry, out_info);
612 638
613 // If the request has ended, move it to the graveyard. 639 // If the request has ended, move it to the graveyard.
614 if (entry.type == net::NetLog::TYPE_HTTP_STREAM_JOB && 640 if (entry.type == net::NetLog::TYPE_HTTP_STREAM_JOB &&
615 entry.phase == net::NetLog::PHASE_END) { 641 entry.phase == net::NetLog::PHASE_END) {
616 return ACTION_MOVE_TO_GRAVEYARD; 642 return ACTION_MOVE_TO_GRAVEYARD;
617 } 643 }
618 644
619 return ACTION_NONE; 645 return ACTION_NONE;
620 } 646 }
OLDNEW
« no previous file with comments | « chrome/browser/net/passive_log_collector.h ('k') | chrome/browser/resources/net_internals/main.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698