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

Side by Side Diff: chrome/browser/prerender/prerender_field_trial.cc

Issue 10817004: Adds speculative prefetching of resources. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressing Dominich's comment. Created 8 years, 3 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
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/prerender/prerender_field_trial.h" 5 #include "chrome/browser/prerender/prerender_field_trial.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 switches::kSpeculativeResourcePrefetching); 286 switches::kSpeculativeResourcePrefetching);
287 287
288 return switch_value == switches::kSpeculativeResourcePrefetchingLearning; 288 return switch_value == switches::kSpeculativeResourcePrefetchingLearning;
289 } 289 }
290 290
291 const int group = FieldTrialList::FindValue( 291 const int group = FieldTrialList::FindValue(
292 kSpeculativePrefetchingLearningTrialName); 292 kSpeculativePrefetchingLearningTrialName);
293 return group == g_speculative_prefetching_learning_default_group_number; 293 return group == g_speculative_prefetching_learning_default_group_number;
294 } 294 }
295 295
296 bool IsSpeculativeResourcePrefetchingEnabled(Profile* profile) {
297 if (!profile)
298 return false;
299
300 // Check if the user has set a command line flag.
301 if (CommandLine::ForCurrentProcess()->HasSwitch(
302 switches::kSpeculativeResourcePrefetching)) {
303 const std::string switch_value =
304 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
305 switches::kSpeculativeResourcePrefetching);
306 return switch_value == switches::kSpeculativeResourcePrefetchingEnabled;
307 }
308
309 return false;
310 }
311
296 } // namespace prerender 312 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698