Remove calls to ScopedToUnique and UniqueToScoped

They're just no-ops now, and will soon go away.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1914153002

Cr-Commit-Position: refs/heads/master@{#12510}
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
index 28d2f63..1cf7924 100644
--- a/webrtc/api/webrtcsession.cc
+++ b/webrtc/api/webrtcsession.cc
@@ -1241,7 +1241,7 @@
   if (!voice_channel_)
     return;
 
-  voice_channel_->SetRawAudioSink(ssrc, rtc::ScopedToUnique(std::move(sink)));
+  voice_channel_->SetRawAudioSink(ssrc, std::move(sink));
 }
 
 RtpParameters WebRtcSession::GetAudioRtpParameters(uint32_t ssrc) const {
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index 61eb80a..67abc56 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -191,9 +191,8 @@
 Call::Call(const Call::Config& config)
     : clock_(Clock::GetRealTimeClock()),
       num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
-      module_process_thread_(
-          rtc::ScopedToUnique(ProcessThread::Create("ModuleProcessThread"))),
-      pacer_thread_(rtc::ScopedToUnique(ProcessThread::Create("PacerThread"))),
+      module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
+      pacer_thread_(ProcessThread::Create("PacerThread")),
       call_stats_(new CallStats(clock_)),
       bitrate_allocator_(new BitrateAllocator()),
       config_(config),
diff --git a/webrtc/common_audio/lapped_transform.cc b/webrtc/common_audio/lapped_transform.cc
index 0edf586..5ab1db1 100644
--- a/webrtc/common_audio/lapped_transform.cc
+++ b/webrtc/common_audio/lapped_transform.cc
@@ -72,8 +72,7 @@
                window,
                shift_amount,
                &blocker_callback_),
-      fft_(rtc::ScopedToUnique(
-          RealFourier::Create(RealFourier::FftOrder(block_length_)))),
+      fft_(RealFourier::Create(RealFourier::FftOrder(block_length_))),
       cplx_length_(RealFourier::ComplexLength(fft_->order())),
       real_buf_(num_in_channels,
                 block_length_,
diff --git a/webrtc/modules/audio_device/android/audio_manager.cc b/webrtc/modules/audio_device/android/audio_manager.cc
index 9174a5b..01e5d5f 100644
--- a/webrtc/modules/audio_device/android/audio_manager.cc
+++ b/webrtc/modules/audio_device/android/audio_manager.cc
@@ -66,7 +66,7 @@
 
 // AudioManager implementation
 AudioManager::AudioManager()
-    : j_environment_(rtc::ScopedToUnique(JVM::GetInstance()->environment())),
+    : j_environment_(JVM::GetInstance()->environment()),
       audio_layer_(AudioDeviceModule::kPlatformDefaultAudio),
       initialized_(false),
       hardware_aec_(false),
@@ -80,14 +80,14 @@
       {"nativeCacheAudioParameters",
        "(IIZZZZIIJ)V",
        reinterpret_cast<void*>(&webrtc::AudioManager::CacheAudioParameters)}};
-  j_native_registration_ = rtc::ScopedToUnique(j_environment_->RegisterNatives(
-      "org/webrtc/voiceengine/WebRtcAudioManager",
-      native_methods, arraysize(native_methods)));
+  j_native_registration_ = j_environment_->RegisterNatives(
+      "org/webrtc/voiceengine/WebRtcAudioManager", native_methods,
+      arraysize(native_methods));
   j_audio_manager_.reset(new JavaAudioManager(
       j_native_registration_.get(),
-      rtc::ScopedToUnique(j_native_registration_->NewObject(
+      j_native_registration_->NewObject(
           "<init>", "(Landroid/content/Context;J)V",
-          JVM::GetInstance()->context(), PointerTojlong(this)))));
+          JVM::GetInstance()->context(), PointerTojlong(this))));
 }
 
 AudioManager::~AudioManager() {
diff --git a/webrtc/modules/audio_device/android/audio_record_jni.cc b/webrtc/modules/audio_device/android/audio_record_jni.cc
index 5ff5997..8ce1386 100644
--- a/webrtc/modules/audio_device/android/audio_record_jni.cc
+++ b/webrtc/modules/audio_device/android/audio_record_jni.cc
@@ -74,7 +74,7 @@
 
 // AudioRecordJni implementation.
 AudioRecordJni::AudioRecordJni(AudioManager* audio_manager)
-    : j_environment_(rtc::ScopedToUnique(JVM::GetInstance()->environment())),
+    : j_environment_(JVM::GetInstance()->environment()),
       audio_manager_(audio_manager),
       audio_parameters_(audio_manager->GetRecordAudioParameters()),
       total_delay_in_milliseconds_(0),
@@ -93,14 +93,14 @@
           &webrtc::AudioRecordJni::CacheDirectBufferAddress)},
       {"nativeDataIsRecorded", "(IJ)V",
       reinterpret_cast<void*>(&webrtc::AudioRecordJni::DataIsRecorded)}};
-  j_native_registration_ = rtc::ScopedToUnique(j_environment_->RegisterNatives(
-      "org/webrtc/voiceengine/WebRtcAudioRecord",
-      native_methods, arraysize(native_methods)));
+  j_native_registration_ = j_environment_->RegisterNatives(
+      "org/webrtc/voiceengine/WebRtcAudioRecord", native_methods,
+      arraysize(native_methods));
   j_audio_record_.reset(new JavaAudioRecord(
       j_native_registration_.get(),
-      rtc::ScopedToUnique(j_native_registration_->NewObject(
+      j_native_registration_->NewObject(
           "<init>", "(Landroid/content/Context;J)V",
-          JVM::GetInstance()->context(), PointerTojlong(this)))));
+          JVM::GetInstance()->context(), PointerTojlong(this))));
   // Detach from this thread since we want to use the checker to verify calls
   // from the Java based audio thread.
   thread_checker_java_.DetachFromThread();
diff --git a/webrtc/modules/audio_device/android/audio_track_jni.cc b/webrtc/modules/audio_device/android/audio_track_jni.cc
index 67837f5..fc77e32 100644
--- a/webrtc/modules/audio_device/android/audio_track_jni.cc
+++ b/webrtc/modules/audio_device/android/audio_track_jni.cc
@@ -69,7 +69,7 @@
 
 // TODO(henrika): possible extend usage of AudioManager and add it as member.
 AudioTrackJni::AudioTrackJni(AudioManager* audio_manager)
-    : j_environment_(rtc::ScopedToUnique(JVM::GetInstance()->environment())),
+    : j_environment_(JVM::GetInstance()->environment()),
       audio_parameters_(audio_manager->GetPlayoutAudioParameters()),
       direct_buffer_address_(nullptr),
       direct_buffer_capacity_in_bytes_(0),
@@ -86,14 +86,14 @@
           &webrtc::AudioTrackJni::CacheDirectBufferAddress)},
       {"nativeGetPlayoutData", "(IJ)V",
       reinterpret_cast<void*>(&webrtc::AudioTrackJni::GetPlayoutData)}};
-  j_native_registration_ = rtc::ScopedToUnique(j_environment_->RegisterNatives(
-      "org/webrtc/voiceengine/WebRtcAudioTrack",
-      native_methods, arraysize(native_methods)));
+  j_native_registration_ = j_environment_->RegisterNatives(
+      "org/webrtc/voiceengine/WebRtcAudioTrack", native_methods,
+      arraysize(native_methods));
   j_audio_track_.reset(new JavaAudioTrack(
       j_native_registration_.get(),
-      rtc::ScopedToUnique(j_native_registration_->NewObject(
+      j_native_registration_->NewObject(
           "<init>", "(Landroid/content/Context;J)V",
-          JVM::GetInstance()->context(), PointerTojlong(this)))));
+          JVM::GetInstance()->context(), PointerTojlong(this))));
   // Detach from this thread since we want to use the checker to verify calls
   // from the Java based audio thread.
   thread_checker_java_.DetachFromThread();
diff --git a/webrtc/modules/audio_device/android/build_info.cc b/webrtc/modules/audio_device/android/build_info.cc
index c6cecc9..455c12f 100644
--- a/webrtc/modules/audio_device/android/build_info.cc
+++ b/webrtc/modules/audio_device/android/build_info.cc
@@ -15,10 +15,9 @@
 namespace webrtc {
 
 BuildInfo::BuildInfo()
-    : j_environment_(rtc::ScopedToUnique(JVM::GetInstance()->environment())),
-      j_build_info_(JVM::GetInstance()->GetClass(
-          "org/webrtc/voiceengine/BuildInfo")) {
-}
+    : j_environment_(JVM::GetInstance()->environment()),
+      j_build_info_(
+          JVM::GetInstance()->GetClass("org/webrtc/voiceengine/BuildInfo")) {}
 
 std::string BuildInfo::GetStringFromJava(const char* name) {
   jmethodID id = j_build_info_.GetStaticMethodId(name, "()Ljava/lang/String;");
diff --git a/webrtc/modules/audio_device/test/audio_device_test_api.cc b/webrtc/modules/audio_device/test/audio_device_test_api.cc
index f37d89c..78642c3 100644
--- a/webrtc/modules/audio_device/test/audio_device_test_api.cc
+++ b/webrtc/modules/audio_device/test/audio_device_test_api.cc
@@ -142,8 +142,7 @@
   virtual ~AudioDeviceAPITest() {}
 
   static void SetUpTestCase() {
-    process_thread_ =
-        rtc::ScopedToUnique(ProcessThread::Create("ProcessThread"));
+    process_thread_ = ProcessThread::Create("ProcessThread");
     process_thread_->Start();
 
     // Windows:
diff --git a/webrtc/modules/audio_device/test/func_test_manager.cc b/webrtc/modules/audio_device/test/func_test_manager.cc
index bb7686c..cc58965 100644
--- a/webrtc/modules/audio_device/test/func_test_manager.cc
+++ b/webrtc/modules/audio_device/test/func_test_manager.cc
@@ -594,11 +594,10 @@
 
 int32_t FuncTestManager::Init()
 {
-    EXPECT_TRUE((_processThread = rtc::ScopedToUnique(
-                     ProcessThread::Create("ProcessThread"))) != NULL);
-    if (_processThread == NULL)
-    {
-        return -1;
+    EXPECT_TRUE((_processThread = ProcessThread::Create("ProcessThread")) !=
+                NULL);
+    if (_processThread == NULL) {
+      return -1;
     }
     _processThread->Start();
 
@@ -832,8 +831,8 @@
         // ==================================================
         // Next, try to make fresh start with new audio layer
 
-        EXPECT_TRUE((_processThread = rtc::ScopedToUnique(
-                         ProcessThread::Create("ProcessThread"))) != NULL);
+        EXPECT_TRUE((_processThread = ProcessThread::Create("ProcessThread")) !=
+                    NULL);
         if (_processThread == NULL)
         {
             return -1;
diff --git a/webrtc/modules/desktop_capture/desktop_frame.cc b/webrtc/modules/desktop_capture/desktop_frame.cc
index 6bc7b2e..3278ed4 100644
--- a/webrtc/modules/desktop_capture/desktop_frame.cc
+++ b/webrtc/modules/desktop_capture/desktop_frame.cc
@@ -84,8 +84,7 @@
   size_t buffer_size =
       size.width() * size.height() * DesktopFrame::kBytesPerPixel;
   std::unique_ptr<SharedMemory> shared_memory;
-  shared_memory = rtc::ScopedToUnique(
-      shared_memory_factory->CreateSharedMemory(buffer_size));
+  shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
   if (!shared_memory)
     return nullptr;
 
diff --git a/webrtc/modules/desktop_capture/desktop_frame_win.cc b/webrtc/modules/desktop_capture/desktop_frame_win.cc
index e91e37e..624b729 100644
--- a/webrtc/modules/desktop_capture/desktop_frame_win.cc
+++ b/webrtc/modules/desktop_capture/desktop_frame_win.cc
@@ -49,8 +49,7 @@
   std::unique_ptr<SharedMemory> shared_memory;
   HANDLE section_handle = nullptr;
   if (shared_memory_factory) {
-    shared_memory = rtc::ScopedToUnique(
-        shared_memory_factory->CreateSharedMemory(buffer_size));
+    shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
     section_handle = shared_memory->handle();
   }
   void* data = nullptr;
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
index 022e1ce..5a494f4 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
@@ -75,8 +75,7 @@
 
 void ScreenCapturerWinGdi::SetSharedMemoryFactory(
     rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {
-  shared_memory_factory_ =
-      rtc::ScopedToUnique(std::move(shared_memory_factory));
+  shared_memory_factory_ = std::move(shared_memory_factory);
 }
 
 void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
index 4bcd4d1..053a0a3 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
@@ -83,8 +83,7 @@
 
 void ScreenCapturerWinMagnifier::SetSharedMemoryFactory(
     rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {
-  shared_memory_factory_ =
-      rtc::ScopedToUnique(std::move(shared_memory_factory));
+  shared_memory_factory_ = std::move(shared_memory_factory);
 }
 
 void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) {
diff --git a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc
index f3be092..0111571 100644
--- a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc
@@ -207,8 +207,8 @@
         packets[i].sequence_number, packets[i].arrival_time_ms * 1000));
 
     rtc::Buffer raw_packet = feedback->Build();
-    feedback = rtc::ScopedToUnique(rtcp::TransportFeedback::ParseFrom(
-        raw_packet.data(), raw_packet.size()));
+    feedback = rtcp::TransportFeedback::ParseFrom(raw_packet.data(),
+                                                  raw_packet.size());
 
     std::vector<PacketInfo> expected_packets;
     expected_packets.push_back(packets[i]);
@@ -276,8 +276,8 @@
                                             info.arrival_time_ms * 1000));
 
   rtc::Buffer raw_packet = feedback->Build();
-  feedback = rtc::ScopedToUnique(
-      rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size()));
+  feedback =
+      rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size());
 
   std::vector<PacketInfo> received_feedback;
 
@@ -297,8 +297,8 @@
   EXPECT_TRUE(feedback->WithReceivedPacket(info.sequence_number,
                                            info.arrival_time_ms * 1000));
   raw_packet = feedback->Build();
-  feedback = rtc::ScopedToUnique(
-      rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size()));
+  feedback =
+      rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size());
 
   EXPECT_TRUE(feedback.get() != nullptr);
   EXPECT_CALL(*bitrate_estimator_, IncomingPacketFeedbackVector(_))
diff --git a/webrtc/modules/utility/source/process_thread_impl_unittest.cc b/webrtc/modules/utility/source/process_thread_impl_unittest.cc
index 9fa9edf..16f3b50 100644
--- a/webrtc/modules/utility/source/process_thread_impl_unittest.cc
+++ b/webrtc/modules/utility/source/process_thread_impl_unittest.cc
@@ -297,7 +297,7 @@
   std::unique_ptr<EventWrapper> task_ran(EventWrapper::Create());
   std::unique_ptr<RaiseEventTask> task(new RaiseEventTask(task_ran.get()));
   thread.Start();
-  thread.PostTask(rtc::UniqueToScoped(std::move(task)));
+  thread.PostTask(std::move(task));
   EXPECT_EQ(kEventSignaled, task_ran->Wait(100));
   thread.Stop();
 }
diff --git a/webrtc/modules/video_capture/test/video_capture_unittest.cc b/webrtc/modules/video_capture/test/video_capture_unittest.cc
index 7ab33ff..e75ad03 100644
--- a/webrtc/modules/video_capture/test/video_capture_unittest.cc
+++ b/webrtc/modules/video_capture/test/video_capture_unittest.cc
@@ -434,8 +434,7 @@
  public:
   void SetUp() {
     capture_module_ = VideoCaptureFactory::Create(0, capture_input_interface_);
-    process_module_ =
-        rtc::ScopedToUnique(webrtc::ProcessThread::Create("ProcessThread"));
+    process_module_ = webrtc::ProcessThread::Create("ProcessThread");
     process_module_->Start();
     process_module_->RegisterModule(capture_module_);
 
diff --git a/webrtc/voice_engine/shared_data.cc b/webrtc/voice_engine/shared_data.cc
index 997f51b..7a67561 100644
--- a/webrtc/voice_engine/shared_data.cc
+++ b/webrtc/voice_engine/shared_data.cc
@@ -28,7 +28,7 @@
       _engineStatistics(_gInstanceCounter),
       _audioDevicePtr(NULL),
       _moduleProcessThreadPtr(
-          rtc::ScopedToUnique(ProcessThread::Create("VoiceProcessThread"))) {
+          ProcessThread::Create("VoiceProcessThread")) {
     Trace::CreateTrace();
     if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0)
     {