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

Side by Side Diff: chrome/browser/about_flags.cc

Issue 2711153004: predictors: Add an about:flags flag for speculative prefetch. (Closed)
Patch Set: Typo. Created 3 years, 9 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/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/feature_list.h" 15 #include "base/feature_list.h"
16 #include "base/i18n/base_i18n_switches.h" 16 #include "base/i18n/base_i18n_switches.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
19 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
20 #include "base/metrics/metrics_hashes.h" 20 #include "base/metrics/metrics_hashes.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/task_scheduler/switches.h" 25 #include "base/task_scheduler/switches.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "cc/base/switches.h" 28 #include "cc/base/switches.h"
29 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" 29 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h"
30 #include "chrome/browser/predictors/resource_prefetch_common.h"
30 #include "chrome/browser/prerender/prerender_field_trial.h" 31 #include "chrome/browser/prerender/prerender_field_trial.h"
31 #include "chrome/common/channel_info.h" 32 #include "chrome/common/channel_info.h"
32 #include "chrome/common/chrome_content_client.h" 33 #include "chrome/common/chrome_content_client.h"
33 #include "chrome/common/chrome_features.h" 34 #include "chrome/common/chrome_features.h"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/features.h" 36 #include "chrome/common/features.h"
36 #include "chrome/grit/chromium_strings.h" 37 #include "chrome/grit/chromium_strings.h"
37 #include "chrome/grit/generated_resources.h" 38 #include "chrome/grit/generated_resources.h"
38 #include "components/autofill/core/browser/autofill_experiments.h" 39 #include "components/autofill/core/browser/autofill_experiments.h"
39 #include "components/autofill/core/common/autofill_switches.h" 40 #include "components/autofill/core/common/autofill_switches.h"
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 prerender::kNoStatePrefetchFeatureModeParameterSimpleLoad}}; 671 prerender::kNoStatePrefetchFeatureModeParameterSimpleLoad}};
671 672
672 const FeatureEntry::FeatureVariation kNoStatePrefetchFeatureVariations[] = { 673 const FeatureEntry::FeatureVariation kNoStatePrefetchFeatureVariations[] = {
673 {"No-state prefetch", kNoStatePrefetchEnabled, 674 {"No-state prefetch", kNoStatePrefetchEnabled,
674 arraysize(kNoStatePrefetchEnabled), nullptr}, 675 arraysize(kNoStatePrefetchEnabled), nullptr},
675 {"Prerender", kNoStatePrefetchPrerender, 676 {"Prerender", kNoStatePrefetchPrerender,
676 arraysize(kNoStatePrefetchPrerender), nullptr}, 677 arraysize(kNoStatePrefetchPrerender), nullptr},
677 {"Simple load", kNoStatePrefetchSimpleLoad, 678 {"Simple load", kNoStatePrefetchSimpleLoad,
678 arraysize(kNoStatePrefetchSimpleLoad), nullptr}}; 679 arraysize(kNoStatePrefetchSimpleLoad), nullptr}};
679 680
681 const FeatureEntry::FeatureParam kSpeculativeResourcePrefetchingPrefetching[] =
682 {{predictors::kModeParamName, predictors::kPrefetchingMode}};
683
684 const FeatureEntry::FeatureParam kSpeculativeResourcePrefetchingLearning[] = {
685 {predictors::kModeParamName, predictors::kLearningMode}};
686
687 const FeatureEntry::FeatureVariation
688 kSpeculativeResourcePrefetchingFeatureVariations[] = {
689 {"Prefetching", kSpeculativeResourcePrefetchingPrefetching,
690 arraysize(kSpeculativeResourcePrefetchingPrefetching), nullptr},
691 {"Learning", kSpeculativeResourcePrefetchingLearning,
692 arraysize(kSpeculativeResourcePrefetchingLearning), nullptr}};
693
680 #if defined(OS_ANDROID) 694 #if defined(OS_ANDROID)
681 const FeatureEntry::FeatureParam 695 const FeatureEntry::FeatureParam
682 kAutofillCreditCardPopupLayoutFeatureVariationIconAtStart[] = { 696 kAutofillCreditCardPopupLayoutFeatureVariationIconAtStart[] = {
683 {"is_credit_card_icon_at_start", "true"}}; 697 {"is_credit_card_icon_at_start", "true"}};
684 698
685 const FeatureEntry::FeatureParam 699 const FeatureEntry::FeatureParam
686 kAutofillCreditCardPopupLayoutFeatureVariationDropdownItemHeight[] = { 700 kAutofillCreditCardPopupLayoutFeatureVariationDropdownItemHeight[] = {
687 {"dropdown_item_height", "56"}}; 701 {"dropdown_item_height", "56"}};
688 702
689 const FeatureEntry::FeatureParam 703 const FeatureEntry::FeatureParam
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 FEATURE_VALUE_TYPE(omnibox::kOmniboxEntitySuggestions)}, 2335 FEATURE_VALUE_TYPE(omnibox::kOmniboxEntitySuggestions)},
2322 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) || 2336 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) ||
2323 // defined(OS_WIN) 2337 // defined(OS_WIN)
2324 2338
2325 #if defined(OS_ANDROID) 2339 #if defined(OS_ANDROID)
2326 {"enable-custom-feedback-ui", IDS_FLAGS_ENABLE_CUSTOM_FEEDBACK_UI_NAME, 2340 {"enable-custom-feedback-ui", IDS_FLAGS_ENABLE_CUSTOM_FEEDBACK_UI_NAME,
2327 IDS_FLAGS_ENABLE_CUSTOM_FEEDBACK_UI_DESCRIPTION, kOsAndroid, 2341 IDS_FLAGS_ENABLE_CUSTOM_FEEDBACK_UI_DESCRIPTION, kOsAndroid,
2328 FEATURE_VALUE_TYPE(chrome::android::kCustomFeedbackUi)}, 2342 FEATURE_VALUE_TYPE(chrome::android::kCustomFeedbackUi)},
2329 #endif // OS_ANDROID 2343 #endif // OS_ANDROID
2330 2344
2345 {"enable-resource-prefetch", IDS_FLAGS_SPECULATIVE_PREFETCH_NAME,
2346 IDS_FLAGS_SPECULATIVE_PREFETCH_DESCRIPTION, kOsAll,
2347 FEATURE_WITH_VARIATIONS_VALUE_TYPE(
2348 predictors::kSpeculativeResourcePrefetchingFeature,
2349 kSpeculativeResourcePrefetchingFeatureVariations,
2350 "SpeculativeResourcePrefetchingValidation")},
2351
2331 // NOTE: Adding new command-line switches requires adding corresponding 2352 // NOTE: Adding new command-line switches requires adding corresponding
2332 // entries to enum "LoginCustomFlags" in histograms.xml. See note in 2353 // entries to enum "LoginCustomFlags" in histograms.xml. See note in
2333 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. 2354 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
2334 }; 2355 };
2335 2356
2336 class FlagsStateSingleton { 2357 class FlagsStateSingleton {
2337 public: 2358 public:
2338 FlagsStateSingleton() 2359 FlagsStateSingleton()
2339 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} 2360 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {}
2340 ~FlagsStateSingleton() {} 2361 ~FlagsStateSingleton() {}
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2529 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; 2550 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
2530 2551
2531 const FeatureEntry* GetFeatureEntries(size_t* count) { 2552 const FeatureEntry* GetFeatureEntries(size_t* count) {
2532 *count = arraysize(kFeatureEntries); 2553 *count = arraysize(kFeatureEntries);
2533 return kFeatureEntries; 2554 return kFeatureEntries;
2534 } 2555 }
2535 2556
2536 } // namespace testing 2557 } // namespace testing
2537 2558
2538 } // namespace about_flags 2559 } // namespace about_flags
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/predictors/resource_prefetch_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698