diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-19 16:02:50 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-19 16:02:50 +0000 |
commit | b503914167a6274410f0e36f44f1f2e2ddf3ee32 (patch) | |
tree | fd6ac7eb116c79814b327c8ecf468a4f290ac337 /chrome/browser/net/connect_interceptor.cc | |
parent | d237cec53e16749a35c6f9c0cc5920eed8eabb36 (diff) | |
download | chromium_src-b503914167a6274410f0e36f44f1f2e2ddf3ee32.zip chromium_src-b503914167a6274410f0e36f44f1f2e2ddf3ee32.tar.gz chromium_src-b503914167a6274410f0e36f44f1f2e2ddf3ee32.tar.bz2 |
Revert "Modifying prefetch to account for multi-profile."
This appears to make all the CF bots crash in chrome_frame_net_tests.
This reverts commit r97446.
BUG=89937
TEST=n/a
TBR=rlp
Review URL: http://codereview.chromium.org/7685009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/connect_interceptor.cc')
-rw-r--r-- | chrome/browser/net/connect_interceptor.cc | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/chrome/browser/net/connect_interceptor.cc b/chrome/browser/net/connect_interceptor.cc index 0ea6dbd..5938df2 100644 --- a/chrome/browser/net/connect_interceptor.cc +++ b/chrome/browser/net/connect_interceptor.cc @@ -4,9 +4,8 @@ #include "chrome/browser/net/connect_interceptor.h" -#include "chrome/browser/net/predictor.h" +#include "chrome/browser/net/predictor_api.h" #include "net/base/load_flags.h" -#include "net/url_request/url_request.h" namespace chrome_browser_net { @@ -17,24 +16,24 @@ namespace chrome_browser_net { // TODO(jar): We should do a persistent field trial to validate/optimize this. static const int kMaxUnusedSocketLifetimeSecondsWithoutAGet = 10; -ConnectInterceptor::ConnectInterceptor(Predictor* predictor) +ConnectInterceptor::ConnectInterceptor() : timed_cache_(base::TimeDelta::FromSeconds( - kMaxUnusedSocketLifetimeSecondsWithoutAGet)), - predictor_(predictor) { - DCHECK(predictor); + kMaxUnusedSocketLifetimeSecondsWithoutAGet)) { + net::URLRequest::Deprecated::RegisterRequestInterceptor(this); } ConnectInterceptor::~ConnectInterceptor() { + net::URLRequest::Deprecated::UnregisterRequestInterceptor(this); } net::URLRequestJob* ConnectInterceptor::MaybeIntercept( - net::URLRequest* request) const { + net::URLRequest* request) { GURL request_scheme_host(Predictor::CanonicalizeUrl(request->url())); if (request_scheme_host == GURL::EmptyGURL()) return NULL; // Learn what URLs are likely to be needed during next startup. - predictor_->LearnAboutInitialNavigation(request_scheme_host); + LearnAboutInitialNavigation(request_scheme_host); bool redirected_host = false; if (request->referrer().empty()) { @@ -56,8 +55,7 @@ net::URLRequestJob* ConnectInterceptor::MaybeIntercept( if (request->original_url().path().length() <= 1 && timed_cache_.WasRecentlySeen(original_scheme_host)) { // TODO(jar): These definite redirects could be learned much faster. - predictor_->LearnFromNavigation(original_scheme_host, - request_scheme_host); + LearnFromNavigation(original_scheme_host, request_scheme_host); } } } @@ -66,8 +64,7 @@ net::URLRequestJob* ConnectInterceptor::MaybeIntercept( bool is_subresource = !(request->load_flags() & net::LOAD_MAIN_FRAME); // Learn about our referring URL, for use in the future. if (is_subresource && timed_cache_.WasRecentlySeen(referring_scheme_host)) - predictor_->LearnFromNavigation(referring_scheme_host, - request_scheme_host); + 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. @@ -83,18 +80,18 @@ net::URLRequestJob* ConnectInterceptor::MaybeIntercept( // main frame request - way back in RenderViewHost::Navigate. So only handle // predictions now for subresources or for redirected hosts. if ((request->load_flags() & net::LOAD_SUB_FRAME) || redirected_host) - predictor_->PredictFrameSubresources(request_scheme_host); + PredictFrameSubresources(request_scheme_host); return NULL; } net::URLRequestJob* ConnectInterceptor::MaybeInterceptResponse( - net::URLRequest* request) const { + net::URLRequest* request) { return NULL; } net::URLRequestJob* ConnectInterceptor::MaybeInterceptRedirect( - const GURL& location, - net::URLRequest* request) const { + net::URLRequest* request, + const GURL& location) { return NULL; } @@ -106,7 +103,7 @@ ConnectInterceptor::TimedCache::TimedCache(const base::TimeDelta& max_duration) // Make Clang compilation happy with explicit destructor. ConnectInterceptor::TimedCache::~TimedCache() {} -bool ConnectInterceptor::TimedCache::WasRecentlySeen(const GURL& url) const { +bool ConnectInterceptor::TimedCache::WasRecentlySeen(const GURL& url) { DCHECK_EQ(url.GetWithEmptyPath(), url); // Evict any overly old entries. base::TimeTicks now = base::TimeTicks::Now(); @@ -120,7 +117,7 @@ bool ConnectInterceptor::TimedCache::WasRecentlySeen(const GURL& url) const { return mru_cache_.end() != mru_cache_.Peek(url); } -void ConnectInterceptor::TimedCache::SetRecentlySeen(const GURL& url) const { +void ConnectInterceptor::TimedCache::SetRecentlySeen(const GURL& url) { DCHECK_EQ(url.GetWithEmptyPath(), url); mru_cache_.Put(url, base::TimeTicks::Now()); } |