xref: /aosp_15_r20/external/cronet/net/cert/internal/trust_store_features.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 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 #include "net/cert/internal/trust_store_features.h"
6 
7 #include <atomic>
8 
9 #include "base/no_destructor.h"
10 
11 namespace net {
12 
13 namespace {
GetLocalAnchorConstraintsEnforcementFlag()14 std::atomic_bool* GetLocalAnchorConstraintsEnforcementFlag() {
15   static std::atomic_bool flag = base::FeatureList::IsEnabled(
16       net::features::kEnforceLocalAnchorConstraints);
17   return &flag;
18 }
19 
20 }  // namespace
21 
IsLocalAnchorConstraintsEnforcementEnabled()22 bool IsLocalAnchorConstraintsEnforcementEnabled() {
23   return GetLocalAnchorConstraintsEnforcementFlag()->load();
24 }
25 
SetLocalAnchorConstraintsEnforcementEnabled(bool enabled)26 void SetLocalAnchorConstraintsEnforcementEnabled(bool enabled) {
27   GetLocalAnchorConstraintsEnforcementFlag()->store(enabled);
28 }
29 
30 namespace features {
31 
32 BASE_FEATURE(kEnforceLocalAnchorConstraints,
33              "EnforceLocalAnchorConstraints",
34              base::FEATURE_ENABLED_BY_DEFAULT);
35 
36 }  // namespace features
37 
38 }  // namespace net
39