Only FindFullName should be injectable at link-time.

When WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT is defined, only
webrtc::field_trial::FindFullName should be defined at link time, the
other functions should not be part of this interface.

No-Try: True
Bug: webrtc:10335
Change-Id: I81bcefcde6a51bcf8e410af91b5401f23e039d50
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255340
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36191}
This commit is contained in:
Mirko Bonadei 2022-03-14 14:48:17 +01:00 committed by WebRTC LUCI CQ
parent e8193a9a13
commit 83240ac0bc
2 changed files with 1 additions and 5 deletions

View File

@ -84,7 +84,6 @@ void InitFieldTrialsFromString(const char* trials_string);
const char* GetFieldTrialString();
#ifndef WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
// Validates the given field trial string.
bool FieldTrialsStringIsValid(const char* trials_string);
@ -94,7 +93,6 @@ bool FieldTrialsStringIsValid(const char* trials_string);
// in 'second' takes precedence.
// Shall only be called with valid FieldTrial strings.
std::string MergeFieldTrialsStrings(const char* first, const char* second);
#endif // WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
} // namespace field_trial
} // namespace webrtc

View File

@ -26,7 +26,6 @@ namespace field_trial {
static const char* trials_init_string = NULL;
#ifndef WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
namespace {
constexpr char kPersistentStringSeparator = '/';
// Validates the given field trial string.
@ -102,6 +101,7 @@ std::string MergeFieldTrialsStrings(const char* first, const char* second) {
return merged;
}
#ifndef WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
std::string FindFullName(const std::string& name) {
if (trials_init_string == NULL)
return std::string();
@ -138,12 +138,10 @@ std::string FindFullName(const std::string& name) {
// Optionally initialize field trial from a string.
void InitFieldTrialsFromString(const char* trials_string) {
RTC_LOG(LS_INFO) << "Setting field trial string:" << trials_string;
#ifndef WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
if (trials_string) {
RTC_DCHECK(FieldTrialsStringIsValidInternal(trials_string))
<< "Invalid field trials string:" << trials_string;
};
#endif // WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
trials_init_string = trials_string;
}