Reland of Make the default ctor of rtc::Thread, protected
This is a partial re-land. The change doesn't make the default Thread ctor protected anymore but it does mark it as deprecated and updates all use of it in WebRTC.
Original issue's description:
Make the default ctor of rtc::Thread, protected.
The goal is to force use of Thread::Create or Thread::CreateWithSocketServer.
The default constructor constructs a 'default' socket server, which is usually a 'physical' socket server, but not always. Not every instance of Thread actually needs to have network support, so it's better to have this be explicit instead of unknowingly instantiate one.
BUG=none
Review-Url: https://codereview.webrtc.org/2977953002
Cr-Commit-Position: refs/heads/master@{#19031}
diff --git a/webrtc/rtc_base/nullsocketserver_unittest.cc b/webrtc/rtc_base/nullsocketserver_unittest.cc
index 5908d32..5538322 100644
--- a/webrtc/rtc_base/nullsocketserver_unittest.cc
+++ b/webrtc/rtc_base/nullsocketserver_unittest.cc
@@ -28,9 +28,9 @@
};
TEST_F(NullSocketServerTest, WaitAndSet) {
- Thread thread;
- EXPECT_TRUE(thread.Start());
- thread.Post(RTC_FROM_HERE, this, 0);
+ auto thread = Thread::Create();
+ EXPECT_TRUE(thread->Start());
+ thread->Post(RTC_FROM_HERE, this, 0);
// The process_io will be ignored.
const bool process_io = true;
EXPECT_TRUE_WAIT(ss_.Wait(SocketServer::kForever, process_io), kTimeout);