diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-27 14:35:44 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-27 14:35:44 +0000 |
commit | 602faf3ca5a9b1753d1f4f10639b134555d60352 (patch) | |
tree | 3533436e773b9648f1f9660f97cb14656f0f756c /chrome/browser/net/dns_global.h | |
parent | a1e646a13a0041b19b9e55fef1d7d228835cde3d (diff) | |
download | chromium_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_global.h')
-rw-r--r-- | chrome/browser/net/dns_global.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/chrome/browser/net/dns_global.h b/chrome/browser/net/dns_global.h index e27062e..aecfe8c 100644 --- a/chrome/browser/net/dns_global.h +++ b/chrome/browser/net/dns_global.h @@ -11,10 +11,13 @@ #ifndef CHROME_BROWSER_NET_DNS_GLOBAL_H_ #define CHROME_BROWSER_NET_DNS_GLOBAL_H_ -#include "chrome/browser/net/dns_master.h" #include <string> +#include "base/field_trial.h" +#include "base/scoped_ptr.h" +#include "chrome/browser/net/dns_master.h" + class PrefService; namespace net { @@ -25,7 +28,8 @@ namespace chrome_browser_net { // Initialize dns prefetching subsystem. Must be called before any other // functions. -void InitDnsPrefetch(size_t max_concurrent, PrefService* user_prefs); +void InitDnsPrefetch(TimeDelta max_queue_delay, size_t max_concurrent, + PrefService* user_prefs); // Cancel pending lookup requests and don't make new ones. Does nothing // if dns prefetching has not been initialized (to simplify its usage). @@ -66,19 +70,23 @@ void TrimSubresourceReferrers(); // Helper class to handle global init and shutdown. class DnsPrefetcherInit { public: - // Too many concurrent lookups negate benefits of prefetching by trashing the - // OS cache before all resource loading is complete. This is the default. + // Too many concurrent lookups negate benefits of prefetching by trashing + // the OS cache before all resource loading is complete. + // This is the default. static const size_t kMaxConcurrentLookups; - DnsPrefetcherInit(size_t max_concurrent, PrefService* user_prefs) { - InitDnsPrefetch(max_concurrent, user_prefs); - } + // When prefetch requests are queued beyond some period of time, then the + // system is congested, and we need to clear all queued requests to get out + // of that state. The following is the suggested default time limit. + static const int kMaxQueueingDelayMs; - ~DnsPrefetcherInit() { - FreeDnsPrefetchResources(); - } + DnsPrefetcherInit(PrefService* user_prefs, PrefService* local_state); + ~DnsPrefetcherInit(); private: + // Maintain a field trial instance when we do A/B testing. + scoped_refptr<FieldTrial> trial_; + DISALLOW_COPY_AND_ASSIGN(DnsPrefetcherInit); }; |