Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Side by Side Diff: chrome/browser/net/connect_interceptor.cc

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/connect_interceptor.h" 5 #include "chrome/browser/net/connect_interceptor.h"
6 6
7 #include "chrome/browser/net/predictor.h" 7 #include "chrome/browser/net/predictor.h"
8 #include "net/base/load_flags.h" 8 #include "net/base/load_flags.h"
9 #include "net/url_request/url_request.h" 9 #include "net/url_request/url_request.h"
10 10
(...skipping 10 matching lines...) Expand all
21 : timed_cache_(base::TimeDelta::FromSeconds( 21 : timed_cache_(base::TimeDelta::FromSeconds(
22 kMaxUnusedSocketLifetimeSecondsWithoutAGet)), 22 kMaxUnusedSocketLifetimeSecondsWithoutAGet)),
23 predictor_(predictor) { 23 predictor_(predictor) {
24 DCHECK(predictor); 24 DCHECK(predictor);
25 } 25 }
26 26
27 ConnectInterceptor::~ConnectInterceptor() { 27 ConnectInterceptor::~ConnectInterceptor() {
28 } 28 }
29 29
30 net::URLRequestJob* ConnectInterceptor::MaybeIntercept( 30 net::URLRequestJob* ConnectInterceptor::MaybeIntercept(
31 net::URLRequest* request) const { 31 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
32 GURL request_scheme_host(Predictor::CanonicalizeUrl(request->url())); 32 GURL request_scheme_host(Predictor::CanonicalizeUrl(request->url()));
33 if (request_scheme_host == GURL::EmptyGURL()) 33 if (request_scheme_host == GURL::EmptyGURL())
34 return NULL; 34 return NULL;
35 35
36 // Learn what URLs are likely to be needed during next startup. 36 // Learn what URLs are likely to be needed during next startup.
37 predictor_->LearnAboutInitialNavigation(request_scheme_host); 37 predictor_->LearnAboutInitialNavigation(request_scheme_host);
38 38
39 bool redirected_host = false; 39 bool redirected_host = false;
40 if (request->referrer().empty()) { 40 if (request->referrer().empty()) {
41 if (request->url() != request->original_url()) { 41 if (request->url() != request->original_url()) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Subresources for main frames usually get predicted when we detected the 82 // Subresources for main frames usually get predicted when we detected the
83 // main frame request - way back in RenderViewHost::Navigate. So only handle 83 // main frame request - way back in RenderViewHost::Navigate. So only handle
84 // predictions now for subresources or for redirected hosts. 84 // predictions now for subresources or for redirected hosts.
85 if ((request->load_flags() & net::LOAD_SUB_FRAME) || redirected_host) 85 if ((request->load_flags() & net::LOAD_SUB_FRAME) || redirected_host)
86 predictor_->PredictFrameSubresources(request_scheme_host); 86 predictor_->PredictFrameSubresources(request_scheme_host);
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 net::URLRequestJob* ConnectInterceptor::MaybeInterceptResponse( 90 net::URLRequestJob* ConnectInterceptor::MaybeInterceptResponse(
91 net::URLRequest* request) const { 91 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
92 return NULL; 92 return NULL;
93 } 93 }
94 94
95 net::URLRequestJob* ConnectInterceptor::MaybeInterceptRedirect( 95 net::URLRequestJob* ConnectInterceptor::MaybeInterceptRedirect(
96 const GURL& location, 96 const GURL& location,
97 net::URLRequest* request) const { 97 net::URLRequest* request,
98 net::NetworkDelegate* network_delegate) const {
98 return NULL; 99 return NULL;
99 } 100 }
100 101
101 ConnectInterceptor::TimedCache::TimedCache(const base::TimeDelta& max_duration) 102 ConnectInterceptor::TimedCache::TimedCache(const base::TimeDelta& max_duration)
102 : mru_cache_(UrlMruTimedCache::NO_AUTO_EVICT), 103 : mru_cache_(UrlMruTimedCache::NO_AUTO_EVICT),
103 max_duration_(max_duration) { 104 max_duration_(max_duration) {
104 } 105 }
105 106
106 // Make Clang compilation happy with explicit destructor. 107 // Make Clang compilation happy with explicit destructor.
107 ConnectInterceptor::TimedCache::~TimedCache() {} 108 ConnectInterceptor::TimedCache::~TimedCache() {}
(...skipping 11 matching lines...) Expand all
119 } 120 }
120 return mru_cache_.end() != mru_cache_.Peek(url); 121 return mru_cache_.end() != mru_cache_.Peek(url);
121 } 122 }
122 123
123 void ConnectInterceptor::TimedCache::SetRecentlySeen(const GURL& url) const { 124 void ConnectInterceptor::TimedCache::SetRecentlySeen(const GURL& url) const {
124 DCHECK_EQ(url.GetWithEmptyPath(), url); 125 DCHECK_EQ(url.GetWithEmptyPath(), url);
125 mru_cache_.Put(url, base::TimeTicks::Now()); 126 mru_cache_.Put(url, base::TimeTicks::Now());
126 } 127 }
127 128
128 } // namespace chrome_browser_net 129 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/connect_interceptor.h ('k') | chrome/browser/net/url_request_mock_link_doctor_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698