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

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

Issue 1558983002: [Predictor CleanUp] Remove unused variables from Predictor class APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses mmenke's review inputs. Created 4 years, 11 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
« no previous file with comments | « chrome/browser/net/predictor.h ('k') | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/predictor.h" 5 #include "chrome/browser/net/predictor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <sstream> 10 #include <sstream>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 void Predictor::RegisterProfilePrefs( 182 void Predictor::RegisterProfilePrefs(
183 user_prefs::PrefRegistrySyncable* registry) { 183 user_prefs::PrefRegistrySyncable* registry) {
184 registry->RegisterListPref(prefs::kDnsPrefetchingStartupList); 184 registry->RegisterListPref(prefs::kDnsPrefetchingStartupList);
185 registry->RegisterListPref(prefs::kDnsPrefetchingHostReferralList); 185 registry->RegisterListPref(prefs::kDnsPrefetchingHostReferralList);
186 } 186 }
187 187
188 // --------------------- Start UI methods. ------------------------------------ 188 // --------------------- Start UI methods. ------------------------------------
189 189
190 void Predictor::InitNetworkPredictor(PrefService* user_prefs, 190 void Predictor::InitNetworkPredictor(PrefService* user_prefs,
191 PrefService* local_state,
192 IOThread* io_thread, 191 IOThread* io_thread,
193 net::URLRequestContextGetter* getter, 192 net::URLRequestContextGetter* getter,
194 ProfileIOData* profile_io_data) { 193 ProfileIOData* profile_io_data) {
195 DCHECK_CURRENTLY_ON(BrowserThread::UI); 194 DCHECK_CURRENTLY_ON(BrowserThread::UI);
196 195
197 user_prefs_ = user_prefs; 196 user_prefs_ = user_prefs;
198 url_request_context_getter_ = getter; 197 url_request_context_getter_ = getter;
199 198
200 // Gather the list of hostnames to prefetch on startup. 199 // Gather the list of hostnames to prefetch on startup.
201 UrlList urls = GetPredictedUrlListAtStartup(user_prefs, local_state); 200 UrlList urls = GetPredictedUrlListAtStartup(user_prefs);
202 201
203 base::ListValue* referral_list = 202 base::ListValue* referral_list =
204 static_cast<base::ListValue*>(user_prefs->GetList( 203 static_cast<base::ListValue*>(user_prefs->GetList(
205 prefs::kDnsPrefetchingHostReferralList)->DeepCopy()); 204 prefs::kDnsPrefetchingHostReferralList)->DeepCopy());
206 205
207 // Now that we have the statistics in memory, wipe them from the Preferences 206 // Now that we have the statistics in memory, wipe them from the Preferences
208 // file. They will be serialized back on a clean shutdown. This way we only 207 // file. They will be serialized back on a clean shutdown. This way we only
209 // have to worry about clearing our in-memory state when Clearing Browsing 208 // have to worry about clearing our in-memory state when Clearing Browsing
210 // Data. 209 // Data.
211 user_prefs->ClearPref(prefs::kDnsPrefetchingStartupList); 210 user_prefs->ClearPref(prefs::kDnsPrefetchingStartupList);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 if (!CanPreresolveAndPreconnect()) 306 if (!CanPreresolveAndPreconnect())
308 return; 307 return;
309 308
310 UrlInfo::ResolutionMotivation motivation(UrlInfo::EARLY_LOAD_MOTIVATED); 309 UrlInfo::ResolutionMotivation motivation(UrlInfo::EARLY_LOAD_MOTIVATED);
311 const int kConnectionsNeeded = 1; 310 const int kConnectionsNeeded = 1;
312 PreconnectUrl(CanonicalizeUrl(url), first_party_for_cookies, motivation, 311 PreconnectUrl(CanonicalizeUrl(url), first_party_for_cookies, motivation,
313 kConnectionsNeeded, kAllowCredentialsOnPreconnectByDefault); 312 kConnectionsNeeded, kAllowCredentialsOnPreconnectByDefault);
314 PredictFrameSubresources(url.GetWithEmptyPath(), first_party_for_cookies); 313 PredictFrameSubresources(url.GetWithEmptyPath(), first_party_for_cookies);
315 } 314 }
316 315
317 UrlList Predictor::GetPredictedUrlListAtStartup( 316 UrlList Predictor::GetPredictedUrlListAtStartup(PrefService* user_prefs) {
318 PrefService* user_prefs,
319 PrefService* local_state) {
320 DCHECK_CURRENTLY_ON(BrowserThread::UI); 317 DCHECK_CURRENTLY_ON(BrowserThread::UI);
321 UrlList urls; 318 UrlList urls;
322 // Recall list of URLs we learned about during last session. 319 // Recall list of URLs we learned about during last session.
323 // This may catch secondary hostnames, pulled in by the homepages. It will 320 // This may catch secondary hostnames, pulled in by the homepages. It will
324 // also catch more of the "primary" home pages, since that was (presumably) 321 // also catch more of the "primary" home pages, since that was (presumably)
325 // rendered first (and will be rendered first this time too). 322 // rendered first (and will be rendered first this time too).
326 const base::ListValue* startup_list = 323 const base::ListValue* startup_list =
327 user_prefs->GetList(prefs::kDnsPrefetchingStartupList); 324 user_prefs->GetList(prefs::kDnsPrefetchingStartupList);
328 325
329 if (startup_list) { 326 if (startup_list) {
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 // If we omit a port, it will default to 80 or 443 as appropriate. 1289 // If we omit a port, it will default to 80 or 443 as appropriate.
1293 std::string colon_plus_port; 1290 std::string colon_plus_port;
1294 if (url.has_port()) 1291 if (url.has_port())
1295 colon_plus_port = ":" + url.port(); 1292 colon_plus_port = ":" + url.port();
1296 1293
1297 return GURL(scheme + "://" + url.host() + colon_plus_port); 1294 return GURL(scheme + "://" + url.host() + colon_plus_port);
1298 } 1295 }
1299 1296
1300 void SimplePredictor::InitNetworkPredictor( 1297 void SimplePredictor::InitNetworkPredictor(
1301 PrefService* user_prefs, 1298 PrefService* user_prefs,
1302 PrefService* local_state,
1303 IOThread* io_thread, 1299 IOThread* io_thread,
1304 net::URLRequestContextGetter* getter, 1300 net::URLRequestContextGetter* getter,
1305 ProfileIOData* profile_io_data) { 1301 ProfileIOData* profile_io_data) {
1306 // Empty function for unittests. 1302 // Empty function for unittests.
1307 } 1303 }
1308 1304
1309 void SimplePredictor::ShutdownOnUIThread() { 1305 void SimplePredictor::ShutdownOnUIThread() {
1310 SetShutdown(true); 1306 SetShutdown(true);
1311 } 1307 }
1312 1308
1313 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } 1309 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; }
1314 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } 1310 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; }
1315 1311
1316 } // namespace chrome_browser_net 1312 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor.h ('k') | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698