Remove RtcEventLogImpl::owner_sequence_checker_
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 <eladalon@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27914}
This commit is contained in:
@ -21,6 +21,7 @@
|
|||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/rtc_event_log_output.h"
|
#include "api/rtc_event_log_output.h"
|
||||||
#include "api/task_queue/queued_task.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_legacy.h"
|
||||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
@ -111,10 +112,6 @@ class RtcEventLogImpl final : public RtcEventLog {
|
|||||||
|
|
||||||
void ScheduleOutput() RTC_RUN_ON(task_queue_);
|
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.
|
// History containing all past configuration events.
|
||||||
std::deque<std::unique_ptr<RtcEvent>> config_history_
|
std::deque<std::unique_ptr<RtcEvent>> config_history_
|
||||||
RTC_GUARDED_BY(*task_queue_);
|
RTC_GUARDED_BY(*task_queue_);
|
||||||
@ -157,8 +154,6 @@ RtcEventLogImpl::RtcEventLogImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
RtcEventLogImpl::~RtcEventLogImpl() {
|
RtcEventLogImpl::~RtcEventLogImpl() {
|
||||||
RTC_DCHECK_RUN_ON(&owner_sequence_checker_);
|
|
||||||
|
|
||||||
// If we're logging to the output, this will stop that. Blocking function.
|
// If we're logging to the output, this will stop that. Blocking function.
|
||||||
StopLogging();
|
StopLogging();
|
||||||
|
|
||||||
@ -171,8 +166,6 @@ RtcEventLogImpl::~RtcEventLogImpl() {
|
|||||||
|
|
||||||
bool RtcEventLogImpl::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
|
bool RtcEventLogImpl::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
|
||||||
int64_t output_period_ms) {
|
int64_t output_period_ms) {
|
||||||
RTC_DCHECK_RUN_ON(&owner_sequence_checker_);
|
|
||||||
|
|
||||||
RTC_DCHECK(output_period_ms == kImmediateOutput || output_period_ms > 0);
|
RTC_DCHECK(output_period_ms == kImmediateOutput || output_period_ms > 0);
|
||||||
|
|
||||||
if (!output->IsActive()) {
|
if (!output->IsActive()) {
|
||||||
@ -206,8 +199,6 @@ bool RtcEventLogImpl::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RtcEventLogImpl::StopLogging() {
|
void RtcEventLogImpl::StopLogging() {
|
||||||
RTC_DCHECK_RUN_ON(&owner_sequence_checker_);
|
|
||||||
|
|
||||||
RTC_LOG(LS_INFO) << "Stopping WebRTC event log.";
|
RTC_LOG(LS_INFO) << "Stopping WebRTC event log.";
|
||||||
|
|
||||||
rtc::Event output_stopped;
|
rtc::Event output_stopped;
|
||||||
@ -223,6 +214,11 @@ void RtcEventLogImpl::StopLogging() {
|
|||||||
output_stopped.Set();
|
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);
|
output_stopped.Wait(rtc::Event::kForever);
|
||||||
|
|
||||||
RTC_LOG(LS_INFO) << "WebRTC event log successfully stopped.";
|
RTC_LOG(LS_INFO) << "WebRTC event log successfully stopped.";
|
||||||
|
Reference in New Issue
Block a user