summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/referrer.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 22:37:23 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 22:37:23 +0000
commitf4ef861ba773e66d1c6e7e023a38db32afdd531d (patch)
tree6ae53ffb969fa9ddf39131deb79c15b2ae8fa592 /chrome/browser/net/referrer.h
parent175aa689f7f9b705ee2c6eebb29aca1c93c540d5 (diff)
downloadchromium_src-f4ef861ba773e66d1c6e7e023a38db32afdd531d.zip
chromium_src-f4ef861ba773e66d1c6e7e023a38db32afdd531d.tar.gz
chromium_src-f4ef861ba773e66d1c6e7e023a38db32afdd531d.tar.bz2
Support both preconnection, and pre-resolution for subresources
With this change, both preconnection and preresolution are enabled when the --enable-preconnection flag is turned on. I'm expecting to enable this feature by default soon, so as to better tune the parameters. BUG=42694 r=mbelshe Review URL: http://codereview.chromium.org/3032014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/referrer.h')
-rw-r--r--chrome/browser/net/referrer.h44
1 files changed, 24 insertions, 20 deletions
diff --git a/chrome/browser/net/referrer.h b/chrome/browser/net/referrer.h
index 267648a..2e43f89 100644
--- a/chrome/browser/net/referrer.h
+++ b/chrome/browser/net/referrer.h
@@ -38,28 +38,32 @@ class ReferrerValue {
// Used during deserialization.
void SetSubresourceUseRate(double rate) { subresource_use_rate_ = rate; }
- base::TimeDelta latency() const { return latency_; }
base::Time birth_time() const { return birth_time_; }
- void AccrueValue(const base::TimeDelta& delta) { latency_ += delta; }
- // Record the fact that we navigated to the associated subresource URL.
+ // Record the fact that we navigated to the associated subresource URL. This
+ // will increase the value of the expected subresource_use_rate_
void SubresourceIsNeeded();
- // Evaluate if it is worth making this preconnection, and return true if it
- // seems worthwhile. As a side effect, we also tally the proconnection for
- // statistical purposes only.
- bool IsPreconnectWorthDoing();
+ // Record the fact that the referrer of this subresource was observed. This
+ // will diminish the expected subresource_use_rate_ (and will only be
+ // counteracted later if we really needed this subresource as a consequence
+ // of our associated referrer.)
+ void ReferrerWasObserved();
int64 navigation_count() const { return navigation_count_; }
- int64 preconnection_count() const { return preconnection_count_; }
double subresource_use_rate() const { return subresource_use_rate_; }
- // Reduce the latency figure by a factor of 2, and return true if any latency
- // remains.
+ int64 preconnection_count() const { return preconnection_count_; }
+ void IncrementPreconnectionCount() { ++preconnection_count_; }
+
+ int64 preresolution_count() const { return preresolution_count_; }
+ void preresolution_increment() { ++preresolution_count_; }
+
+ // Reduce the latency figure by a factor of 2, and return true if it still has
+ // subresources that could potentially be used.
bool Trim();
private:
- base::TimeDelta latency_; // Accumulated DNS resolution latency savings.
const base::Time birth_time_;
// The number of times this item was navigated to with the fixed referrer.
@@ -69,7 +73,12 @@ class ReferrerValue {
// referrer.
int64 preconnection_count_;
- // A smoothed estimate of the probability that a connection will be needed.
+ // The number of times this item was pre-resolved (via DNS) as a consequence
+ // of its referrer.
+ int64 preresolution_count_;
+
+ // A smoothed estimate of the expected number of connections that will be made
+ // to this subresource.
double subresource_use_rate_;
};
@@ -99,14 +108,9 @@ class Referrer : public SubresourceMap {
// discarded to make room for this insertion.
void SuggestHost(const GURL& url);
- // Record additional usefulness of having this url in the list.
- // Value is expressed as positive latency of amount delta.
- void AccrueValue(const base::TimeDelta& delta,
- const GURL& url);
-
- // Trim the Referrer, by first diminishing (scaling down) the latency for each
- // ReferredValue.
- // Returns true if there are any referring names with some latency left.
+ // Trim the Referrer, by first diminishing (scaling down) the subresource
+ // use expectation for each ReferredValue.
+ // Returns true if there are any referring names left.
bool Trim();
// Provide methods for persisting, and restoring contents into a Value class.