Delete legacy RtcEventLogFactory Create functions

All usage was migrated to the latest variant of the Create function that takes the Environment paramter.

Bug: webrtc:15656
Change-Id: I2fb2bf4bc4a858d69adc64c2804c1bd830011f10
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329440
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41302}
This commit is contained in:
Danil Chapovalov 2023-12-01 14:30:47 +01:00 committed by WebRTC LUCI CQ
parent 09aa812968
commit 2ca1d0f809
6 changed files with 6 additions and 70 deletions

View file

@ -38,9 +38,7 @@ rtc_library("rtc_event_log_factory") {
deps = [ deps = [
":rtc_event_log", ":rtc_event_log",
"..:field_trials_view", "..:field_trials_view",
"../../rtc_base:checks",
"../../rtc_base/system:rtc_export", "../../rtc_base/system:rtc_export",
"../../system_wrappers:field_trial",
"../environment", "../environment",
"../task_queue", "../task_queue",
] ]

View file

@ -11,11 +11,11 @@
#include "api/rtc_event_log/rtc_event_log_factory.h" #include "api/rtc_event_log/rtc_event_log_factory.h"
#include <memory> #include <memory>
#include <utility>
#include "absl/base/nullability.h"
#include "api/environment/environment.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "rtc_base/checks.h" #include "api/rtc_event_log/rtc_event_log.h"
#include "system_wrappers/include/field_trial.h"
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
#include "logging/rtc_event_log/rtc_event_log_impl.h" #include "logging/rtc_event_log/rtc_event_log_impl.h"
@ -23,11 +23,6 @@
namespace webrtc { namespace webrtc {
RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory)
: task_queue_factory_(task_queue_factory) {
RTC_DCHECK(task_queue_factory_);
}
absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create( absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create(
const Environment& env) const { const Environment& env) const {
#ifndef WEBRTC_ENABLE_RTC_EVENT_LOG #ifndef WEBRTC_ENABLE_RTC_EVENT_LOG
@ -45,23 +40,4 @@ absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create(
#endif #endif
} }
std::unique_ptr<RtcEventLog> RtcEventLogFactory::Create(
RtcEventLog::EncodingType encoding_type) const {
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
RTC_DCHECK(task_queue_factory_);
if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
return std::make_unique<RtcEventLogNull>();
}
return std::make_unique<RtcEventLogImpl>(
RtcEventLogImpl::CreateEncoder(encoding_type), task_queue_factory_);
#else
return std::make_unique<RtcEventLogNull>();
#endif
}
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) {
return Create(encoding_type);
}
} // namespace webrtc } // namespace webrtc

View file

@ -29,19 +29,11 @@ class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface {
// TODO(bugs.webrtc.org/15656): deprecate and delete constructor taking // TODO(bugs.webrtc.org/15656): deprecate and delete constructor taking
// task queue factory in favor of using task queue factory provided through // task queue factory in favor of using task queue factory provided through
// the Environment parameter in Create function. // the Environment parameter in Create function.
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory); explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory) {}
~RtcEventLogFactory() override = default; ~RtcEventLogFactory() override = default;
absl::Nonnull<std::unique_ptr<RtcEventLog>> Create( absl::Nonnull<std::unique_ptr<RtcEventLog>> Create(
const Environment& env) const override; const Environment& env) const override;
std::unique_ptr<RtcEventLog> Create(
RtcEventLog::EncodingType encoding_type) const override;
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) override;
private:
TaskQueueFactory* const task_queue_factory_ = nullptr;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -28,13 +28,6 @@ class RtcEventLogFactoryInterface {
virtual absl::Nonnull<std::unique_ptr<RtcEventLog>> Create( virtual absl::Nonnull<std::unique_ptr<RtcEventLog>> Create(
const Environment& env) const = 0; const Environment& env) const = 0;
// TODO(bugs.webrtc.org/15656): Delete functions below when all usage is
// migrated to the Create(const Environment&) function above.
virtual std::unique_ptr<RtcEventLog> Create(
RtcEventLog::EncodingType encoding_type) const = 0;
[[deprecated]] virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) = 0;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -17,26 +17,11 @@
namespace webrtc { namespace webrtc {
absl::Nonnull<std::unique_ptr<FakeRtcEventLog>> absl::Nonnull<std::unique_ptr<RtcEventLog>> FakeRtcEventLogFactory::Create(
FakeRtcEventLogFactory::CreateFake() const { const Environment& /*env*/) const {
auto fake_event_log = std::make_unique<FakeRtcEventLog>(); auto fake_event_log = std::make_unique<FakeRtcEventLog>();
const_cast<FakeRtcEventLog*&>(last_log_created_) = fake_event_log.get(); const_cast<FakeRtcEventLog*&>(last_log_created_) = fake_event_log.get();
return fake_event_log; return fake_event_log;
} }
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::Create(
const Environment& /*env*/) const {
return CreateFake();
}
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::Create(
RtcEventLog::EncodingType /*encoding_type*/) const {
return CreateFake();
}
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType /*encoding_type*/) {
return CreateFake();
}
} // namespace webrtc } // namespace webrtc

View file

@ -28,17 +28,9 @@ class FakeRtcEventLogFactory : public RtcEventLogFactoryInterface {
absl::Nonnull<std::unique_ptr<RtcEventLog>> Create( absl::Nonnull<std::unique_ptr<RtcEventLog>> Create(
const Environment& env) const override; const Environment& env) const override;
std::unique_ptr<RtcEventLog> Create(
RtcEventLog::EncodingType encoding_type) const override;
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) override;
FakeRtcEventLog* last_log_created() { return last_log_created_; } FakeRtcEventLog* last_log_created() { return last_log_created_; }
private: private:
absl::Nonnull<std::unique_ptr<FakeRtcEventLog>> CreateFake() const;
FakeRtcEventLog* last_log_created_ = nullptr; FakeRtcEventLog* last_log_created_ = nullptr;
}; };