summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/dns_master.cc
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-27 14:35:44 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-27 14:35:44 +0000
commit602faf3ca5a9b1753d1f4f10639b134555d60352 (patch)
tree3533436e773b9648f1f9660f97cb14656f0f756c /chrome/browser/net/dns_master.cc
parenta1e646a13a0041b19b9e55fef1d7d228835cde3d (diff)
downloadchromium_src-602faf3ca5a9b1753d1f4f10639b134555d60352.zip
chromium_src-602faf3ca5a9b1753d1f4f10639b134555d60352.tar.gz
chromium_src-602faf3ca5a9b1753d1f4f10639b134555d60352.tar.bz2
Refactor DNS A/B experient, and add test of congestion time limits
I added another option in the DNS experiment: user 2 seconds or 500ms for the congestion limit (that causes pre-resolutions to be discarded from the queue. The code in browser_main.cc was getting toooo large, so I pulled all the experiment code into dns_global.cc. BUG=15479 r=eroman Review URL: http://codereview.chromium.org/147215 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_master.cc')
-rw-r--r--chrome/browser/net/dns_master.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/net/dns_master.cc b/chrome/browser/net/dns_master.cc
index 8cbae92..2cc50ff 100644
--- a/chrome/browser/net/dns_master.cc
+++ b/chrome/browser/net/dns_master.cc
@@ -20,6 +20,8 @@
#include "net/base/host_resolver.h"
#include "net/base/net_errors.h"
+using base::TimeDelta;
+
namespace chrome_browser_net {
class DnsMaster::LookupRequest {
@@ -68,10 +70,12 @@ class DnsMaster::LookupRequest {
DnsMaster::DnsMaster(net::HostResolver* host_resolver,
MessageLoop* host_resolver_loop,
+ TimeDelta max_queue_delay,
size_t max_concurrent)
: peak_pending_lookups_(0),
shutdown_(false),
max_concurrent_lookups_(max_concurrent),
+ max_queue_delay_(max_queue_delay),
host_resolver_(host_resolver),
host_resolver_loop_(host_resolver_loop) {
}
@@ -350,7 +354,7 @@ void DnsMaster::GetHtmlInfo(std::string* output) {
}
if (!it->second.was_found())
continue; // Still being processed.
- if (base::TimeDelta() != it->second.benefits_remaining()) {
+ if (TimeDelta() != it->second.benefits_remaining()) {
network_hits.push_back(it->second); // With no benefit yet.
continue;
}
@@ -385,7 +389,7 @@ DnsHostInfo* DnsMaster::PreLockedResolve(
const std::string& hostname,
DnsHostInfo::ResolutionMotivation motivation) {
// DCHECK(We have the lock);
- DCHECK(0 != hostname.length());
+ DCHECK_NE(0u, hostname.length());
if (shutdown_)
return NULL;
@@ -444,9 +448,7 @@ void DnsMaster::PreLockedScheduleLookups() {
bool DnsMaster::PreLockedCongestionControlPerformed(DnsHostInfo* info) {
// Note: queue_duration is ONLY valid after we go to assigned state.
- // TODO(jar): Tune selection of arbitrary 1 second constant. Add plumbing so
- // that this can be set as part of an A/B experiment.
- if (info->queue_duration() < base::TimeDelta::FromSeconds(1))
+ if (info->queue_duration() < max_queue_delay_)
return false;
// We need to discard all entries in our queue, as we're keeping them waiting
// too long. By doing this, we'll have a chance to quickly service urgent