summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 17:26:13 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 17:26:13 +0000
commitd60c79650e1be14bb75b25362b2eadd0c76b48ba (patch)
tree13c7de9cd16935bd495a963ae04df2778d12fa04 /chrome/browser/net
parentc0918c5df71848044da5e6268270fe2d640ab0bc (diff)
downloadchromium_src-d60c79650e1be14bb75b25362b2eadd0c76b48ba.zip
chromium_src-d60c79650e1be14bb75b25362b2eadd0c76b48ba.tar.gz
chromium_src-d60c79650e1be14bb75b25362b2eadd0c76b48ba.tar.bz2
First pass at adding http/backend cache events to the NetLog.
Adds sources and events for ActiveCacheEntry and EntryImpl objects, as well as adding cache read/write events to HttpCacheTransactions. Most new read/write events are only logged when NetLog logging mode is set to log all events. Also, net-internals now merges begin and end events that have parameters, as long as only one of them has parameters. I think this increases readability, at the cost of making it a little more difficult to follow timings with just the "st" values. BUG=59382 TEST=none yet, other than updates to existing tests. Review URL: http://codereview.chromium.org/4067002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/connection_tester.cc1
-rw-r--r--chrome/browser/net/passive_log_collector.cc26
-rw-r--r--chrome/browser/net/passive_log_collector.h17
3 files changed, 44 insertions, 0 deletions
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 18960eb..f23d619 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -71,6 +71,7 @@ class ExperimentURLRequestContext : public URLRequestContext {
dnsrr_resolver_, NULL /* dns_cert_checker */,
NULL /* ssl_host_info_factory */, proxy_service_,
ssl_config_service_, http_auth_handler_factory_, NULL, NULL),
+ NULL /* net_log */,
net::HttpCache::DefaultBackend::InMemory(0));
// In-memory cookie store.
cookie_store_ = new net::CookieMonster(NULL, NULL);
diff --git a/chrome/browser/net/passive_log_collector.cc b/chrome/browser/net/passive_log_collector.cc
index 0d41479..21e2935 100644
--- a/chrome/browser/net/passive_log_collector.cc
+++ b/chrome/browser/net/passive_log_collector.cc
@@ -70,6 +70,7 @@ PassiveLogCollector::PassiveLogCollector()
trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] =
&dns_request_tracker_;
trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_;
+ trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_;
// Make sure our mapping is up-to-date.
for (size_t i = 0; i < arraysize(trackers_); ++i)
DCHECK(trackers_[i]) << "Unhandled SourceType: " << i;
@@ -560,3 +561,28 @@ PassiveLogCollector::DNSJobTracker::DoAddEntry(const ChromeNetLog::Entry& entry,
return ACTION_NONE;
}
}
+
+//----------------------------------------------------------------------------
+// DiskCacheEntryTracker
+//----------------------------------------------------------------------------
+
+const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxNumSources = 100;
+const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxGraveyardSize = 25;
+
+PassiveLogCollector::DiskCacheEntryTracker::DiskCacheEntryTracker()
+ : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
+}
+
+PassiveLogCollector::SourceTracker::Action
+PassiveLogCollector::DiskCacheEntryTracker::DoAddEntry(
+ const ChromeNetLog::Entry& entry, SourceInfo* out_info) {
+ AddEntryToSourceInfo(entry, out_info);
+
+ // If the request has ended, move it to the graveyard.
+ if (entry.type == net::NetLog::TYPE_DISK_CACHE_ENTRY &&
+ entry.phase == net::NetLog::PHASE_END) {
+ return ACTION_MOVE_TO_GRAVEYARD;
+ }
+
+ return ACTION_NONE;
+}
diff --git a/chrome/browser/net/passive_log_collector.h b/chrome/browser/net/passive_log_collector.h
index 114e439..a415d59 100644
--- a/chrome/browser/net/passive_log_collector.h
+++ b/chrome/browser/net/passive_log_collector.h
@@ -304,6 +304,22 @@ class PassiveLogCollector : public ChromeNetLog::ThreadSafeObserver {
DISALLOW_COPY_AND_ASSIGN(DNSJobTracker);
};
+ // Tracks the log entries for the last seen SOURCE_DISK_CACHE_ENTRY.
+ class DiskCacheEntryTracker : public SourceTracker {
+ public:
+ static const size_t kMaxNumSources;
+ static const size_t kMaxGraveyardSize;
+
+ DiskCacheEntryTracker();
+
+ protected:
+ virtual Action DoAddEntry(const ChromeNetLog::Entry& entry,
+ SourceInfo* out_info);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DiskCacheEntryTracker);
+ };
+
PassiveLogCollector();
~PassiveLogCollector();
@@ -340,6 +356,7 @@ class PassiveLogCollector : public ChromeNetLog::ThreadSafeObserver {
SpdySessionTracker spdy_session_tracker_;
DNSRequestTracker dns_request_tracker_;
DNSJobTracker dns_job_tracker_;
+ DiskCacheEntryTracker disk_cache_entry_tracker_;
// This array maps each NetLog::SourceType to one of the tracker instances
// defined above. Use of this array avoid duplicating the list of trackers