From 83240ac0bc75cd309b5867686359470a55693765 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Mon, 14 Mar 2022 14:48:17 +0100 Subject: [PATCH] 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 Reviewed-by: Harald Alvestrand Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#36191} --- system_wrappers/include/field_trial.h | 2 -- system_wrappers/source/field_trial.cc | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/system_wrappers/include/field_trial.h b/system_wrappers/include/field_trial.h index 52db33b0e9..48bad41d5c 100644 --- a/system_wrappers/include/field_trial.h +++ b/system_wrappers/include/field_trial.h @@ -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 diff --git a/system_wrappers/source/field_trial.cc b/system_wrappers/source/field_trial.cc index d16ea7e03f..8e447907d7 100644 --- a/system_wrappers/source/field_trial.cc +++ b/system_wrappers/source/field_trial.cc @@ -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; }