summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 21:58:50 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 21:58:50 +0000
commit8d0a2d717c070cf766c2664883cac91c510ff4fa (patch)
tree4ced3fc91a3debb96d2426a2f2534a121a385dfd /chrome/browser/net
parent08a8ad95ade43689f5167c7a90c7be986fcee3d4 (diff)
downloadchromium_src-8d0a2d717c070cf766c2664883cac91c510ff4fa.zip
chromium_src-8d0a2d717c070cf766c2664883cac91c510ff4fa.tar.gz
chromium_src-8d0a2d717c070cf766c2664883cac91c510ff4fa.tar.bz2
Support predictive redundant preconnection
When a page loads additional content via secondary connections from its own domain, this CL should learn from those connections, and reserve additional connections during the primary connection. r=mbelshe@chromium.org bug=72666 Review URL: http://codereview.chromium.org/6487019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/connect_interceptor.cc14
-rw-r--r--chrome/browser/net/predictor.cc3
2 files changed, 7 insertions, 10 deletions
diff --git a/chrome/browser/net/connect_interceptor.cc b/chrome/browser/net/connect_interceptor.cc
index 3809da2..56ecbc9 100644
--- a/chrome/browser/net/connect_interceptor.cc
+++ b/chrome/browser/net/connect_interceptor.cc
@@ -49,19 +49,15 @@ net::URLRequestJob* ConnectInterceptor::MaybeIntercept(
}
} else {
GURL referring_scheme_host = GURL(request->referrer()).GetWithEmptyPath();
- if (referring_scheme_host == request_scheme_host) {
- // There is nothing to learn about preconnections when the referrer is
- // already the site needed in the request URL. Similarly, we've already
- // made any/all predictions when we navigated to the referring host, so we
- // can bail out here. This will also avoid useless boosting of the number
- // of times we navigated to this site, which was already accounted for by
- // the navigation to the referrering_url.
- return NULL;
- }
bool is_subresource = !(request->load_flags() & net::LOAD_MAIN_FRAME);
// Learn about our referring URL, for use in the future.
if (is_subresource)
LearnFromNavigation(referring_scheme_host, request_scheme_host);
+ if (referring_scheme_host == request_scheme_host) {
+ // We've already made any/all predictions when we navigated to the
+ // referring host, so we can bail out here.
+ return NULL;
+ }
}
// Subresources for main frames usually get predicted when we detected the
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
index 46dcf1f..327d709 100644
--- a/chrome/browser/net/predictor.cc
+++ b/chrome/browser/net/predictor.cc
@@ -133,7 +133,6 @@ void Predictor::LearnFromNavigation(const GURL& referring_url,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(referring_url == referring_url.GetWithEmptyPath());
DCHECK(target_url == target_url.GetWithEmptyPath());
- DCHECK(target_url != referring_url);
if (referring_url.has_host()) {
referrers_[referring_url].SuggestHost(target_url);
}
@@ -258,6 +257,8 @@ void Predictor::PrepareFrameSubresources(const GURL& url) {
evalution = PRECONNECTION;
future_url->second.IncrementPreconnectionCount();
int count = static_cast<int>(std::ceil(connection_expectation));
+ if (url.host() == future_url->first.host())
+ ++count;
Preconnect::PreconnectOnIOThread(future_url->first, motivation, count);
} else if (connection_expectation > kDNSPreresolutionWorthyExpectedValue) {
evalution = PRERESOLUTION;