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

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 633373005: Use more flexible field trial control on resource prefetching for mobile web (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_common_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/predictors/resource_prefetch_predictor.cc
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index d0b02a23f78ce0e8ef9c78a3566ea36f35e183f5..3af331c24efb96131d491e5c9019269d6072522d 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -312,9 +312,9 @@ ResourcePrefetchPredictor::ResourcePrefetchPredictor(
// Some form of learning has to be enabled.
DCHECK(config_.IsLearningEnabled());
- if (config_.IsURLPrefetchingEnabled())
+ if (config_.IsURLPrefetchingEnabled(profile_))
DCHECK(config_.IsURLLearningEnabled());
- if (config_.IsHostPrefetchingEnabled())
+ if (config_.IsHostPrefetchingEnabled(profile_))
DCHECK(config_.IsHostLearningEnabled());
}
@@ -577,8 +577,9 @@ bool ResourcePrefetchPredictor::GetPrefetchData(
*key_type = PREFETCH_KEY_TYPE_URL;
const GURL& main_frame_url = navigation_id.main_frame_url;
- bool use_url_data = config_.IsPrefetchingEnabled() ?
- config_.IsURLPrefetchingEnabled() : config_.IsURLLearningEnabled();
+ bool use_url_data = config_.IsPrefetchingEnabled(profile_) ?
+ config_.IsURLPrefetchingEnabled(profile_) :
+ config_.IsURLLearningEnabled();
if (use_url_data) {
PrefetchDataMap::const_iterator iterator =
url_table_cache_->find(main_frame_url.spec());
@@ -588,8 +589,9 @@ bool ResourcePrefetchPredictor::GetPrefetchData(
if (!prefetch_requests->empty())
return true;
- bool use_host_data = config_.IsPrefetchingEnabled() ?
- config_.IsHostPrefetchingEnabled() : config_.IsHostLearningEnabled();
+ bool use_host_data = config_.IsPrefetchingEnabled(profile_) ?
+ config_.IsHostPrefetchingEnabled(profile_) :
+ config_.IsHostLearningEnabled();
if (use_host_data) {
PrefetchDataMap::const_iterator iterator =
host_table_cache_->find(main_frame_url.host());
@@ -712,7 +714,7 @@ void ResourcePrefetchPredictor::OnHistoryAndCacheLoaded() {
content::Source<Profile>(profile_));
// Initialize the prefetch manager only if prefetching is enabled.
- if (config_.IsPrefetchingEnabled()) {
+ if (config_.IsPrefetchingEnabled(profile_)) {
prefetch_manager_ = new ResourcePrefetcherManager(
this, config_, profile_->GetRequestContext());
}
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_common_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698