field_trials_registry.cc (1300B)
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/strings/string_view.h" 15 // IWYU pragma: begin_keep 16 #include "absl/algorithm/container.h" 17 #include "experiments/registered_field_trials.h" 18 #include "rtc_base/checks.h" 19 #include "rtc_base/logging.h" 20 // IWYU pragma: end_keep 21 22 namespace webrtc { 23 24 std::string FieldTrialsRegistry::Lookup(absl::string_view key) const { 25 #if WEBRTC_STRICT_FIELD_TRIALS == 1 26 RTC_DCHECK(absl::c_linear_search(kRegisteredFieldTrials, key) || 27 test_keys_.contains(key)) 28 << key << " is not registered, see g3doc/field-trials.md."; 29 #elif WEBRTC_STRICT_FIELD_TRIALS == 2 30 RTC_LOG_IF(LS_WARNING, !(absl::c_linear_search(kRegisteredFieldTrials, key) || 31 test_keys_.contains(key))) 32 << key << " is not registered, see g3doc/field-trials.md."; 33 #endif 34 return GetValue(key); 35 } 36 37 } // namespace webrtc