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

@ -54,6 +54,15 @@ class RtcEventLog {
// which it would be permissible to read and/or modify it.
virtual void StopLogging() = 0;
// Stops logging to file and calls |callback| when the file has been closed.
// Note that it is not safe to call any other members, including the
// destructor, until the callback has been called.
// TODO(srte): Remove default implementation when it's safe to do so.
virtual void StopLogging(std::function<void()> callback) {
StopLogging();
callback();
}
// Log an RTC event (the type of event is determined by the subclass).
virtual void Log(std::unique_ptr<RtcEvent> event) = 0;
};