Reland of Make RtcEventLogImpl to use a TaskQueue instead of a helper-thread ( https://codereview.webrtc.org/3007473002/ )
Original issue's description:
> Revert of Make RtcEventLogImpl to use a TaskQueue instead of a helper-thread (patchset #18 id:340001 of https://codereview.webrtc.org/3007473002/ )
>
> Reason for revert:
> Breaks google3 project.
>
> Original issue's description:
> > Make RtcEventLogImpl to use a TaskQueue instead of a helper-thread
> >
> > Make RtcEventLogImpl to use a TaskQueue instead of a helper-thread. This will eventually allow us to run multiple log sessions on a single task-queue.
> >
> > BUG=webrtc:8142, webrtc:8143, webrtc:8145
> >
> > Review-Url: https://codereview.webrtc.org/3007473002
> > Cr-Commit-Position: refs/heads/master@{#19666}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/f33cee7534f0469330b6b7aa57f84eec4b082598
TBR=terelius@webrtc.org,nisse@webrtc.org,charujain@webrtc.org
NOPRESUBMIT=true
NOTRY=True
BUG=webrtc:8142, webrtc:8143, webrtc:8145
Review-Url: https://codereview.webrtc.org/3012783002
Cr-Commit-Position: refs/heads/master@{#19712}
diff --git a/webrtc/pc/peerconnection.cc b/webrtc/pc/peerconnection.cc
index e22a09e..b258c1f 100644
--- a/webrtc/pc/peerconnection.cc
+++ b/webrtc/pc/peerconnection.cc
@@ -425,9 +425,11 @@
// port_allocator_ lives on the network thread and should be destroyed there.
network_thread()->Invoke<void>(RTC_FROM_HERE,
[this] { port_allocator_.reset(); });
- // call_ must be destroyed on the worker thread.
- factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE,
- [this] { call_.reset(); });
+ // call_ and event_log_ must be destroyed on the worker thread.
+ factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+ call_.reset();
+ event_log_.reset();
+ });
}
bool PeerConnection::Initialize(
@@ -1337,11 +1339,11 @@
rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool,
port_allocator_.get()));
- factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE,
- [this] { call_.reset(); });
-
- // The event log must outlive call (and any other object that uses it).
- event_log_.reset();
+ factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+ call_.reset();
+ // The event log must outlive call (and any other object that uses it).
+ event_log_.reset();
+ });
}
void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/,