EDK: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk/system.

Now only //mojo/edk/embedder remains.

R=vardhan@google.com

Review URL: https://codereview.chromium.org/1353683005 .
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc
index 8c184af..e70ca21 100644
--- a/mojo/edk/system/channel.cc
+++ b/mojo/edk/system/channel.cc
@@ -125,7 +125,7 @@
   endpoint->AttachAndRun(this, local_id, remote_id);
 }
 
-bool Channel::WriteMessage(scoped_ptr<MessageInTransit> message) {
+bool Channel::WriteMessage(std::unique_ptr<MessageInTransit> message) {
   MutexLocker locker(&mutex_);
   if (!is_running_) {
     // TODO(vtl): I think this is probably not an error condition, but I should
@@ -135,7 +135,7 @@
   }
 
   DLOG_IF(WARNING, is_shutting_down_) << "WriteMessage() while shutting down";
-  return raw_channel_->WriteMessage(message.Pass());
+  return raw_channel_->WriteMessage(std::move(message));
 }
 
 bool Channel::IsWriteBufferEmpty() {
@@ -391,7 +391,7 @@
     return;
   }
 
-  scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view));
+  std::unique_ptr<MessageInTransit> message(new MessageInTransit(message_view));
   if (message_view.transport_data_buffer_size() > 0) {
     DCHECK(message_view.transport_data_buffer());
     message->SetDispatchers(TransportData::DeserializeDispatchers(
@@ -400,7 +400,7 @@
         this));
   }
 
-  endpoint->OnReadMessage(message.Pass());
+  endpoint->OnReadMessage(std::move(message));
 }
 
 void Channel::OnReadMessageForChannel(
@@ -624,11 +624,11 @@
                                  const void* bytes) {
   DVLOG(2) << "Sending channel control message: subtype " << subtype
            << ", local ID " << local_id << ", remote ID " << remote_id;
-  scoped_ptr<MessageInTransit> message(new MessageInTransit(
+  std::unique_ptr<MessageInTransit> message(new MessageInTransit(
       MessageInTransit::Type::CHANNEL, subtype, num_bytes, bytes));
   message->set_source_id(local_id);
   message->set_destination_id(remote_id);
-  return WriteMessage(message.Pass());
+  return WriteMessage(std::move(message));
 }
 
 }  // namespace system
diff --git a/mojo/edk/system/channel.h b/mojo/edk/system/channel.h
index 5e55a93..ef8b8aa 100644
--- a/mojo/edk/system/channel.h
+++ b/mojo/edk/system/channel.h
@@ -11,7 +11,6 @@
 
 #include "base/containers/hash_tables.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/system/channel_endpoint.h"
@@ -101,7 +100,7 @@
                                    ChannelEndpointId remote_id);
 
   // This forwards |message| verbatim to |raw_channel_|.
-  bool WriteMessage(scoped_ptr<MessageInTransit> message);
+  bool WriteMessage(std::unique_ptr<MessageInTransit> message);
 
   // See |RawChannel::IsWriteBufferEmpty()|.
   // TODO(vtl): Maybe we shouldn't expose this, and instead have a
diff --git a/mojo/edk/system/channel_endpoint.cc b/mojo/edk/system/channel_endpoint.cc
index e7e17b4..73f3c7a 100644
--- a/mojo/edk/system/channel_endpoint.cc
+++ b/mojo/edk/system/channel_endpoint.cc
@@ -4,6 +4,8 @@
 
 #include "mojo/edk/system/channel_endpoint.h"
 
+#include <utility>
+
 #include "base/logging.h"
 #include "base/threading/platform_thread.h"
 #include "mojo/edk/system/channel.h"
@@ -26,17 +28,18 @@
     channel_message_queue_.Swap(message_queue);
 }
 
-bool ChannelEndpoint::EnqueueMessage(scoped_ptr<MessageInTransit> message) {
+bool ChannelEndpoint::EnqueueMessage(
+    std::unique_ptr<MessageInTransit> message) {
   DCHECK(message);
 
   MutexLocker locker(&mutex_);
 
   switch (state_) {
     case State::PAUSED:
-      channel_message_queue_.AddMessage(message.Pass());
+      channel_message_queue_.AddMessage(std::move(message));
       return true;
     case State::RUNNING:
-      return WriteMessageNoLock(message.Pass());
+      return WriteMessageNoLock(std::move(message));
     case State::DEAD:
       return false;
   }
@@ -96,9 +99,9 @@
   }
 }
 
-void ChannelEndpoint::OnReadMessage(scoped_ptr<MessageInTransit> message) {
+void ChannelEndpoint::OnReadMessage(std::unique_ptr<MessageInTransit> message) {
   if (message->type() == MessageInTransit::Type::ENDPOINT_CLIENT) {
-    OnReadMessageForClient(message.Pass());
+    OnReadMessageForClient(std::move(message));
     return;
   }
 
@@ -148,7 +151,8 @@
   DCHECK(!remote_id_.is_valid());
 }
 
-bool ChannelEndpoint::WriteMessageNoLock(scoped_ptr<MessageInTransit> message) {
+bool ChannelEndpoint::WriteMessageNoLock(
+    std::unique_ptr<MessageInTransit> message) {
   DCHECK(message);
 
   mutex_.AssertHeld();
@@ -160,11 +164,11 @@
   message->SerializeAndCloseDispatchers(channel_);
   message->set_source_id(local_id_);
   message->set_destination_id(remote_id_);
-  return channel_->WriteMessage(message.Pass());
+  return channel_->WriteMessage(std::move(message));
 }
 
 void ChannelEndpoint::OnReadMessageForClient(
-    scoped_ptr<MessageInTransit> message) {
+    std::unique_ptr<MessageInTransit> message) {
   DCHECK_EQ(message->type(), MessageInTransit::Type::ENDPOINT_CLIENT);
 
   scoped_refptr<ChannelEndpointClient> client;
diff --git a/mojo/edk/system/channel_endpoint.h b/mojo/edk/system/channel_endpoint.h
index 3ebe386..f8710c2 100644
--- a/mojo/edk/system/channel_endpoint.h
+++ b/mojo/edk/system/channel_endpoint.h
@@ -5,8 +5,9 @@
 #ifndef MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_
 #define MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/channel_endpoint_id.h"
 #include "mojo/edk/system/message_in_transit_queue.h"
 #include "mojo/edk/system/mutex.h"
@@ -128,7 +129,7 @@
   // Called to enqueue an outbound message. (If |AttachAndRun()| has not yet
   // been called, the message will be enqueued and sent when |AttachAndRun()| is
   // called.)
-  bool EnqueueMessage(scoped_ptr<MessageInTransit> message);
+  bool EnqueueMessage(std::unique_ptr<MessageInTransit> message);
 
   // Called to *replace* current client with a new client (which must differ
   // from the existing client). This must not be called after
@@ -153,7 +154,7 @@
                     ChannelEndpointId remote_id);
 
   // Called when the |Channel| receives a message for the |ChannelEndpoint|.
-  void OnReadMessage(scoped_ptr<MessageInTransit> message);
+  void OnReadMessage(std::unique_ptr<MessageInTransit> message);
 
   // Called before the |Channel| gives up its reference to this object.
   void DetachFromChannel();
@@ -162,11 +163,11 @@
   friend class base::RefCountedThreadSafe<ChannelEndpoint>;
   ~ChannelEndpoint();
 
-  bool WriteMessageNoLock(scoped_ptr<MessageInTransit> message)
+  bool WriteMessageNoLock(std::unique_ptr<MessageInTransit> message)
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
 
   // Helper for |OnReadMessage()|, handling messages for the client.
-  void OnReadMessageForClient(scoped_ptr<MessageInTransit> message);
+  void OnReadMessageForClient(std::unique_ptr<MessageInTransit> message);
 
   // Moves |state_| from |RUNNING| to |DEAD|. |channel_| must be non-null, but
   // this does not call |channel_->DetachEndpoint()|.
diff --git a/mojo/edk/system/channel_endpoint_client.h b/mojo/edk/system/channel_endpoint_client.h
index 98f6761..7692119 100644
--- a/mojo/edk/system/channel_endpoint_client.h
+++ b/mojo/edk/system/channel_endpoint_client.h
@@ -6,7 +6,6 @@
 #define MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_CLIENT_H_
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/system_impl_export.h"
 #include "mojo/public/cpp/system/macros.h"
 
diff --git a/mojo/edk/system/channel_endpoint_unittest.cc b/mojo/edk/system/channel_endpoint_unittest.cc
index e0bf9f1..6a78307 100644
--- a/mojo/edk/system/channel_endpoint_unittest.cc
+++ b/mojo/edk/system/channel_endpoint_unittest.cc
@@ -4,6 +4,9 @@
 
 #include "mojo/edk/system/channel_endpoint.h"
 
+#include <memory>
+#include <utility>
+
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_timeouts.h"
 #include "mojo/edk/system/channel_test_base.h"
@@ -64,7 +67,8 @@
 
   // Make a test message.
   unsigned message_id = 0x12345678;
-  scoped_ptr<MessageInTransit> send_message = test::MakeTestMessage(message_id);
+  std::unique_ptr<MessageInTransit> send_message =
+      test::MakeTestMessage(message_id);
   // Check that our test utility works (at least in one direction).
   test::VerifyTestMessage(send_message.get(), message_id);
 
@@ -72,7 +76,7 @@
   EXPECT_FALSE(read_event.IsSignaled());
 
   // Send it through channel/endpoint 1.
-  EXPECT_TRUE(endpoint1->EnqueueMessage(send_message.Pass()));
+  EXPECT_TRUE(endpoint1->EnqueueMessage(std::move(send_message)));
 
   // Wait to receive it.
   EXPECT_TRUE(read_event.TimedWait(TestTimeouts::tiny_timeout()));
@@ -80,7 +84,7 @@
 
   // Check the received message.
   ASSERT_EQ(1u, client0->NumMessages());
-  scoped_ptr<MessageInTransit> read_message = client0->PopMessage();
+  std::unique_ptr<MessageInTransit> read_message = client0->PopMessage();
   ASSERT_TRUE(read_message);
   test::VerifyTestMessage(read_message.get(), message_id);
 }
@@ -126,7 +130,7 @@
   // Check the received messages.
   ASSERT_EQ(6u, client0->NumMessages());
   for (unsigned message_id = 1; message_id <= 6; message_id++) {
-    scoped_ptr<MessageInTransit> read_message = client0->PopMessage();
+    std::unique_ptr<MessageInTransit> read_message = client0->PopMessage();
     ASSERT_TRUE(read_message);
     test::VerifyTestMessage(read_message.get(), message_id);
   }
diff --git a/mojo/edk/system/core.h b/mojo/edk/system/core.h
index 4ed5ede..bfa58ba 100644
--- a/mojo/edk/system/core.h
+++ b/mojo/edk/system/core.h
@@ -9,7 +9,6 @@
 
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/handle_table.h"
 #include "mojo/edk/system/mapping_table.h"
 #include "mojo/edk/system/memory.h"
diff --git a/mojo/edk/system/data_pipe_impl.cc b/mojo/edk/system/data_pipe_impl.cc
index 6c19297..91ddb02 100644
--- a/mojo/edk/system/data_pipe_impl.cc
+++ b/mojo/edk/system/data_pipe_impl.cc
@@ -5,9 +5,10 @@
 #include "mojo/edk/system/data_pipe_impl.h"
 
 #include <algorithm>
+#include <memory>
+#include <utility>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/configuration.h"
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/message_in_transit_queue.h"
@@ -34,11 +35,11 @@
         std::min(max_message_num_bytes, current_contiguous_num_bytes);
 
     // Note: |message_num_bytes| fits in a |uint32_t| since the capacity does.
-    scoped_ptr<MessageInTransit> message(new MessageInTransit(
+    std::unique_ptr<MessageInTransit> message(new MessageInTransit(
         MessageInTransit::Type::ENDPOINT_CLIENT,
         MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
         static_cast<uint32_t>(message_num_bytes), buffer + *start_index));
-    message_queue->AddMessage(message.Pass());
+    message_queue->AddMessage(std::move(message));
 
     DCHECK_LE(message_num_bytes, *current_num_bytes);
     *start_index += message_num_bytes;
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h
index 200b0ec..4a85915 100644
--- a/mojo/edk/system/dispatcher.h
+++ b/mojo/edk/system/dispatcher.h
@@ -13,7 +13,6 @@
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/system/handle_signals_state.h"
 #include "mojo/edk/system/memory.h"
diff --git a/mojo/edk/system/endpoint_relayer.cc b/mojo/edk/system/endpoint_relayer.cc
index 9017651..5634db0 100644
--- a/mojo/edk/system/endpoint_relayer.cc
+++ b/mojo/edk/system/endpoint_relayer.cc
@@ -55,8 +55,10 @@
   }
 
   // Otherwise, consume it even if the peer port is closed.
-  if (endpoints_[peer_port])
-    endpoints_[peer_port]->EnqueueMessage(make_scoped_ptr(message));
+  if (endpoints_[peer_port]) {
+    endpoints_[peer_port]->EnqueueMessage(
+        std::unique_ptr<MessageInTransit>(message));
+  }
   return true;
 }
 
diff --git a/mojo/edk/system/endpoint_relayer_unittest.cc b/mojo/edk/system/endpoint_relayer_unittest.cc
index 36711a9..276bfee 100644
--- a/mojo/edk/system/endpoint_relayer_unittest.cc
+++ b/mojo/edk/system/endpoint_relayer_unittest.cc
@@ -99,7 +99,7 @@
   client1b()->SetReadEvent(nullptr);
 
   ASSERT_EQ(1u, client1b()->NumMessages());
-  scoped_ptr<MessageInTransit> read_message = client1b()->PopMessage();
+  std::unique_ptr<MessageInTransit> read_message = client1b()->PopMessage();
   ASSERT_TRUE(read_message);
   test::VerifyTestMessage(read_message.get(), 12345);
 
@@ -137,7 +137,7 @@
   // Check the received messages.
   ASSERT_EQ(5u, client1b()->NumMessages());
   for (unsigned message_id = 1; message_id <= 5; message_id++) {
-    scoped_ptr<MessageInTransit> read_message = client1b()->PopMessage();
+    std::unique_ptr<MessageInTransit> read_message = client1b()->PopMessage();
     ASSERT_TRUE(read_message);
     test::VerifyTestMessage(read_message.get(), message_id);
   }
@@ -170,7 +170,8 @@
 
     unsigned id = 0;
     if (test::IsTestMessage(message, &id) && id >= 1000) {
-      filtered_messages_->AddMessage(make_scoped_ptr(message));
+      filtered_messages_->AddMessage(
+          std::unique_ptr<MessageInTransit>(message));
       return true;
     }
 
@@ -207,7 +208,7 @@
   // Check the received messages: We should get "1"-"5".
   ASSERT_EQ(5u, client1b()->NumMessages());
   for (unsigned message_id = 1; message_id <= 5; message_id++) {
-    scoped_ptr<MessageInTransit> read_message = client1b()->PopMessage();
+    std::unique_ptr<MessageInTransit> read_message = client1b()->PopMessage();
     ASSERT_TRUE(read_message);
     test::VerifyTestMessage(read_message.get(), message_id);
   }
@@ -219,7 +220,7 @@
   // the latter must have also been "received"/filtered.
   ASSERT_EQ(3u, filtered_messages.Size());
   for (unsigned message_id = 1001; message_id <= 1003; message_id++) {
-    scoped_ptr<MessageInTransit> message = filtered_messages.GetMessage();
+    std::unique_ptr<MessageInTransit> message = filtered_messages.GetMessage();
     ASSERT_TRUE(message);
     test::VerifyTestMessage(message.get(), message_id);
   }
diff --git a/mojo/edk/system/incoming_endpoint.cc b/mojo/edk/system/incoming_endpoint.cc
index eaa1825..d92cf49 100644
--- a/mojo/edk/system/incoming_endpoint.cc
+++ b/mojo/edk/system/incoming_endpoint.cc
@@ -67,7 +67,7 @@
   if (!endpoint_)
     return false;
 
-  message_queue_.AddMessage(make_scoped_ptr(message));
+  message_queue_.AddMessage(std::unique_ptr<MessageInTransit>(message));
   return true;
 }
 
diff --git a/mojo/edk/system/local_message_pipe_endpoint.cc b/mojo/edk/system/local_message_pipe_endpoint.cc
index 1800aa4..43d11e1 100644
--- a/mojo/edk/system/local_message_pipe_endpoint.cc
+++ b/mojo/edk/system/local_message_pipe_endpoint.cc
@@ -6,6 +6,8 @@
 
 #include <string.h>
 
+#include <utility>
+
 #include "base/logging.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/message_in_transit.h"
@@ -44,12 +46,12 @@
 }
 
 void LocalMessagePipeEndpoint::EnqueueMessage(
-    scoped_ptr<MessageInTransit> message) {
+    std::unique_ptr<MessageInTransit> message) {
   DCHECK(is_open_);
   DCHECK(is_peer_open_);
 
   bool was_empty = message_queue_.IsEmpty();
-  message_queue_.AddMessage(message.Pass());
+  message_queue_.AddMessage(std::move(message));
   if (was_empty)
     awakable_list_.AwakeForStateChange(GetHandleSignalsState());
 }
diff --git a/mojo/edk/system/local_message_pipe_endpoint.h b/mojo/edk/system/local_message_pipe_endpoint.h
index 0f06847..879aa77 100644
--- a/mojo/edk/system/local_message_pipe_endpoint.h
+++ b/mojo/edk/system/local_message_pipe_endpoint.h
@@ -27,7 +27,7 @@
   // |MessagePipeEndpoint| implementation:
   Type GetType() const override;
   bool OnPeerClose() override;
-  void EnqueueMessage(scoped_ptr<MessageInTransit> message) override;
+  void EnqueueMessage(std::unique_ptr<MessageInTransit> message) override;
 
   // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to
   // implement/override these:
diff --git a/mojo/edk/system/master_connection_manager.cc b/mojo/edk/system/master_connection_manager.cc
index c517a5f..f9d3ac2 100644
--- a/mojo/edk/system/master_connection_manager.cc
+++ b/mojo/edk/system/master_connection_manager.cc
@@ -5,6 +5,7 @@
 #include "mojo/edk/system/master_connection_manager.h"
 
 #include <memory>
+#include <utility>
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
@@ -184,7 +185,7 @@
       return;
   }
 
-  scoped_ptr<MessageInTransit> response(new MessageInTransit(
+  std::unique_ptr<MessageInTransit> response(new MessageInTransit(
       MessageInTransit::Type::CONNECTION_MANAGER_ACK,
       ConnectionManagerResultToMessageInTransitSubtype(result), num_bytes,
       bytes));
@@ -203,7 +204,7 @@
     DCHECK(!platform_handle.is_valid());
   }
 
-  if (!raw_channel_->WriteMessage(response.Pass())) {
+  if (!raw_channel_->WriteMessage(std::move(response))) {
     LOG(ERROR) << "WriteMessage failed";
     FatalError();  // WARNING: This destroys us.
     return;
diff --git a/mojo/edk/system/message_in_transit_queue.h b/mojo/edk/system/message_in_transit_queue.h
index f7464bd..e231477 100644
--- a/mojo/edk/system/message_in_transit_queue.h
+++ b/mojo/edk/system/message_in_transit_queue.h
@@ -6,8 +6,8 @@
 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
 
 #include <deque>
+#include <memory>
 
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/system_impl_export.h"
 #include "mojo/public/cpp/system/macros.h"
@@ -25,14 +25,14 @@
   bool IsEmpty() const { return queue_.empty(); }
   size_t Size() const { return queue_.size(); }
 
-  void AddMessage(scoped_ptr<MessageInTransit> message) {
+  void AddMessage(std::unique_ptr<MessageInTransit> message) {
     queue_.push_back(message.release());
   }
 
-  scoped_ptr<MessageInTransit> GetMessage() {
+  std::unique_ptr<MessageInTransit> GetMessage() {
     MessageInTransit* rv = queue_.front();
     queue_.pop_front();
-    return make_scoped_ptr(rv);
+    return std::unique_ptr<MessageInTransit>(rv);
   }
 
   const MessageInTransit* PeekMessage() const { return queue_.front(); }
@@ -50,7 +50,7 @@
 
  private:
   // TODO(vtl): When C++11 is available, switch this to a deque of
-  // |scoped_ptr|/|unique_ptr|s.
+  // |unique_ptr|s.
   std::deque<MessageInTransit*> queue_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(MessageInTransitQueue);
diff --git a/mojo/edk/system/message_in_transit_test_utils.cc b/mojo/edk/system/message_in_transit_test_utils.cc
index 0d7cc24..7578c2b 100644
--- a/mojo/edk/system/message_in_transit_test_utils.cc
+++ b/mojo/edk/system/message_in_transit_test_utils.cc
@@ -4,17 +4,18 @@
 
 #include "mojo/edk/system/message_in_transit_test_utils.h"
 
+#include "mojo/edk/util/make_unique.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojo {
 namespace system {
 namespace test {
 
-scoped_ptr<MessageInTransit> MakeTestMessage(unsigned id) {
-  return make_scoped_ptr(
-      new MessageInTransit(MessageInTransit::Type::ENDPOINT_CLIENT,
-                           MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
-                           static_cast<uint32_t>(sizeof(id)), &id));
+std::unique_ptr<MessageInTransit> MakeTestMessage(unsigned id) {
+  return util::MakeUnique<MessageInTransit>(
+      MessageInTransit::Type::ENDPOINT_CLIENT,
+      MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
+      static_cast<uint32_t>(sizeof(id)), &id);
 }
 
 void VerifyTestMessage(const MessageInTransit* message, unsigned id) {
diff --git a/mojo/edk/system/message_in_transit_test_utils.h b/mojo/edk/system/message_in_transit_test_utils.h
index 2837838..ce971bb 100644
--- a/mojo/edk/system/message_in_transit_test_utils.h
+++ b/mojo/edk/system/message_in_transit_test_utils.h
@@ -5,7 +5,8 @@
 #ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_TEST_UTILS_H_
 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_TEST_UTILS_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "mojo/edk/system/message_in_transit.h"
 
 namespace mojo {
@@ -17,7 +18,7 @@
 // |MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA|, and contain data
 // associated with |id| (so that test messages with different |id|s are
 // distinguishable).
-scoped_ptr<MessageInTransit> MakeTestMessage(unsigned id);
+std::unique_ptr<MessageInTransit> MakeTestMessage(unsigned id);
 
 // Verifies a test message: ASSERTs that |message| is non-null, and EXPECTs that
 // it looks like a message created using |MakeTestMessage(id)| (see above).
diff --git a/mojo/edk/system/message_pipe.cc b/mojo/edk/system/message_pipe.cc
index 0f15698..c89e240 100644
--- a/mojo/edk/system/message_pipe.cc
+++ b/mojo/edk/system/message_pipe.cc
@@ -5,6 +5,7 @@
 #include "mojo/edk/system/message_pipe.h"
 
 #include <memory>
+#include <utility>
 
 #include "base/logging.h"
 #include "mojo/edk/system/channel.h"
@@ -16,6 +17,7 @@
 #include "mojo/edk/system/message_pipe_dispatcher.h"
 #include "mojo/edk/system/message_pipe_endpoint.h"
 #include "mojo/edk/system/proxy_message_pipe_endpoint.h"
+#include "mojo/edk/util/make_unique.h"
 
 namespace mojo {
 namespace system {
@@ -155,9 +157,9 @@
   MutexLocker locker(&mutex_);
   return EnqueueMessageNoLock(
       GetPeerPort(port),
-      make_scoped_ptr(new MessageInTransit(
+      util::MakeUnique<MessageInTransit>(
           MessageInTransit::Type::ENDPOINT_CLIENT,
-          MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA, num_bytes, bytes)),
+          MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA, num_bytes, bytes),
       transports);
 }
 
@@ -293,8 +295,8 @@
   // |ProxyMessagePipeEndpoint| |port| receives a message (from the |Channel|).
   // We need to pass this message on to its peer port (typically a
   // |LocalMessagePipeEndpoint|).
-  MojoResult result = EnqueueMessageNoLock(GetPeerPort(port),
-                                           make_scoped_ptr(message), nullptr);
+  MojoResult result = EnqueueMessageNoLock(
+      GetPeerPort(port), std::unique_ptr<MessageInTransit>(message), nullptr);
   DLOG_IF(WARNING, result != MOJO_RESULT_OK)
       << "EnqueueMessageNoLock() failed (result  = " << result << ")";
   return true;
@@ -317,7 +319,7 @@
 
 MojoResult MessagePipe::EnqueueMessageNoLock(
     unsigned port,
-    scoped_ptr<MessageInTransit> message,
+    std::unique_ptr<MessageInTransit> message,
     std::vector<DispatcherTransport>* transports) {
   DCHECK(port == 0 || port == 1);
   DCHECK(message);
@@ -336,7 +338,7 @@
   }
 
   // The endpoint's |EnqueueMessage()| may not report failure.
-  endpoints_[port]->EnqueueMessage(message.Pass());
+  endpoints_[port]->EnqueueMessage(std::move(message));
   return MOJO_RESULT_OK;
 }
 
diff --git a/mojo/edk/system/message_pipe.h b/mojo/edk/system/message_pipe.h
index e780120..3cb3af2 100644
--- a/mojo/edk/system/message_pipe.h
+++ b/mojo/edk/system/message_pipe.h
@@ -8,10 +8,10 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/system/channel_endpoint_client.h"
 #include "mojo/edk/system/dispatcher.h"
@@ -127,7 +127,7 @@
   // |transports| may be non-null only if it's nonempty and |message| has no
   // dispatchers attached. Must be called with |lock_| held.
   MojoResult EnqueueMessageNoLock(unsigned port,
-                                  scoped_ptr<MessageInTransit> message,
+                                  std::unique_ptr<MessageInTransit> message,
                                   std::vector<DispatcherTransport>* transports)
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
 
@@ -139,7 +139,7 @@
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
 
   mutable Mutex mutex_;
-  scoped_ptr<MessagePipeEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_);
+  std::unique_ptr<MessagePipeEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_);
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipe);
 };
diff --git a/mojo/edk/system/message_pipe_endpoint.h b/mojo/edk/system/message_pipe_endpoint.h
index 73d9a92..c6b944c 100644
--- a/mojo/edk/system/message_pipe_endpoint.h
+++ b/mojo/edk/system/message_pipe_endpoint.h
@@ -7,10 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/memory.h"
 #include "mojo/edk/system/message_in_transit.h"
@@ -47,7 +47,7 @@
   //  a) Dispatchers have been vetted and cloned/attached to the message.
   //  b) At this point, we cannot report failure (if, e.g., a channel is torn
   //     down at this point, we should silently swallow the message).
-  virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) = 0;
+  virtual void EnqueueMessage(std::unique_ptr<MessageInTransit> message) = 0;
   virtual void Close() = 0;
 
   // Implementations must override these if they represent a local endpoint,
diff --git a/mojo/edk/system/proxy_message_pipe_endpoint.cc b/mojo/edk/system/proxy_message_pipe_endpoint.cc
index ce96f24..951fb29 100644
--- a/mojo/edk/system/proxy_message_pipe_endpoint.cc
+++ b/mojo/edk/system/proxy_message_pipe_endpoint.cc
@@ -6,6 +6,8 @@
 
 #include <string.h>
 
+#include <utility>
+
 #include "base/logging.h"
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/local_message_pipe_endpoint.h"
@@ -44,9 +46,9 @@
 // -- it may have been written to and closed immediately, before we were ready.
 // This case is handled in |Run()| (which will call us).
 void ProxyMessagePipeEndpoint::EnqueueMessage(
-    scoped_ptr<MessageInTransit> message) {
+    std::unique_ptr<MessageInTransit> message) {
   DCHECK(channel_endpoint_);
-  bool ok = channel_endpoint_->EnqueueMessage(message.Pass());
+  bool ok = channel_endpoint_->EnqueueMessage(std::move(message));
   LOG_IF(WARNING, !ok) << "Failed to write enqueue message to channel";
 }
 
diff --git a/mojo/edk/system/proxy_message_pipe_endpoint.h b/mojo/edk/system/proxy_message_pipe_endpoint.h
index 385379b..c61fdb2 100644
--- a/mojo/edk/system/proxy_message_pipe_endpoint.h
+++ b/mojo/edk/system/proxy_message_pipe_endpoint.h
@@ -44,7 +44,7 @@
   // |MessagePipeEndpoint| implementation:
   Type GetType() const override;
   bool OnPeerClose() override;
-  void EnqueueMessage(scoped_ptr<MessageInTransit> message) override;
+  void EnqueueMessage(std::unique_ptr<MessageInTransit> message) override;
   void Close() override;
 
  private:
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
index 0f89bc3..f5b9bd6 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -222,7 +222,7 @@
 }
 
 // Reminder: This must be thread-safe.
-bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
+bool RawChannel::WriteMessage(std::unique_ptr<MessageInTransit> message) {
   DCHECK(message);
 
   MutexLocker locker(&write_mutex_);
@@ -230,11 +230,11 @@
     return false;
 
   if (!write_buffer_->message_queue_.IsEmpty()) {
-    EnqueueMessageNoLock(message.Pass());
+    EnqueueMessageNoLock(std::move(message));
     return true;
   }
 
-  EnqueueMessageNoLock(message.Pass());
+  EnqueueMessageNoLock(std::move(message));
   DCHECK_EQ(write_buffer_->data_offset_, 0u);
 
   size_t platform_handles_written = 0;
@@ -431,9 +431,10 @@
   }
 }
 
-void RawChannel::EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) {
+void RawChannel::EnqueueMessageNoLock(
+    std::unique_ptr<MessageInTransit> message) {
   write_mutex_.AssertHeld();
-  write_buffer_->message_queue_.AddMessage(message.Pass());
+  write_buffer_->message_queue_.AddMessage(std::move(message));
 }
 
 bool RawChannel::OnReadMessageForRawChannel(
diff --git a/mojo/edk/system/raw_channel.h b/mojo/edk/system/raw_channel.h
index 0d5b671..cc66fcb 100644
--- a/mojo/edk/system/raw_channel.h
+++ b/mojo/edk/system/raw_channel.h
@@ -8,7 +8,6 @@
 #include <memory>
 #include <vector>
 
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
@@ -102,7 +101,7 @@
   // have no |Dispatcher|s still attached (i.e.,
   // |SerializeAndCloseDispatchers()| should have been called). This method is
   // thread-safe and may be called from any thread. Returns true on success.
-  bool WriteMessage(scoped_ptr<MessageInTransit> message);
+  bool WriteMessage(std::unique_ptr<MessageInTransit> message);
 
   // Returns true if the write buffer is empty (i.e., all messages written using
   // |WriteMessage()| have actually been sent.
@@ -226,7 +225,7 @@
   // Adds |message| to the write message queue. Implementation subclasses may
   // override this to add any additional "control" messages needed. This is
   // called (on any thread).
-  virtual void EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message)
+  virtual void EnqueueMessageNoLock(std::unique_ptr<MessageInTransit> message)
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(write_mutex_);
 
   // Handles any control messages targeted to the |RawChannel| (or
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
index 4285c13..a7fa16e 100644
--- a/mojo/edk/system/raw_channel_posix.cc
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -11,6 +11,7 @@
 #include <algorithm>
 #include <deque>
 #include <memory>
+#include <utility>
 
 #include "base/bind.h"
 #include "base/location.h"
@@ -42,7 +43,7 @@
   // |RawChannel| protected methods:
   // Actually override this so that we can send multiple messages with (only)
   // FDs if necessary.
-  void EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) override
+  void EnqueueMessageNoLock(std::unique_ptr<MessageInTransit> message) override
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(write_mutex());
   // Override this to handle those extra FD-only messages.
   bool OnReadMessageForRawChannel(
@@ -119,7 +120,7 @@
 }
 
 void RawChannelPosix::EnqueueMessageNoLock(
-    scoped_ptr<MessageInTransit> message) {
+    std::unique_ptr<MessageInTransit> message) {
   if (message->transport_data()) {
     embedder::PlatformHandleVector* const platform_handles =
         message->transport_data()->platform_handles();
@@ -132,7 +133,7 @@
       for (; platform_handles->size() - i >
                  embedder::kPlatformChannelMaxNumHandles;
            i += embedder::kPlatformChannelMaxNumHandles) {
-        scoped_ptr<MessageInTransit> fd_message(new MessageInTransit(
+        std::unique_ptr<MessageInTransit> fd_message(new MessageInTransit(
             MessageInTransit::Type::RAW_CHANNEL,
             MessageInTransit::Subtype::RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES,
             0, nullptr));
@@ -143,7 +144,7 @@
                     embedder::kPlatformChannelMaxNumHandles));
         fd_message->SetTransportData(util::MakeUnique<TransportData>(
             fds.Pass(), GetSerializedPlatformHandleSize()));
-        RawChannel::EnqueueMessageNoLock(fd_message.Pass());
+        RawChannel::EnqueueMessageNoLock(std::move(fd_message));
       }
 
       // Remove the handles that we "moved" into the other messages.
@@ -152,7 +153,7 @@
     }
   }
 
-  RawChannel::EnqueueMessageNoLock(message.Pass());
+  RawChannel::EnqueueMessageNoLock(std::move(message));
 }
 
 bool RawChannelPosix::OnReadMessageForRawChannel(
diff --git a/mojo/edk/system/raw_channel_unittest.cc b/mojo/edk/system/raw_channel_unittest.cc
index b576f53..3a5160b 100644
--- a/mojo/edk/system/raw_channel_unittest.cc
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -7,12 +7,13 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <memory>
+#include <utility>
 #include <vector>
 
 #include "base/bind.h"
 #include "base/location.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/simple_thread.h"
@@ -35,14 +36,14 @@
 namespace system {
 namespace {
 
-scoped_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
+std::unique_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
   std::vector<unsigned char> bytes(num_bytes, 0);
   for (size_t i = 0; i < num_bytes; i++)
     bytes[i] = static_cast<unsigned char>(i + num_bytes);
-  return make_scoped_ptr(
-      new MessageInTransit(MessageInTransit::Type::ENDPOINT_CLIENT,
-                           MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
-                           num_bytes, bytes.empty() ? nullptr : &bytes[0]));
+  return util::MakeUnique<MessageInTransit>(
+      MessageInTransit::Type::ENDPOINT_CLIENT,
+      MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA, num_bytes,
+      bytes.empty() ? nullptr : &bytes[0]);
 }
 
 bool CheckMessageData(const void* bytes, uint32_t num_bytes) {
@@ -60,7 +61,7 @@
 
 bool WriteTestMessageToHandle(const embedder::PlatformHandle& handle,
                               uint32_t num_bytes) {
-  scoped_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
+  std::unique_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
 
   size_t write_size = 0;
   mojo::test::BlockingWrite(handle, message->main_buffer(),
@@ -821,13 +822,13 @@
     platform_handles->push_back(
         mojo::test::PlatformHandleFromFILE(fp2.Pass()).release());
 
-    scoped_ptr<MessageInTransit> message(
+    std::unique_ptr<MessageInTransit> message(
         new MessageInTransit(MessageInTransit::Type::ENDPOINT_CLIENT,
                              MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
                              sizeof(kHello), kHello));
     message->SetTransportData(util::MakeUnique<TransportData>(
         platform_handles.Pass(), rc_write->GetSerializedPlatformHandleSize()));
-    EXPECT_TRUE(rc_write->WriteMessage(message.Pass()));
+    EXPECT_TRUE(rc_write->WriteMessage(std::move(message)));
   }
 
   read_delegate.Wait();
diff --git a/mojo/edk/system/remote_consumer_data_pipe_impl.cc b/mojo/edk/system/remote_consumer_data_pipe_impl.cc
index ea012ef..9355c5e 100644
--- a/mojo/edk/system/remote_consumer_data_pipe_impl.cc
+++ b/mojo/edk/system/remote_consumer_data_pipe_impl.cc
@@ -7,9 +7,10 @@
 #include <string.h>
 
 #include <algorithm>
+#include <memory>
+#include <utility>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/configuration.h"
@@ -96,7 +97,7 @@
 
   if (messages) {
     while (!messages->IsEmpty()) {
-      scoped_ptr<MessageInTransit> message(messages->GetMessage());
+      std::unique_ptr<MessageInTransit> message(messages->GetMessage());
       if (!ValidateIncomingMessage(element_num_bytes, capacity_num_bytes,
                                    *consumer_num_bytes, message.get())) {
         messages->Clear();
@@ -148,11 +149,11 @@
   while (offset < num_bytes_to_write) {
     size_t message_num_bytes =
         std::min(max_message_num_bytes, num_bytes_to_write - offset);
-    scoped_ptr<MessageInTransit> message(new MessageInTransit(
+    std::unique_ptr<MessageInTransit> message(new MessageInTransit(
         MessageInTransit::Type::ENDPOINT_CLIENT,
         MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
         static_cast<uint32_t>(message_num_bytes), elements.At(offset)));
-    if (!channel_endpoint_->EnqueueMessage(message.Pass())) {
+    if (!channel_endpoint_->EnqueueMessage(std::move(message))) {
       Disconnect();
       break;
     }
@@ -227,11 +228,11 @@
   while (offset < num_bytes_written) {
     size_t message_num_bytes =
         std::min(max_message_num_bytes, num_bytes_written - offset);
-    scoped_ptr<MessageInTransit> message(new MessageInTransit(
+    std::unique_ptr<MessageInTransit> message(new MessageInTransit(
         MessageInTransit::Type::ENDPOINT_CLIENT,
         MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
         static_cast<uint32_t>(message_num_bytes), buffer_.get() + offset));
-    if (!channel_endpoint_->EnqueueMessage(message.Pass())) {
+    if (!channel_endpoint_->EnqueueMessage(std::move(message))) {
       set_producer_two_phase_max_num_bytes_written(0);
       Disconnect();
       return MOJO_RESULT_OK;
@@ -373,7 +374,7 @@
                                                MessageInTransit* message) {
   // Always take ownership of the message. (This means that we should always
   // return true.)
-  scoped_ptr<MessageInTransit> msg(message);
+  std::unique_ptr<MessageInTransit> msg(message);
 
   if (!ValidateIncomingMessage(element_num_bytes(), capacity_num_bytes(),
                                consumer_num_bytes_, msg.get())) {
diff --git a/mojo/edk/system/remote_producer_data_pipe_impl.cc b/mojo/edk/system/remote_producer_data_pipe_impl.cc
index 252e237..847949f 100644
--- a/mojo/edk/system/remote_producer_data_pipe_impl.cc
+++ b/mojo/edk/system/remote_producer_data_pipe_impl.cc
@@ -7,10 +7,10 @@
 #include <string.h>
 
 #include <algorithm>
+#include <memory>
 #include <utility>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/configuration.h"
@@ -97,7 +97,7 @@
   size_t current_num_bytes = 0;
   if (messages) {
     while (!messages->IsEmpty()) {
-      scoped_ptr<MessageInTransit> message(messages->GetMessage());
+      std::unique_ptr<MessageInTransit> message(messages->GetMessage());
       if (!ValidateIncomingMessage(element_num_bytes, capacity_num_bytes,
                                    current_num_bytes, message.get())) {
         messages->Clear();
@@ -361,7 +361,7 @@
 
   // Otherwise, we take ownership of the message. (This means that we should
   // always return true below.)
-  scoped_ptr<MessageInTransit> msg(message);
+  std::unique_ptr<MessageInTransit> msg(message);
 
   if (!ValidateIncomingMessage(element_num_bytes(), capacity_num_bytes(),
                                current_num_bytes_, msg.get())) {
@@ -450,11 +450,11 @@
 
   RemoteDataPipeAck ack_data = {};
   ack_data.num_bytes_consumed = static_cast<uint32_t>(num_bytes);
-  scoped_ptr<MessageInTransit> message(new MessageInTransit(
+  std::unique_ptr<MessageInTransit> message(new MessageInTransit(
       MessageInTransit::Type::ENDPOINT_CLIENT,
       MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA_PIPE_ACK,
       static_cast<uint32_t>(sizeof(ack_data)), &ack_data));
-  if (!channel_endpoint_->EnqueueMessage(message.Pass()))
+  if (!channel_endpoint_->EnqueueMessage(std::move(message)))
     Disconnect();
 }
 
diff --git a/mojo/edk/system/slave_connection_manager.cc b/mojo/edk/system/slave_connection_manager.cc
index 1d9d590..58b164d 100644
--- a/mojo/edk/system/slave_connection_manager.cc
+++ b/mojo/edk/system/slave_connection_manager.cc
@@ -11,6 +11,7 @@
 #include "base/message_loop/message_loop.h"
 #include "mojo/edk/system/connection_manager_messages.h"
 #include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/util/make_unique.h"
 
 namespace mojo {
 namespace system {
@@ -160,10 +161,10 @@
 
   DVLOG(1) << "Sending AllowConnect: connection ID "
            << connection_id.ToString();
-  if (!raw_channel_->WriteMessage(make_scoped_ptr(new MessageInTransit(
+  if (!raw_channel_->WriteMessage(util::MakeUnique<MessageInTransit>(
           MessageInTransit::Type::CONNECTION_MANAGER,
           MessageInTransit::Subtype::CONNECTION_MANAGER_ALLOW_CONNECT,
-          sizeof(connection_id), &connection_id)))) {
+          sizeof(connection_id), &connection_id))) {
     // Don't tear things down; possibly we'll still read some messages.
     *result = Result::FAILURE;
     event_.Signal();
@@ -185,10 +186,10 @@
 
   DVLOG(1) << "Sending CancelConnect: connection ID "
            << connection_id.ToString();
-  if (!raw_channel_->WriteMessage(make_scoped_ptr(new MessageInTransit(
+  if (!raw_channel_->WriteMessage(util::MakeUnique<MessageInTransit>(
           MessageInTransit::Type::CONNECTION_MANAGER,
           MessageInTransit::Subtype::CONNECTION_MANAGER_CANCEL_CONNECT,
-          sizeof(connection_id), &connection_id)))) {
+          sizeof(connection_id), &connection_id))) {
     // Don't tear things down; possibly we'll still read some messages.
     *result = Result::FAILURE;
     event_.Signal();
@@ -212,10 +213,10 @@
   DCHECK_EQ(awaiting_ack_type_, NOT_AWAITING_ACK);
 
   DVLOG(1) << "Sending Connect: connection ID " << connection_id.ToString();
-  if (!raw_channel_->WriteMessage(make_scoped_ptr(new MessageInTransit(
+  if (!raw_channel_->WriteMessage(util::MakeUnique<MessageInTransit>(
           MessageInTransit::Type::CONNECTION_MANAGER,
           MessageInTransit::Subtype::CONNECTION_MANAGER_CONNECT,
-          sizeof(connection_id), &connection_id)))) {
+          sizeof(connection_id), &connection_id))) {
     // Don't tear things down; possibly we'll still read some messages.
     *result = Result::FAILURE;
     platform_handle->reset();
diff --git a/mojo/edk/system/test_channel_endpoint_client.cc b/mojo/edk/system/test_channel_endpoint_client.cc
index b3e69b1..3b88be8 100644
--- a/mojo/edk/system/test_channel_endpoint_client.cc
+++ b/mojo/edk/system/test_channel_endpoint_client.cc
@@ -34,7 +34,7 @@
   return messages_.Size();
 }
 
-scoped_ptr<MessageInTransit> TestChannelEndpointClient::PopMessage() {
+std::unique_ptr<MessageInTransit> TestChannelEndpointClient::PopMessage() {
   MutexLocker locker(&mutex_);
   if (messages_.IsEmpty())
     return nullptr;
@@ -52,7 +52,7 @@
 
   EXPECT_EQ(port_, port);
   EXPECT_TRUE(endpoint_);
-  messages_.AddMessage(make_scoped_ptr(message));
+  messages_.AddMessage(std::unique_ptr<MessageInTransit>(message));
 
   if (read_event_)
     read_event_->Signal();
diff --git a/mojo/edk/system/test_channel_endpoint_client.h b/mojo/edk/system/test_channel_endpoint_client.h
index bb812f0..831fbc7 100644
--- a/mojo/edk/system/test_channel_endpoint_client.h
+++ b/mojo/edk/system/test_channel_endpoint_client.h
@@ -5,8 +5,9 @@
 #ifndef MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_
 #define MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/channel_endpoint_client.h"
 #include "mojo/edk/system/message_in_transit_queue.h"
@@ -36,7 +37,7 @@
 
   // Gets/removes a message that was received (|NumMessages()| must be
   // non-zero), in FIFO order.
-  scoped_ptr<MessageInTransit> PopMessage();
+  std::unique_ptr<MessageInTransit> PopMessage();
 
   // Sets an event to signal when we receive a message. (|read_event| must live
   // until this object is destroyed or the read event is reset to null.)