xref: /aosp_15_r20/external/webrtc/api/field_trials_registry.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2022 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include "api/field_trials_registry.h"
11 
12 #include <string>
13 
14 #include "absl/algorithm/container.h"
15 #include "absl/strings/string_view.h"
16 #include "experiments/registered_field_trials.h"
17 #include "rtc_base/checks.h"
18 #include "rtc_base/containers/flat_set.h"
19 
20 namespace webrtc {
21 
Lookup(absl::string_view key) const22 std::string FieldTrialsRegistry::Lookup(absl::string_view key) const {
23 #if WEBRTC_STRICT_FIELD_TRIALS
24   RTC_DCHECK(absl::c_linear_search(kRegisteredFieldTrials, key) ||
25              test_keys_.contains(key))
26       << key << " is not registered.";
27 #endif
28   return GetValue(key);
29 }
30 
31 }  // namespace webrtc
32