Fix for crash in event log when using scenario tests.

Scenario tests runs all its activities on task queues. This is not
allowed by the default event log writer, causing a DCHECK failure.
This CL makes it possible to stop the event asynchronously,
thereby avoiding the need for the DCHECK.

Bug: webrtc:10365
Change-Id: I1206982b29fd609ac85b4ce30ae9291cbec52041
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136685
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28027}
This commit is contained in:
Sebastian Jansson
2019-05-22 16:20:56 +02:00
committed by Commit Bot
parent 9ce451a03f
commit 58c71db1b3
6 changed files with 51 additions and 12 deletions

View File

@ -43,6 +43,7 @@ class RtcEventLogImpl final : public RtcEventLog {
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) override;
void StopLogging() override;
void StopLogging(std::function<void()> callback) override;
void Log(std::unique_ptr<RtcEvent> event) override;
@ -80,6 +81,9 @@ class RtcEventLogImpl final : public RtcEventLog {
int64_t last_output_ms_ RTC_GUARDED_BY(*task_queue_);
bool output_scheduled_ RTC_GUARDED_BY(*task_queue_);
SequenceChecker logging_state_checker_;
bool logging_state_started_ RTC_GUARDED_BY(logging_state_checker_);
// Since we are posting tasks bound to |this|, it is critical that the event
// log and its members outlive |task_queue_|. Keep the |task_queue_|
// last to ensure it destructs first, or else tasks living on the queue might