Commit 2c41f984 authored by sergeyu's avatar sergeyu Committed by Commit bot

Add ScopedAllowIO in WebrtcTransport when shutting down WebRTC session.

PeerConnection creates new threads internally and shuts them down when
connection is closed. This is a blocking operation, so Debug builds were
DCHECK'ing every time connection is terminated. Added ScopedAllowIO to
work around this issue.

BUG=660081

Review-Url: https://codereview.chromium.org/2567533002
Cr-Commit-Position: refs/heads/master@{#437711}
parent 759bba67
...@@ -216,6 +216,7 @@ _BANNED_CPP_FUNCTIONS = ( ...@@ -216,6 +216,7 @@ _BANNED_CPP_FUNCTIONS = (
r"^net[\\\/]test[\\\/]spawned_test_server[\\\/]local_test_server\.cc$", r"^net[\\\/]test[\\\/]spawned_test_server[\\\/]local_test_server\.cc$",
r"^net[\\\/]test[\\\/]test_data_directory\.cc$", r"^net[\\\/]test[\\\/]test_data_directory\.cc$",
r"^net[\\\/]url_request[\\\/]test_url_fetcher_factory\.cc$", r"^net[\\\/]url_request[\\\/]test_url_fetcher_factory\.cc$",
r"^remoting[\\\/]protocol[\\\/]webrtc_transport\.cc$",
r"^ui[\\\/]base[\\\/]material_design[\\\/]" r"^ui[\\\/]base[\\\/]material_design[\\\/]"
"material_design_controller\.cc$", "material_design_controller\.cc$",
r"^ui[\\\/]gl[\\\/]init[\\\/]gl_initializer_mac\.cc$", r"^ui[\\\/]gl[\\\/]init[\\\/]gl_initializer_mac\.cc$",
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/task_runner_util.h" #include "base/task_runner_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "jingle/glue/thread_wrapper.h" #include "jingle/glue/thread_wrapper.h"
#include "remoting/protocol/authenticator.h" #include "remoting/protocol/authenticator.h"
...@@ -194,7 +195,13 @@ class WebrtcTransport::PeerConnectionWrapper ...@@ -194,7 +195,13 @@ class WebrtcTransport::PeerConnectionWrapper
peer_connection_ = peer_connection_factory_->CreatePeerConnection( peer_connection_ = peer_connection_factory_->CreatePeerConnection(
rtc_config, &constraints, std::move(port_allocator), nullptr, this); rtc_config, &constraints, std::move(port_allocator), nullptr, this);
} }
virtual ~PeerConnectionWrapper() { peer_connection_->Close(); } virtual ~PeerConnectionWrapper() {
// PeerConnection creates threads internally, which are stopped when the
// connection is closed. Thread.Stop() is a blocking operation.
// See crbug.com/660081.
base::ThreadRestrictions::ScopedAllowIO allow_io;
peer_connection_->Close();
}
WebrtcAudioModule* audio_module() { WebrtcAudioModule* audio_module() {
return audio_module_.get(); return audio_module_.get();
......
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