mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-19 08:37:54 +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_);
|
RTC_DCHECK(task_queue_factory_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
|
std::unique_ptr<RtcEventLog> RtcEventLogFactory::Create(
|
||||||
RtcEventLog::EncodingType encoding_type) {
|
RtcEventLog::EncodingType encoding_type) const {
|
||||||
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
|
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
|
||||||
if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
|
if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
|
||||||
return std::make_unique<RtcEventLogNull>();
|
return std::make_unique<RtcEventLogNull>();
|
||||||
|
@ -39,4 +39,9 @@ std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
|
||||||
|
RtcEventLog::EncodingType encoding_type) {
|
||||||
|
return Create(encoding_type);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -25,6 +25,8 @@ class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface {
|
||||||
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory);
|
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory);
|
||||||
~RtcEventLogFactory() override {}
|
~RtcEventLogFactory() override {}
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLog> Create(
|
||||||
|
RtcEventLog::EncodingType encoding_type) const override;
|
||||||
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
||||||
RtcEventLog::EncodingType encoding_type) override;
|
RtcEventLog::EncodingType encoding_type) override;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,9 @@ class RtcEventLogFactoryInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~RtcEventLogFactoryInterface() = default;
|
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;
|
RtcEventLog::EncodingType encoding_type) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,17 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
|
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::Create(
|
||||||
RtcEventLog::EncodingType /*encoding_type*/) {
|
RtcEventLog::EncodingType /*encoding_type*/) const {
|
||||||
auto fake_event_log = std::make_unique<FakeRtcEventLog>();
|
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;
|
return fake_event_log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
|
||||||
|
RtcEventLog::EncodingType encoding_type) {
|
||||||
|
return Create(encoding_type);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -23,6 +23,9 @@ class FakeRtcEventLogFactory : public RtcEventLogFactoryInterface {
|
||||||
FakeRtcEventLogFactory() = default;
|
FakeRtcEventLogFactory() = default;
|
||||||
~FakeRtcEventLogFactory() override = default;
|
~FakeRtcEventLogFactory() override = default;
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLog> Create(
|
||||||
|
RtcEventLog::EncodingType encoding_type) const override;
|
||||||
|
|
||||||
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
|
||||||
RtcEventLog::EncodingType encoding_type) override;
|
RtcEventLog::EncodingType encoding_type) override;
|
||||||
|
|
||||||
|
|
|
@ -296,9 +296,8 @@ std::unique_ptr<RtcEventLog> PeerConnectionFactory::CreateRtcEventLog_w() {
|
||||||
auto encoding_type = RtcEventLog::EncodingType::Legacy;
|
auto encoding_type = RtcEventLog::EncodingType::Legacy;
|
||||||
if (IsTrialEnabled("WebRTC-RtcEventLogNewFormat"))
|
if (IsTrialEnabled("WebRTC-RtcEventLogNewFormat"))
|
||||||
encoding_type = RtcEventLog::EncodingType::NewFormat;
|
encoding_type = RtcEventLog::EncodingType::NewFormat;
|
||||||
return event_log_factory_
|
return event_log_factory_ ? event_log_factory_->Create(encoding_type)
|
||||||
? event_log_factory_->CreateRtcEventLog(encoding_type)
|
: std::make_unique<RtcEventLogNull>();
|
||||||
: std::make_unique<RtcEventLogNull>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
|
std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
|
||||||
|
|
Loading…
Reference in a new issue