From 2a1f020dd9e60407abf55703bc1268cbb8cc530d Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Fri, 10 May 2019 14:42:53 +0200 Subject: [PATCH] Remove RtcEventLogImpl::owner_sequence_checker_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This sequence checker was necessary back when a concern existed over calling StopLogging() twice. That is no longer a concern. Bug: webrtc:10613 Change-Id: Ib28d876a8c1940e76d4914287043cce2a1d974b0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135949 Commit-Queue: Elad Alon Reviewed-by: Björn Terelius Cr-Commit-Position: refs/heads/master@{#27914} --- logging/rtc_event_log/rtc_event_log_impl.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/logging/rtc_event_log/rtc_event_log_impl.cc b/logging/rtc_event_log/rtc_event_log_impl.cc index 51fa74a9ec..c8c7c626ee 100644 --- a/logging/rtc_event_log/rtc_event_log_impl.cc +++ b/logging/rtc_event_log/rtc_event_log_impl.cc @@ -21,6 +21,7 @@ #include "absl/types/optional.h" #include "api/rtc_event_log_output.h" #include "api/task_queue/queued_task.h" +#include "api/task_queue/task_queue_base.h" #include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h" #include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h" #include "rtc_base/checks.h" @@ -111,10 +112,6 @@ class RtcEventLogImpl final : public RtcEventLog { void ScheduleOutput() RTC_RUN_ON(task_queue_); - // Make sure that the event log is "managed" - created/destroyed, as well - // as started/stopped - from the same thread/task-queue. - SequenceChecker owner_sequence_checker_; - // History containing all past configuration events. std::deque> config_history_ RTC_GUARDED_BY(*task_queue_); @@ -157,8 +154,6 @@ RtcEventLogImpl::RtcEventLogImpl( } RtcEventLogImpl::~RtcEventLogImpl() { - RTC_DCHECK_RUN_ON(&owner_sequence_checker_); - // If we're logging to the output, this will stop that. Blocking function. StopLogging(); @@ -171,8 +166,6 @@ RtcEventLogImpl::~RtcEventLogImpl() { bool RtcEventLogImpl::StartLogging(std::unique_ptr output, int64_t output_period_ms) { - RTC_DCHECK_RUN_ON(&owner_sequence_checker_); - RTC_DCHECK(output_period_ms == kImmediateOutput || output_period_ms > 0); if (!output->IsActive()) { @@ -206,8 +199,6 @@ bool RtcEventLogImpl::StartLogging(std::unique_ptr output, } void RtcEventLogImpl::StopLogging() { - RTC_DCHECK_RUN_ON(&owner_sequence_checker_); - RTC_LOG(LS_INFO) << "Stopping WebRTC event log."; rtc::Event output_stopped; @@ -223,6 +214,11 @@ void RtcEventLogImpl::StopLogging() { output_stopped.Set(); }); + // By making sure StopLogging() is not executed on a task queue, + // we ensure it's not running on a thread that is shared with |task_queue_|, + // meaning the following Wait() will not block forever. + RTC_DCHECK(TaskQueueBase::Current() == nullptr); + output_stopped.Wait(rtc::Event::kForever); RTC_LOG(LS_INFO) << "WebRTC event log successfully stopped.";