Commit 5fccc25e authored by Frank Liberato's avatar Frank Liberato Committed by Chromium LUCI CQ

Avoid data race in PeerConnectionDependencyFactory.

InitializeSignalingThread reads from `worker_thread_`, without
synchronizing with InitializeWorkerThread which writes it.

This CL moves the wait for IWT to before IST can run.

Bug: 1160469
Change-Id: I9fd5f6341f900c1b9d43386c427b4086333e6f1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601044
Auto-Submit: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839028}
parent eb58a0e1
......@@ -242,6 +242,13 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() {
create_network_manager_event.Wait();
CHECK(network_thread_);
// Wait for the worker thread, since `InitializeSignalingThread` needs to
// refer to `worker_thread_`.
if (chrome_worker_thread_) {
start_worker_event.Wait();
CHECK(worker_thread_);
}
base::WaitableEvent start_signaling_event(
base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED);
......@@ -254,10 +261,6 @@ void PeerConnectionDependencyFactory::CreatePeerConnectionFactory() {
CrossThreadUnretained(Platform::Current()->GetMediaDecoderFactory()),
CrossThreadUnretained(&start_signaling_event)));
if (chrome_worker_thread_) {
start_worker_event.Wait();
CHECK(worker_thread_);
}
start_signaling_event.Wait();
CHECK(signaling_thread_);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment