summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/io_thread.cc6
-rw-r--r--chrome/browser/net/connection_tester.cc2
-rw-r--r--chrome/browser/net/passive_log_collector.cc51
-rw-r--r--chrome/browser/net/passive_log_collector.h32
-rw-r--r--chrome/browser/resources/net_internals/main.css5
-rw-r--r--chrome/browser/resources/net_internals/sourceentry.js29
6 files changed, 112 insertions, 13 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 4f9a244..1a0fdbf 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -27,7 +27,7 @@
namespace {
-net::HostResolver* CreateGlobalHostResolver() {
+net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
size_t parallelism = net::HostResolver::kDefaultParallelism;
@@ -47,7 +47,7 @@ net::HostResolver* CreateGlobalHostResolver() {
}
net::HostResolver* global_host_resolver =
- net::CreateSystemHostResolver(parallelism);
+ net::CreateSystemHostResolver(parallelism, net_log);
// Determine if we should disable IPv6 support.
if (!command_line.HasSwitch(switches::kEnableIPv6)) {
@@ -186,7 +186,7 @@ void IOThread::Init() {
network_change_observer_.reset(
new LoggingNetworkChangeObserver(globals_->net_log.get()));
- globals_->host_resolver = CreateGlobalHostResolver();
+ globals_->host_resolver = CreateGlobalHostResolver(globals_->net_log.get());
globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
globals_->host_resolver));
}
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 1dd598e..5f71795 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -82,7 +82,7 @@ class ExperimentURLRequestContext : public URLRequestContext {
// Create a vanilla HostResolver that disables caching.
const size_t kMaxJobs = 50u;
scoped_refptr<net::HostResolverImpl> impl =
- new net::HostResolverImpl(NULL, NULL, kMaxJobs);
+ new net::HostResolverImpl(NULL, NULL, kMaxJobs, NULL);
*host_resolver = impl;
diff --git a/chrome/browser/net/passive_log_collector.cc b/chrome/browser/net/passive_log_collector.cc
index 152d332..adc6500 100644
--- a/chrome/browser/net/passive_log_collector.cc
+++ b/chrome/browser/net/passive_log_collector.cc
@@ -57,7 +57,9 @@ PassiveLogCollector::PassiveLogCollector()
trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] =
&init_proxy_resolver_tracker_;
trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_;
-
+ trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] =
+ &dns_request_tracker_;
+ trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_;
// Make sure our mapping is up-to-date.
for (size_t i = 0; i < arraysize(trackers_); ++i)
DCHECK(trackers_[i]) << "Unhandled SourceType: " << i;
@@ -485,3 +487,50 @@ PassiveLogCollector::SpdySessionTracker::DoAddEntry(const Entry& entry,
return ACTION_NONE;
}
}
+
+//----------------------------------------------------------------------------
+// DNSRequestTracker
+//----------------------------------------------------------------------------
+
+const size_t PassiveLogCollector::DNSRequestTracker::kMaxNumSources = 200;
+const size_t PassiveLogCollector::DNSRequestTracker::kMaxGraveyardSize = 20;
+
+PassiveLogCollector::DNSRequestTracker::DNSRequestTracker()
+ : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
+}
+
+PassiveLogCollector::SourceTracker::Action
+PassiveLogCollector::DNSRequestTracker::DoAddEntry(const Entry& entry,
+ SourceInfo* out_info) {
+ AddEntryToSourceInfo(entry, out_info);
+ if (entry.type == net::NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST &&
+ entry.phase == net::NetLog::PHASE_END) {
+ return ACTION_MOVE_TO_GRAVEYARD;
+ } else {
+ return ACTION_NONE;
+ }
+}
+
+//----------------------------------------------------------------------------
+// DNSJobTracker
+//----------------------------------------------------------------------------
+
+const size_t PassiveLogCollector::DNSJobTracker::kMaxNumSources = 100;
+const size_t PassiveLogCollector::DNSJobTracker::kMaxGraveyardSize = 15;
+
+PassiveLogCollector::DNSJobTracker::DNSJobTracker()
+ : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
+}
+
+PassiveLogCollector::SourceTracker::Action
+PassiveLogCollector::DNSJobTracker::DoAddEntry(const Entry& entry,
+ SourceInfo* out_info) {
+ AddEntryToSourceInfo(entry, out_info);
+ if (entry.type == net::NetLog::TYPE_HOST_RESOLVER_IMPL_JOB &&
+ entry.phase == net::NetLog::PHASE_END) {
+ return ACTION_MOVE_TO_GRAVEYARD;
+ } else {
+ return ACTION_NONE;
+ }
+}
+
diff --git a/chrome/browser/net/passive_log_collector.h b/chrome/browser/net/passive_log_collector.h
index e7d741f..8ffd459 100644
--- a/chrome/browser/net/passive_log_collector.h
+++ b/chrome/browser/net/passive_log_collector.h
@@ -283,6 +283,36 @@ class PassiveLogCollector : public ChromeNetLog::Observer {
DISALLOW_COPY_AND_ASSIGN(SpdySessionTracker);
};
+ // Tracks the log entries for the last seen SOURCE_HOST_RESOLVER_IMPL_REQUEST.
+ class DNSRequestTracker : public SourceTracker {
+ public:
+ static const size_t kMaxNumSources;
+ static const size_t kMaxGraveyardSize;
+
+ DNSRequestTracker();
+
+ protected:
+ virtual Action DoAddEntry(const Entry& entry, SourceInfo* out_info);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DNSRequestTracker);
+ };
+
+ // Tracks the log entries for the last seen SOURCE_HOST_RESOLVER_IMPL_JOB.
+ class DNSJobTracker : public SourceTracker {
+ public:
+ static const size_t kMaxNumSources;
+ static const size_t kMaxGraveyardSize;
+
+ DNSJobTracker();
+
+ protected:
+ virtual Action DoAddEntry(const Entry& entry, SourceInfo* out_info);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DNSJobTracker);
+ };
+
PassiveLogCollector();
~PassiveLogCollector();
@@ -317,6 +347,8 @@ class PassiveLogCollector : public ChromeNetLog::Observer {
RequestTracker socket_stream_tracker_;
InitProxyResolverTracker init_proxy_resolver_tracker_;
SpdySessionTracker spdy_session_tracker_;
+ DNSRequestTracker dns_request_tracker_;
+ DNSJobTracker dns_job_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
diff --git a/chrome/browser/resources/net_internals/main.css b/chrome/browser/resources/net_internals/main.css
index ecef780..13b22b2 100644
--- a/chrome/browser/resources/net_internals/main.css
+++ b/chrome/browser/resources/net_internals/main.css
@@ -87,6 +87,11 @@ body {
color: blue;
}
+#requestsListTableBody .source_HOST_RESOLVER_IMPL_JOB,
+#requestsListTableBody .source_HOST_RESOLVER_IMPL_REQUEST {
+ color: #308080;
+}
+
#requestsListTableBody .source_SOCKET {
color: purple;
}
diff --git a/chrome/browser/resources/net_internals/sourceentry.js b/chrome/browser/resources/net_internals/sourceentry.js
index 2cbbf4e..2a74668 100644
--- a/chrome/browser/resources/net_internals/sourceentry.js
+++ b/chrome/browser/resources/net_internals/sourceentry.js
@@ -67,8 +67,11 @@ SourceEntry.prototype.update = function(logEntry) {
var curStartEntry = this.getStartEntry_();
// If we just got the first entry for this source.
- if (!prevStartEntry && curStartEntry) {
- this.createRow_();
+ if (prevStartEntry != curStartEntry) {
+ if (!prevStartEntry)
+ this.createRow_();
+ else
+ this.updateDescription_();
// Only apply the filter during the first update.
// TODO(eroman): once filters use other data, apply it on each update.
@@ -116,6 +119,11 @@ SourceEntry.prototype.onMouseout_ = function() {
this.setMouseoverStyle(false);
};
+SourceEntry.prototype.updateDescription_ = function() {
+ this.descriptionCell_.innerHTML = '';
+ addTextNode(this.descriptionCell_, this.getDescription());
+}
+
SourceEntry.prototype.createRow_ = function() {
// Create a row.
var tr = addNode(this.parentView_.tableBody_, 'tr');
@@ -131,6 +139,7 @@ SourceEntry.prototype.createRow_ = function() {
var typeCell = addNode(tr, 'td');
var descriptionCell = addNode(tr, 'td');
+ this.descriptionCell_ = descriptionCell;
// Connect listeners.
checkbox.onchange = this.onCheckboxToggled_.bind(this);
@@ -150,7 +159,7 @@ SourceEntry.prototype.createRow_ = function() {
addTextNode(idCell, "-");
var sourceTypeString = this.getSourceTypeString();
addTextNode(typeCell, sourceTypeString);
- addTextNode(descriptionCell, this.getDescription());
+ this.updateDescription_();
// Add a CSS classname specific to this source type (so CSS can specify
// different stylings for different types).
@@ -182,6 +191,9 @@ SourceEntry.prototype.getDescription = function() {
return e.params.url;
case LogSourceType.CONNECT_JOB:
return e.params.group_name;
+ case LogSourceType.HOST_RESOLVER_IMPL_REQUEST:
+ case LogSourceType.HOST_RESOLVER_IMPL_JOB:
+ return e.params.host;
}
return '';
@@ -196,11 +208,12 @@ SourceEntry.prototype.getDescription = function() {
SourceEntry.prototype.getStartEntry_ = function() {
if (this.entries_.length < 1)
return undefined;
- if (this.entries_[0].type != LogEventType.REQUEST_ALIVE)
- return this.entries_[0];
- if (this.entries_.length < 2)
- return undefined;
- return this.entries_[1];
+ if (this.entries_.length >= 2) {
+ if (this.entries_[0].type == LogEventType.REQUEST_ALIVE ||
+ this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB)
+ return this.entries_[1];
+ }
+ return this.entries_[0];
};
SourceEntry.prototype.getLogEntries = function() {