Remove functions to inject a TaskQueue in RtcEventLog creation.

The event log implementation will be simpler if it creates its own TaskQueue.
If we really need the "injectable" functionality, it could be achieved via a
TaskQueueFactory that returns a move-constructible TaskQueue.

Bug: webrtc:10085
Change-Id: I538be3dd77c09be2f5bae015227067acd6af8355
Reviewed-on: https://webrtc-review.googlesource.com/c/113140
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25908}
This commit is contained in:
Bjorn Terelius 2018-12-04 18:52:22 +01:00 committed by Commit Bot
parent b438b5a33d
commit bd2cf71865
7 changed files with 3 additions and 41 deletions

View File

@ -22,12 +22,4 @@ std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
return fake_event_log; return fake_event_log;
} }
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) {
std::unique_ptr<RtcEventLog> fake_event_log(new FakeRtcEventLog(thread()));
last_log_created_ = fake_event_log.get();
return fake_event_log;
}
} // namespace webrtc } // namespace webrtc

View File

@ -27,10 +27,6 @@ class FakeRtcEventLogFactory : public RtcEventLogFactoryInterface {
std::unique_ptr<RtcEventLog> CreateRtcEventLog( std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) override; RtcEventLog::EncodingType encoding_type) override;
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) override;
webrtc::RtcEventLog* last_log_created() { return last_log_created_; } webrtc::RtcEventLog* last_log_created() { return last_log_created_; }
rtc::Thread* thread() { return thread_; } rtc::Thread* thread() { return thread_; }

View File

@ -37,12 +37,6 @@ class RtcEventLog {
// Factory method to create an RtcEventLog object. // Factory method to create an RtcEventLog object.
static std::unique_ptr<RtcEventLog> Create(EncodingType encoding_type); static std::unique_ptr<RtcEventLog> Create(EncodingType encoding_type);
// Factory method to create an RtcEventLog object which uses the given
// rtc::TaskQueue for emitting output.
static std::unique_ptr<RtcEventLog> Create(
EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue);
// Create an RtcEventLog object that does nothing. // Create an RtcEventLog object that does nothing.
static std::unique_ptr<RtcEventLog> CreateNull(); static std::unique_ptr<RtcEventLog> CreateNull();

View File

@ -21,12 +21,6 @@ std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
return RtcEventLog::Create(encoding_type); return RtcEventLog::Create(encoding_type);
} }
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) {
return RtcEventLog::Create(encoding_type, std::move(task_queue));
}
std::unique_ptr<RtcEventLogFactoryInterface> CreateRtcEventLogFactory() { std::unique_ptr<RtcEventLogFactoryInterface> CreateRtcEventLogFactory() {
return std::unique_ptr<RtcEventLogFactoryInterface>(new RtcEventLogFactory()); return std::unique_ptr<RtcEventLogFactoryInterface>(new RtcEventLogFactory());
} }

View File

@ -25,10 +25,6 @@ class RtcEventLogFactory : public RtcEventLogFactoryInterface {
std::unique_ptr<RtcEventLog> CreateRtcEventLog( std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) override; RtcEventLog::EncodingType encoding_type) override;
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) override;
}; };
std::unique_ptr<RtcEventLogFactoryInterface> CreateRtcEventLogFactory(); std::unique_ptr<RtcEventLogFactoryInterface> CreateRtcEventLogFactory();

View File

@ -27,10 +27,6 @@ class RtcEventLogFactoryInterface {
virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog( virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) = 0; RtcEventLog::EncodingType encoding_type) = 0;
virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) = 0;
}; };
std::unique_ptr<RtcEventLogFactoryInterface> CreateRtcEventLogFactory(); std::unique_ptr<RtcEventLogFactoryInterface> CreateRtcEventLogFactory();

View File

@ -369,16 +369,10 @@ void RtcEventLogImpl::WriteToOutput(const std::string& output_string) {
// RtcEventLog member functions. // RtcEventLog member functions.
std::unique_ptr<RtcEventLog> RtcEventLog::Create(EncodingType encoding_type) { std::unique_ptr<RtcEventLog> RtcEventLog::Create(EncodingType encoding_type) {
return Create(encoding_type,
absl::make_unique<rtc::TaskQueue>("rtc_event_log"));
}
std::unique_ptr<RtcEventLog> RtcEventLog::Create(
EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) {
#ifdef ENABLE_RTC_EVENT_LOG #ifdef ENABLE_RTC_EVENT_LOG
return absl::make_unique<RtcEventLogImpl>(CreateEncoder(encoding_type), return absl::make_unique<RtcEventLogImpl>(
std::move(task_queue)); CreateEncoder(encoding_type),
absl::make_unique<rtc::TaskQueue>("rtc_event_log"));
#else #else
return CreateNull(); return CreateNull();
#endif // ENABLE_RTC_EVENT_LOG #endif // ENABLE_RTC_EVENT_LOG