Convert //remoting to use std::unique_ptr

BUG=554298
[email protected],[email protected]

Review URL: https://codereview.chromium.org/1864213002

Cr-Commit-Position: refs/heads/master@{#385571}
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc
index ba0d322b..2065c8b 100644
--- a/remoting/protocol/video_frame_pump.cc
+++ b/remoting/protocol/video_frame_pump.cc
@@ -5,12 +5,13 @@
 #include "remoting/protocol/video_frame_pump.h"
 
 #include <algorithm>
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/task_runner_util.h"
 #include "base/time/time.h"
@@ -35,8 +36,8 @@
 VideoFramePump::FrameTimestamps::~FrameTimestamps() {}
 
 VideoFramePump::PacketWithTimestamps::PacketWithTimestamps(
-    scoped_ptr<VideoPacket> packet,
-    scoped_ptr<FrameTimestamps> timestamps)
+    std::unique_ptr<VideoPacket> packet,
+    std::unique_ptr<FrameTimestamps> timestamps)
     : packet(std::move(packet)), timestamps(std::move(timestamps)) {}
 
 VideoFramePump::PacketWithTimestamps::~PacketWithTimestamps() {}
@@ -48,8 +49,8 @@
 
 VideoFramePump::VideoFramePump(
     scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
-    scoped_ptr<webrtc::DesktopCapturer> capturer,
-    scoped_ptr<VideoEncoder> encoder,
+    std::unique_ptr<webrtc::DesktopCapturer> capturer,
+    std::unique_ptr<VideoEncoder> encoder,
     protocol::VideoStub* video_stub)
     : encode_task_runner_(encode_task_runner),
       capturer_(std::move(capturer)),
@@ -141,7 +142,7 @@
   base::PostTaskAndReplyWithResult(
       encode_task_runner_.get(), FROM_HERE,
       base::Bind(&VideoFramePump::EncodeFrame, encoder_.get(),
-                 base::Passed(make_scoped_ptr(frame)),
+                 base::Passed(base::WrapUnique(frame)),
                  base::Passed(&captured_frame_timestamps_)),
       base::Bind(&VideoFramePump::OnFrameEncoded, weak_factory_.GetWeakPtr()));
 }
@@ -162,13 +163,13 @@
 }
 
 // static
-scoped_ptr<VideoFramePump::PacketWithTimestamps> VideoFramePump::EncodeFrame(
-    VideoEncoder* encoder,
-    scoped_ptr<webrtc::DesktopFrame> frame,
-    scoped_ptr<FrameTimestamps> timestamps) {
+std::unique_ptr<VideoFramePump::PacketWithTimestamps>
+VideoFramePump::EncodeFrame(VideoEncoder* encoder,
+                            std::unique_ptr<webrtc::DesktopFrame> frame,
+                            std::unique_ptr<FrameTimestamps> timestamps) {
   timestamps->encode_started_time = base::TimeTicks::Now();
 
-  scoped_ptr<VideoPacket> packet;
+  std::unique_ptr<VideoPacket> packet;
   // If |frame| is non-NULL then let the encoder process it.
   if (frame)
     packet = encoder->Encode(*frame);
@@ -186,11 +187,12 @@
       (timestamps->encode_ended_time - timestamps->encode_started_time)
           .InMilliseconds());
 
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new PacketWithTimestamps(std::move(packet), std::move(timestamps)));
 }
 
-void VideoFramePump::OnFrameEncoded(scoped_ptr<PacketWithTimestamps> packet) {
+void VideoFramePump::OnFrameEncoded(
+    std::unique_ptr<PacketWithTimestamps> packet) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   capture_scheduler_.OnFrameEncoded(packet->packet.get());
@@ -202,7 +204,7 @@
   }
 }
 
-void VideoFramePump::SendPacket(scoped_ptr<PacketWithTimestamps> packet) {
+void VideoFramePump::SendPacket(std::unique_ptr<PacketWithTimestamps> packet) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(!send_pending_);
 
@@ -252,7 +254,7 @@
 
   // Send next packet if any.
   if (!pending_packets_.empty()) {
-    scoped_ptr<PacketWithTimestamps> next(pending_packets_.front());
+    std::unique_ptr<PacketWithTimestamps> next(pending_packets_.front());
     pending_packets_.weak_erase(pending_packets_.begin());
     SendPacket(std::move(next));
   }
@@ -262,7 +264,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
 
   video_stub_->ProcessVideoPacket(
-      make_scoped_ptr(new VideoPacket()),
+      base::WrapUnique(new VideoPacket()),
       base::Bind(&VideoFramePump::OnKeepAlivePacketSent,
                  weak_factory_.GetWeakPtr()));
 }