mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Change RTCEventLogFactory to have a const Create function
Conformant with naming rule: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/g3doc/implementation_basics.md;l=48?q=factory%20file:md$%20file:webrtc&ss=chromium Bug: webrtc:14226 Change-Id: Ibec148fada6303e2ebdc5e6405fd527065f69d41 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266360 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37364}
This commit is contained in:
parent
cc7bd85748
commit
90af4c1b70
6 changed files with 26 additions and 9 deletions
|
@ -27,8 +27,8 @@ RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory)
|
|||
RTC_DCHECK(task_queue_factory_);
|
||||
}
|
||||
|
||||
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType encoding_type) {
|
||||
std::unique_ptr<RtcEventLog> RtcEventLogFactory::Create(
|
||||
RtcEventLog::EncodingType encoding_type) const {
|
||||
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
|
||||
if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
|
||||
return std::make_unique<RtcEventLogNull>();
|
||||
|
@ -39,4 +39,9 @@ std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
|
|||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType encoding_type) {
|
||||
return Create(encoding_type);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -25,6 +25,8 @@ class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface {
|
|||
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory);
|
||||
~RtcEventLogFactory() override {}
|
||||
|
||||
std::unique_ptr<RtcEventLog> Create(
|
||||
RtcEventLog::EncodingType encoding_type) const override;
|
||||
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType encoding_type) override;
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ class RtcEventLogFactoryInterface {
|
|||
public:
|
||||
virtual ~RtcEventLogFactoryInterface() = default;
|
||||
|
||||
virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
||||
virtual std::unique_ptr<RtcEventLog> Create(
|
||||
RtcEventLog::EncodingType encoding_type) const = 0;
|
||||
[[deprecated]] virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType encoding_type) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,11 +17,17 @@
|
|||
|
||||
namespace webrtc {
|
||||
|
||||
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType /*encoding_type*/) {
|
||||
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::Create(
|
||||
RtcEventLog::EncodingType /*encoding_type*/) const {
|
||||
auto fake_event_log = std::make_unique<FakeRtcEventLog>();
|
||||
last_log_created_ = fake_event_log.get();
|
||||
const_cast<FakeRtcEventLogFactory*>(this)->last_log_created_ =
|
||||
fake_event_log.get();
|
||||
return fake_event_log;
|
||||
}
|
||||
|
||||
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType encoding_type) {
|
||||
return Create(encoding_type);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -23,6 +23,9 @@ class FakeRtcEventLogFactory : public RtcEventLogFactoryInterface {
|
|||
FakeRtcEventLogFactory() = default;
|
||||
~FakeRtcEventLogFactory() override = default;
|
||||
|
||||
std::unique_ptr<RtcEventLog> Create(
|
||||
RtcEventLog::EncodingType encoding_type) const override;
|
||||
|
||||
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
||||
RtcEventLog::EncodingType encoding_type) override;
|
||||
|
||||
|
|
|
@ -296,9 +296,8 @@ std::unique_ptr<RtcEventLog> PeerConnectionFactory::CreateRtcEventLog_w() {
|
|||
auto encoding_type = RtcEventLog::EncodingType::Legacy;
|
||||
if (IsTrialEnabled("WebRTC-RtcEventLogNewFormat"))
|
||||
encoding_type = RtcEventLog::EncodingType::NewFormat;
|
||||
return event_log_factory_
|
||||
? event_log_factory_->CreateRtcEventLog(encoding_type)
|
||||
: std::make_unique<RtcEventLogNull>();
|
||||
return event_log_factory_ ? event_log_factory_->Create(encoding_type)
|
||||
: std::make_unique<RtcEventLogNull>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
|
||||
|
|
Loading…
Reference in a new issue