Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/experiments/memory_ablation_experiment.h" | |
| 29 #include "chrome/browser/flag_descriptions.h" | 30 #include "chrome/browser/flag_descriptions.h" |
| 30 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" | 31 #include "chrome/browser/ntp_snippets/ntp_snippets_features.h" |
| 31 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle .h" | 32 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle .h" |
| 32 #include "chrome/browser/predictors/resource_prefetch_common.h" | 33 #include "chrome/browser/predictors/resource_prefetch_common.h" |
| 33 #include "chrome/browser/prerender/prerender_field_trial.h" | 34 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 34 #include "chrome/common/channel_info.h" | 35 #include "chrome/common/channel_info.h" |
| 35 #include "chrome/common/chrome_content_client.h" | 36 #include "chrome/common/chrome_content_client.h" |
| 36 #include "chrome/common/chrome_features.h" | 37 #include "chrome/common/chrome_features.h" |
| 37 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/features.h" | 39 #include "chrome/common/features.h" |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 {DelayNavigationThrottle::kParamDelayNavigationRandomize, "true"}}; | 822 {DelayNavigationThrottle::kParamDelayNavigationRandomize, "true"}}; |
| 822 | 823 |
| 823 const FeatureEntry::FeatureVariation kDelayNavigationFeatureVariations[] = { | 824 const FeatureEntry::FeatureVariation kDelayNavigationFeatureVariations[] = { |
| 824 {"(5 second delay, 100% probability)", kDelayNavigation5SecondDelay, | 825 {"(5 second delay, 100% probability)", kDelayNavigation5SecondDelay, |
| 825 arraysize(kDelayNavigation5SecondDelay), nullptr}, | 826 arraysize(kDelayNavigation5SecondDelay), nullptr}, |
| 826 {"(5 second delay, 25% probability)", kDelayNavigation5SecondDelay25Percent, | 827 {"(5 second delay, 25% probability)", kDelayNavigation5SecondDelay25Percent, |
| 827 arraysize(kDelayNavigation5SecondDelay25Percent), nullptr}, | 828 arraysize(kDelayNavigation5SecondDelay25Percent), nullptr}, |
| 828 {"(0-5 second randomized delay)", kDelayNavigation5SecondDelayRandomize, | 829 {"(0-5 second randomized delay)", kDelayNavigation5SecondDelayRandomize, |
| 829 arraysize(kDelayNavigation5SecondDelayRandomize), nullptr}}; | 830 arraysize(kDelayNavigation5SecondDelayRandomize), nullptr}}; |
| 830 | 831 |
| 832 const FeatureEntry::FeatureParam kMemoryAblation1MiB[] = { | |
| 833 {kMemoryAblationFeatureSizeParam, "1048576"}}; | |
| 834 const FeatureEntry::FeatureParam kMemoryAblation2MiB[] = { | |
| 835 {kMemoryAblationFeatureSizeParam, "2097152"}}; | |
| 836 const FeatureEntry::FeatureParam kMemoryAblation5MiB[] = { | |
| 837 {kMemoryAblationFeatureSizeParam, "5242880"}}; | |
| 838 const FeatureEntry::FeatureParam kMemoryAblation10MiB[] = { | |
| 839 {kMemoryAblationFeatureSizeParam, "10485760"}}; | |
| 840 | |
| 841 const FeatureEntry::FeatureVariation kMemoryAblationFeatureVariations[] = { | |
| 842 {"1 MiB", kMemoryAblation1MiB, arraysize(kMemoryAblation1MiB), nullptr}, | |
| 843 {"2 MiB", kMemoryAblation2MiB, arraysize(kMemoryAblation2MiB), nullptr}, | |
| 844 {"5 MiB", kMemoryAblation5MiB, arraysize(kMemoryAblation5MiB), nullptr}, | |
|
Primiano Tucci (use gerrit)
2017/04/10 18:05:04
I think 2 vs 5 isn't going to be a huge difference
DmitrySkiba
2017/04/10 19:30:59
Done. Removed 2, added 50. These values are just f
| |
| 845 {"10 MiB", kMemoryAblation10MiB, arraysize(kMemoryAblation10MiB), nullptr}}; | |
| 846 | |
| 831 #if defined(OS_ANDROID) | 847 #if defined(OS_ANDROID) |
| 832 const FeatureEntry::FeatureParam kPersistentMenuItemEnabled[] = { | 848 const FeatureEntry::FeatureParam kPersistentMenuItemEnabled[] = { |
| 833 {"persistent_menu_item_enabled", "true"}}; | 849 {"persistent_menu_item_enabled", "true"}}; |
| 834 | 850 |
| 835 const FeatureEntry::FeatureVariation kDataReductionMainMenuFeatureVariations[] = | 851 const FeatureEntry::FeatureVariation kDataReductionMainMenuFeatureVariations[] = |
| 836 {{"(persistent)", kPersistentMenuItemEnabled, | 852 {{"(persistent)", kPersistentMenuItemEnabled, |
| 837 arraysize(kPersistentMenuItemEnabled), nullptr}}; | 853 arraysize(kPersistentMenuItemEnabled), nullptr}}; |
| 838 #endif // OS_ANDROID | 854 #endif // OS_ANDROID |
| 839 | 855 |
| 840 // RECORDING USER METRICS FOR FLAGS: | 856 // RECORDING USER METRICS FOR FLAGS: |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2584 kUseNewDoodleApiVariations, | 2600 kUseNewDoodleApiVariations, |
| 2585 chrome::android::kUseNewDoodleApi.name)}, | 2601 chrome::android::kUseNewDoodleApi.name)}, |
| 2586 #endif // OS_ANDROID | 2602 #endif // OS_ANDROID |
| 2587 | 2603 |
| 2588 {"delay-navigation", flag_descriptions::kDelayNavigationName, | 2604 {"delay-navigation", flag_descriptions::kDelayNavigationName, |
| 2589 flag_descriptions::kDelayNavigationDescription, kOsAll, | 2605 flag_descriptions::kDelayNavigationDescription, kOsAll, |
| 2590 FEATURE_WITH_PARAMS_VALUE_TYPE(kDelayNavigationFeature, | 2606 FEATURE_WITH_PARAMS_VALUE_TYPE(kDelayNavigationFeature, |
| 2591 kDelayNavigationFeatureVariations, | 2607 kDelayNavigationFeatureVariations, |
| 2592 "DelayNavigation")}, | 2608 "DelayNavigation")}, |
| 2593 | 2609 |
| 2610 {"memory-ablation", flag_descriptions::kMemoryAblationName, | |
| 2611 flag_descriptions::kMemoryAblationDescription, kOsAll, | |
| 2612 FEATURE_WITH_PARAMS_VALUE_TYPE(kMemoryAblationFeature, | |
| 2613 kMemoryAblationFeatureVariations, | |
| 2614 "MemoryAblation")}, | |
| 2615 | |
| 2594 #if defined(OS_ANDROID) | 2616 #if defined(OS_ANDROID) |
| 2595 {"enable-custom-context-menu", | 2617 {"enable-custom-context-menu", |
| 2596 flag_descriptions::kEnableCustomContextMenuName, | 2618 flag_descriptions::kEnableCustomContextMenuName, |
| 2597 flag_descriptions::kEnableCustomContextMenuDescription, kOsAndroid, | 2619 flag_descriptions::kEnableCustomContextMenuDescription, kOsAndroid, |
| 2598 FEATURE_VALUE_TYPE(chrome::android::kCustomContextMenu)}, | 2620 FEATURE_VALUE_TYPE(chrome::android::kCustomContextMenu)}, |
| 2599 #endif // OS_ANDROID | 2621 #endif // OS_ANDROID |
| 2600 | 2622 |
| 2601 #if defined(USE_ASH) | 2623 #if defined(USE_ASH) |
| 2602 {"ash-enable-smooth-screen-rotation", | 2624 {"ash-enable-smooth-screen-rotation", |
| 2603 flag_descriptions::kAshEnableSmoothScreenRotationName, | 2625 flag_descriptions::kAshEnableSmoothScreenRotationName, |
| 2604 flag_descriptions::kAshEnableSmoothScreenRotationDescription, kOsCrOS, | 2626 flag_descriptions::kAshEnableSmoothScreenRotationDescription, kOsCrOS, |
| 2605 SINGLE_VALUE_TYPE(ash::switches::kAshEnableSmoothScreenRotation)}, | 2627 SINGLE_VALUE_TYPE(ash::switches::kAshEnableSmoothScreenRotation)}, |
| 2606 #endif // defined(USE_ASH) | 2628 #endif // defined(USE_ASH) |
| 2607 | 2629 |
| 2608 #if defined(OS_CHROMEOS) | 2630 #if defined(OS_CHROMEOS) |
| 2609 {"enable-zip-archiver-on-file-manager", | 2631 {"enable-zip-archiver-on-file-manager", |
| 2610 flag_descriptions::kEnableZipArchiverOnFileManagerName, | 2632 flag_descriptions::kEnableZipArchiverOnFileManagerName, |
| 2611 flag_descriptions::kEnableZipArchiverOnFileManagerDescription, | 2633 flag_descriptions::kEnableZipArchiverOnFileManagerDescription, kOsCrOS, |
|
DmitrySkiba
2017/04/10 17:15:42
This was formatted by "git cl format" along with m
| |
| 2612 kOsCrOS, | 2634 SINGLE_VALUE_TYPE(chromeos::switches::kEnableZipArchiverOnFileManager)}, |
| 2613 SINGLE_VALUE_TYPE( | |
| 2614 chromeos::switches::kEnableZipArchiverOnFileManager)}, | |
| 2615 #endif // OS_CHROMEOS | 2635 #endif // OS_CHROMEOS |
| 2616 | 2636 |
| 2617 // NOTE: Adding new command-line switches requires adding corresponding | 2637 // NOTE: Adding new command-line switches requires adding corresponding |
| 2618 // entries to enum "LoginCustomFlags" in histograms.xml. See note in | 2638 // entries to enum "LoginCustomFlags" in histograms.xml. See note in |
| 2619 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. | 2639 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. |
| 2620 }; | 2640 }; |
| 2621 | 2641 |
| 2622 class FlagsStateSingleton { | 2642 class FlagsStateSingleton { |
| 2623 public: | 2643 public: |
| 2624 FlagsStateSingleton() | 2644 FlagsStateSingleton() |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2823 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; | 2843 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; |
| 2824 | 2844 |
| 2825 const FeatureEntry* GetFeatureEntries(size_t* count) { | 2845 const FeatureEntry* GetFeatureEntries(size_t* count) { |
| 2826 *count = arraysize(kFeatureEntries); | 2846 *count = arraysize(kFeatureEntries); |
| 2827 return kFeatureEntries; | 2847 return kFeatureEntries; |
| 2828 } | 2848 } |
| 2829 | 2849 |
| 2830 } // namespace testing | 2850 } // namespace testing |
| 2831 | 2851 |
| 2832 } // namespace about_flags | 2852 } // namespace about_flags |
| OLD | NEW |