Remove deprecated FieldTrialBasedConfig from api
Move it as an implementation detail of the EnvironmentFactory as a
default field trials fallback.
Bug: webrtc:42220378
Change-Id: Iaed0b847fae715e0b74674749baa5ce8ede6bff6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/398960
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45290}
diff --git a/api/environment/BUILD.gn b/api/environment/BUILD.gn
index c0aeda9..0d87ae2 100644
--- a/api/environment/BUILD.gn
+++ b/api/environment/BUILD.gn
@@ -23,6 +23,20 @@
]
}
+rtc_library("deprecated_global_field_trials") {
+ visibility = [ ":environment_factory" ]
+ allow_poison = [ "environment_construction" ]
+ sources = [
+ "deprecated_global_field_trials.cc",
+ "deprecated_global_field_trials.h",
+ ]
+ deps = [
+ "../:field_trials_registry",
+ "../../system_wrappers:field_trial",
+ "//third_party/abseil-cpp/absl/strings:string_view",
+ ]
+}
+
rtc_library("environment_factory") {
visibility = [ "*" ]
poisonous = [ "environment_construction" ]
@@ -31,6 +45,7 @@
"environment_factory.h",
]
deps = [
+ ":deprecated_global_field_trials",
":environment",
"..:field_trials_view",
"..:make_ref_counted",
@@ -42,7 +57,6 @@
"../rtc_event_log",
"../task_queue",
"../task_queue:default_task_queue_factory",
- "../transport:field_trial_based_config",
"//third_party/abseil-cpp/absl/base:nullability",
]
}
diff --git a/api/transport/field_trial_based_config.cc b/api/environment/deprecated_global_field_trials.cc
similarity index 91%
rename from api/transport/field_trial_based_config.cc
rename to api/environment/deprecated_global_field_trials.cc
index bd9adaa..aaef488 100644
--- a/api/transport/field_trial_based_config.cc
+++ b/api/environment/deprecated_global_field_trials.cc
@@ -7,7 +7,7 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "api/transport/field_trial_based_config.h"
+#include "api/environment/deprecated_global_field_trials.h"
#include <cstddef>
#include <string>
@@ -16,7 +16,7 @@
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
-std::string FieldTrialBasedConfig::GetValue(absl::string_view key) const {
+std::string DeprecatedGlobalFieldTrials::GetValue(absl::string_view key) const {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
const char* global_field_trial_string = field_trial::GetFieldTrialString();
diff --git a/api/environment/deprecated_global_field_trials.h b/api/environment/deprecated_global_field_trials.h
new file mode 100644
index 0000000..8dd49c9
--- /dev/null
+++ b/api/environment/deprecated_global_field_trials.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2019 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef API_ENVIRONMENT_DEPRECATED_GLOBAL_FIELD_TRIALS_H_
+#define API_ENVIRONMENT_DEPRECATED_GLOBAL_FIELD_TRIALS_H_
+
+#include <string>
+
+#include "absl/strings/string_view.h"
+#include "api/field_trials_registry.h"
+
+namespace webrtc {
+// TODO: bugs.webrtc.org/42220378 - Delete after January 1, 2026 when functions
+// to set global field trials are deleted.
+class DeprecatedGlobalFieldTrials : public FieldTrialsRegistry {
+ private:
+ std::string GetValue(absl::string_view key) const override;
+};
+} // namespace webrtc
+
+#endif // API_ENVIRONMENT_DEPRECATED_GLOBAL_FIELD_TRIALS_H_
diff --git a/api/environment/environment_factory.cc b/api/environment/environment_factory.cc
index 0dd380a..529bbec 100644
--- a/api/environment/environment_factory.cc
+++ b/api/environment/environment_factory.cc
@@ -14,6 +14,7 @@
#include <utility>
#include "absl/base/nullability.h"
+#include "api/environment/deprecated_global_field_trials.h"
#include "api/environment/environment.h"
#include "api/field_trials_view.h"
#include "api/make_ref_counted.h"
@@ -22,7 +23,6 @@
#include "api/scoped_refptr.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_factory.h"
-#include "api/transport/field_trial_based_config.h"
#include "rtc_base/checks.h"
#include "system_wrappers/include/clock.h"
@@ -100,10 +100,7 @@
Environment EnvironmentFactory::CreateWithDefaults() && {
if (field_trials_ == nullptr) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- Set(std::make_unique<FieldTrialBasedConfig>());
-#pragma clang diagnostic pop
+ Set(std::make_unique<DeprecatedGlobalFieldTrials>());
}
if (clock_ == nullptr) {
Set(Clock::GetRealTimeClock());
diff --git a/api/transport/BUILD.gn b/api/transport/BUILD.gn
index b99d403..67a2dbf 100644
--- a/api/transport/BUILD.gn
+++ b/api/transport/BUILD.gn
@@ -60,21 +60,6 @@
]
}
-rtc_library("field_trial_based_config") {
- visibility = [ "*" ]
- allow_poison = [ "environment_construction" ]
- sources = [
- "field_trial_based_config.cc",
- "field_trial_based_config.h",
- ]
- deps = [
- "../../api:field_trials_registry",
- "../../rtc_base/system:rtc_export",
- "../../system_wrappers:field_trial",
- "//third_party/abseil-cpp/absl/strings:string_view",
- ]
-}
-
rtc_source_set("datagram_transport_interface") {
visibility = [ "*" ]
sources = [ "data_channel_transport_interface.h" ]
diff --git a/api/transport/field_trial_based_config.h b/api/transport/field_trial_based_config.h
deleted file mode 100644
index 08a37e5..0000000
--- a/api/transport/field_trial_based_config.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2019 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef API_TRANSPORT_FIELD_TRIAL_BASED_CONFIG_H_
-#define API_TRANSPORT_FIELD_TRIAL_BASED_CONFIG_H_
-
-#include <string>
-
-#include "absl/strings/string_view.h"
-#include "api/field_trials_registry.h"
-#include "rtc_base/system/rtc_export.h"
-
-namespace webrtc {
-// Implementation using the field trial API fo the key value lookup.
-// TODO: bugs.webrtc.org/42220378 - Remove from public api after August 1, 2025.
-class [[deprecated]] RTC_EXPORT FieldTrialBasedConfig
- : public FieldTrialsRegistry {
- private:
- std::string GetValue(absl::string_view key) const override;
-};
-} // namespace webrtc
-
-#endif // API_TRANSPORT_FIELD_TRIAL_BASED_CONFIG_H_
diff --git a/modules/congestion_controller/goog_cc/BUILD.gn b/modules/congestion_controller/goog_cc/BUILD.gn
index b84156e..b1cd64c 100644
--- a/modules/congestion_controller/goog_cc/BUILD.gn
+++ b/modules/congestion_controller/goog_cc/BUILD.gn
@@ -287,7 +287,6 @@
"../../../api/test/network_emulation",
"../../../api/test/network_emulation:create_cross_traffic",
"../../../api/transport:bandwidth_usage",
- "../../../api/transport:field_trial_based_config",
"../../../api/transport:goog_cc",
"../../../api/transport:network_control",
"../../../api/units:data_rate",
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 5a06418..0c5df79 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -2528,7 +2528,6 @@
"../api/transport:bitrate_settings",
"../api/transport:datagram_transport_interface",
"../api/transport:enums",
- "../api/transport:field_trial_based_config",
"../api/transport:sctp_transport_factory_interface",
"../api/transport/rtp:rtp_source",
"../api/units:data_rate",
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index 12e06d6..ae16dde 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -175,7 +175,6 @@
"../api/environment:environment_factory",
"../api/task_queue",
"../api/test/video:function_video_factory",
- "../api/transport:field_trial_based_config",
"../api/units:time_delta",
"../api/units:timestamp",
"../api/video:encoded_image",
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index cd90d6d..17324f6 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -1131,7 +1131,6 @@
"../api/environment:environment_factory",
"../api/rtc_event_log:rtc_event_log_factory",
"../api/task_queue:default_task_queue_factory",
- "../api/transport:field_trial_based_config",
"../api/transport:network_control",
"../api/transport/rtp:rtp_source",
"../api/video:video_frame",
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 75a3fbc..4a6e127 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -1298,7 +1298,6 @@
"../api/task_queue",
"../api/test/video:function_video_factory",
"../api/transport:bitrate_settings",
- "../api/transport:field_trial_based_config",
"../api/transport:network_control",
"../api/units:time_delta",
"../api/units:timestamp",
diff --git a/test/network/BUILD.gn b/test/network/BUILD.gn
index d707ccf..a9dcdd7 100644
--- a/test/network/BUILD.gn
+++ b/test/network/BUILD.gn
@@ -118,7 +118,6 @@
"../../api/rtc_event_log:rtc_event_log_factory",
"../../api/task_queue:default_task_queue_factory",
"../../api/test/network_emulation",
- "../../api/transport:field_trial_based_config",
"../../modules/audio_device:test_audio_device_module",
"../../p2p:port_allocator",
"../../pc:pc_test_utils",