• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_FEATURES_H_
6 #define BASE_FEATURES_H_
7 
8 #include "base/base_export.h"
9 #include "base/feature_list.h"
10 #include "base/metrics/field_trial_params.h"
11 
12 namespace base::features {
13 
14 // All features in alphabetical order. The features should be documented
15 // alongside the definition of their values in the .cc file.
16 
17 // Alphabetical:
18 BASE_EXPORT BASE_DECLARE_FEATURE(kFeatureParamWithCache);
19 
20 BASE_EXPORT BASE_DECLARE_FEATURE(kUseRustJsonParser);
21 
22 BASE_EXPORT extern const base::FeatureParam<bool>
23     kUseRustJsonParserInCurrentSequence;
24 
25 BASE_EXPORT BASE_DECLARE_FEATURE(kLowEndMemoryExperiment);
26 
27 BASE_EXPORT extern const base::FeatureParam<int> kLowMemoryDeviceThresholdMB;
28 
29 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
30 BASE_EXPORT BASE_DECLARE_FEATURE(kPartialLowEndModeOn3GbDevices);
31 BASE_EXPORT BASE_DECLARE_FEATURE(kPartialLowEndModeOnMidRangeDevices);
32 #endif
33 
34 #if BUILDFLAG(IS_ANDROID)
35 BASE_EXPORT BASE_DECLARE_FEATURE(kCollectAndroidFrameTimelineMetrics);
36 BASE_EXPORT BASE_DECLARE_FEATURE(
37     kPostPowerMonitorBroadcastReceiverInitToBackground);
38 BASE_EXPORT BASE_DECLARE_FEATURE(kPostGetMyMemoryStateToBackground);
39 #endif
40 
41 // Policy for emitting profiler metadata from `ThreadController`.
42 enum class EmitThreadControllerProfilerMetadata {
43   // Always emit metadata.
44   kForce,
45   // Emit metadata only if enabled via the `FeatureList`.
46   kFeatureDependent,
47 };
48 
49 // Initializes global variables that depend on `FeatureList`. Must be invoked
50 // early on process startup, but after `FeatureList` initialization. Different
51 // parts of //base read experiment state from global variables instead of
52 // directly from `FeatureList` to avoid data races (default values are used
53 // before this function is called to initialize the global variables).
54 BASE_EXPORT void Init(EmitThreadControllerProfilerMetadata
55                           emit_thread_controller_profiler_metadata);
56 
57 }  // namespace base::features
58 
59 #endif  // BASE_FEATURES_H_
60