xref: /aosp_15_r20/external/cronet/base/features.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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(kEnforceNoExecutableFileHandles);
19 
20 BASE_EXPORT BASE_DECLARE_FEATURE(kNotReachedIsFatal);
21 
22 BASE_EXPORT BASE_DECLARE_FEATURE(kOptimizeDataUrls);
23 
24 BASE_EXPORT BASE_DECLARE_FEATURE(kUseRustJsonParser);
25 
26 BASE_EXPORT BASE_DECLARE_FEATURE(kJsonNegativeZero);
27 
28 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
29 BASE_EXPORT BASE_DECLARE_FEATURE(kPartialLowEndModeOn3GbDevices);
30 BASE_EXPORT BASE_DECLARE_FEATURE(kPartialLowEndModeOnMidRangeDevices);
31 #endif
32 
33 #if BUILDFLAG(IS_ANDROID)
34 BASE_EXPORT BASE_DECLARE_FEATURE(kCollectAndroidFrameTimelineMetrics);
35 #endif
36 
37 // Policy for emitting profiler metadata from `ThreadController`.
38 enum class EmitThreadControllerProfilerMetadata {
39   // Always emit metadata.
40   kForce,
41   // Emit metadata only if enabled via the `FeatureList`.
42   kFeatureDependent,
43 };
44 
45 // Initializes global variables that depend on `FeatureList`. Must be invoked
46 // early on process startup, but after `FeatureList` initialization. Different
47 // parts of //base read experiment state from global variables instead of
48 // directly from `FeatureList` to avoid data races (default values are used
49 // before this function is called to initialize the global variables).
50 BASE_EXPORT void Init(EmitThreadControllerProfilerMetadata
51                           emit_thread_controller_profiler_metadata);
52 
53 }  // namespace base::features
54 
55 #endif  // BASE_FEATURES_H_
56