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/pc/channelmanager_unittest.cc b/webrtc/pc/channelmanager_unittest.cc
index c03056c..b322407 100644
--- a/webrtc/pc/channelmanager_unittest.cc
+++ b/webrtc/pc/channelmanager_unittest.cc
@@ -38,7 +38,9 @@
 class ChannelManagerTest : public testing::Test {
  protected:
   ChannelManagerTest()
-      : fme_(new cricket::FakeMediaEngine()),
+      : network_(rtc::Thread::CreateWithSocketServer()),
+        worker_(rtc::Thread::Create()),
+        fme_(new cricket::FakeMediaEngine()),
         fdme_(new cricket::FakeDataEngine()),
         cm_(new cricket::ChannelManager(
             std::unique_ptr<MediaEngineInterface>(fme_),
@@ -52,8 +54,8 @@
   }
 
   webrtc::RtcEventLogNullImpl event_log_;
-  rtc::Thread network_;
-  rtc::Thread worker_;
+  std::unique_ptr<rtc::Thread> network_;
+  std::unique_ptr<rtc::Thread> worker_;
   // |fme_| and |fdme_| are actually owned by |cm_|.
   cricket::FakeMediaEngine* fme_;
   cricket::FakeDataEngine* fdme_;
@@ -74,14 +76,14 @@
 
 // Test that we startup/shutdown properly with a worker thread.
 TEST_F(ChannelManagerTest, StartupShutdownOnThread) {
-  network_.Start();
-  worker_.Start();
+  network_->Start();
+  worker_->Start();
   EXPECT_FALSE(cm_->initialized());
   EXPECT_EQ(rtc::Thread::Current(), cm_->worker_thread());
-  EXPECT_TRUE(cm_->set_network_thread(&network_));
-  EXPECT_EQ(&network_, cm_->network_thread());
-  EXPECT_TRUE(cm_->set_worker_thread(&worker_));
-  EXPECT_EQ(&worker_, cm_->worker_thread());
+  EXPECT_TRUE(cm_->set_network_thread(network_.get()));
+  EXPECT_EQ(network_.get(), cm_->network_thread());
+  EXPECT_TRUE(cm_->set_worker_thread(worker_.get()));
+  EXPECT_EQ(worker_.get(), cm_->worker_thread());
   EXPECT_TRUE(cm_->Init());
   EXPECT_TRUE(cm_->initialized());
   // Setting the network or worker thread while initialized should fail.
@@ -121,13 +123,13 @@
 
 // Test that we can create and destroy a voice and video channel with a worker.
 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) {
-  network_.Start();
-  worker_.Start();
-  EXPECT_TRUE(cm_->set_worker_thread(&worker_));
-  EXPECT_TRUE(cm_->set_network_thread(&network_));
+  network_->Start();
+  worker_->Start();
+  EXPECT_TRUE(cm_->set_worker_thread(worker_.get()));
+  EXPECT_TRUE(cm_->set_network_thread(network_.get()));
   EXPECT_TRUE(cm_->Init());
-  transport_controller_.reset(
-      new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING));
+  transport_controller_.reset(new cricket::FakeTransportController(
+      network_.get(), ICEROLE_CONTROLLING));
   cricket::DtlsTransportInternal* rtp_transport =
       transport_controller_->CreateDtlsTransport(
           cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP);