Rename LocalDataPipe -> LocalDataPipeImpl.

This seems a little strange, but it's a step towards the following:
* LocalDataPipeImpl will subclass/implement DataPipeImpl (to be
  introduced) instead of DataPipe.
* DataPipe will have a DataPipeImpl member (instead of being
  subclassed).
* This allows a DataPipe's impl to be swapped out for a different one
  (e.g., a cross-process one). (A DataPipe itself is hard to swap out,
  since Dispatchers have references to it.)

R=yzshen@chromium.org

Review URL: https://codereview.chromium.org/936173002
diff --git a/mojo/edk/system/BUILD.gn b/mojo/edk/system/BUILD.gn
index e07f087..c7b4346 100644
--- a/mojo/edk/system/BUILD.gn
+++ b/mojo/edk/system/BUILD.gn
@@ -57,8 +57,8 @@
     "handle_table.h",
     "incoming_endpoint.cc",
     "incoming_endpoint.h",
-    "local_data_pipe.cc",
-    "local_data_pipe.h",
+    "local_data_pipe_impl.cc",
+    "local_data_pipe_impl.h",
     "local_message_pipe_endpoint.cc",
     "local_message_pipe_endpoint.h",
     "mapping_table.cc",
@@ -157,7 +157,7 @@
     "core_unittest.cc",
     "data_pipe_unittest.cc",
     "dispatcher_unittest.cc",
-    "local_data_pipe_unittest.cc",
+    "local_data_pipe_impl_unittest.cc",
     "memory_unittest.cc",
     "message_pipe_dispatcher_unittest.cc",
     "message_pipe_test_utils.cc",
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index f335740..e82e9f4 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -17,7 +17,7 @@
 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/handle_signals_state.h"
-#include "mojo/edk/system/local_data_pipe.h"
+#include "mojo/edk/system/local_data_pipe_impl.h"
 #include "mojo/edk/system/memory.h"
 #include "mojo/edk/system/message_pipe.h"
 #include "mojo/edk/system/message_pipe_dispatcher.h"
@@ -381,7 +381,7 @@
   }
   DCHECK_NE(handle_pair.second, MOJO_HANDLE_INVALID);
 
-  scoped_refptr<DataPipe> data_pipe(new LocalDataPipe(validated_options));
+  scoped_refptr<DataPipe> data_pipe(new LocalDataPipeImpl(validated_options));
   producer_dispatcher->Init(data_pipe);
   consumer_dispatcher->Init(data_pipe);
 
diff --git a/mojo/edk/system/local_data_pipe.cc b/mojo/edk/system/local_data_pipe_impl.cc
similarity index 89%
rename from mojo/edk/system/local_data_pipe.cc
rename to mojo/edk/system/local_data_pipe_impl.cc
index 6d0760b..01ed107 100644
--- a/mojo/edk/system/local_data_pipe.cc
+++ b/mojo/edk/system/local_data_pipe_impl.cc
@@ -8,7 +8,7 @@
 // saved by the limit on capacity -- the maximum size of the buffer, checked in
 // |DataPipe::ValidateOptions()|, is currently sufficiently small.)
 
-#include "mojo/edk/system/local_data_pipe.h"
+#include "mojo/edk/system/local_data_pipe_impl.h"
 
 #include <string.h>
 
@@ -20,16 +20,16 @@
 namespace mojo {
 namespace system {
 
-LocalDataPipe::LocalDataPipe(const MojoCreateDataPipeOptions& options)
+LocalDataPipeImpl::LocalDataPipeImpl(const MojoCreateDataPipeOptions& options)
     : DataPipe(true, true, options), start_index_(0), current_num_bytes_(0) {
   // Note: |buffer_| is lazily allocated, since a common case will be that one
   // of the handles is immediately passed off to another process.
 }
 
-LocalDataPipe::~LocalDataPipe() {
+LocalDataPipeImpl::~LocalDataPipeImpl() {
 }
 
-void LocalDataPipe::ProducerCloseImplNoLock() {
+void LocalDataPipeImpl::ProducerCloseImplNoLock() {
   // If the consumer is still open and we still have data, we have to keep the
   // buffer around. Currently, we won't free it even if it empties later. (We
   // could do this -- requiring a check on every read -- but that seems to be
@@ -42,7 +42,7 @@
   }
 }
 
-MojoResult LocalDataPipe::ProducerWriteDataImplNoLock(
+MojoResult LocalDataPipeImpl::ProducerWriteDataImplNoLock(
     UserPointer<const void> elements,
     UserPointer<uint32_t> num_bytes,
     uint32_t max_num_bytes_to_write,
@@ -101,7 +101,7 @@
   return MOJO_RESULT_OK;
 }
 
-MojoResult LocalDataPipe::ProducerBeginWriteDataImplNoLock(
+MojoResult LocalDataPipeImpl::ProducerBeginWriteDataImplNoLock(
     UserPointer<void*> buffer,
     UserPointer<uint32_t> buffer_num_bytes,
     uint32_t min_num_bytes_to_write) {
@@ -142,7 +142,7 @@
   return MOJO_RESULT_OK;
 }
 
-MojoResult LocalDataPipe::ProducerEndWriteDataImplNoLock(
+MojoResult LocalDataPipeImpl::ProducerEndWriteDataImplNoLock(
     uint32_t num_bytes_written) {
   DCHECK_LE(num_bytes_written,
             producer_two_phase_max_num_bytes_written_no_lock());
@@ -152,7 +152,7 @@
   return MOJO_RESULT_OK;
 }
 
-HandleSignalsState LocalDataPipe::ProducerGetHandleSignalsStateImplNoLock()
+HandleSignalsState LocalDataPipeImpl::ProducerGetHandleSignalsStateImplNoLock()
     const {
   HandleSignalsState rv;
   if (consumer_open_no_lock()) {
@@ -167,7 +167,7 @@
   return rv;
 }
 
-void LocalDataPipe::ProducerStartSerializeImplNoLock(
+void LocalDataPipeImpl::ProducerStartSerializeImplNoLock(
     Channel* channel,
     size_t* max_size,
     size_t* max_platform_handles) {
@@ -176,7 +176,7 @@
   *max_platform_handles = 0;
 }
 
-bool LocalDataPipe::ProducerEndSerializeImplNoLock(
+bool LocalDataPipeImpl::ProducerEndSerializeImplNoLock(
     Channel* channel,
     void* destination,
     size_t* actual_size,
@@ -186,7 +186,7 @@
   return false;
 }
 
-void LocalDataPipe::ConsumerCloseImplNoLock() {
+void LocalDataPipeImpl::ConsumerCloseImplNoLock() {
   // If the producer is around and in a two-phase write, we have to keep the
   // buffer around. (We then don't free it until the producer is closed. This
   // could be rectified, but again seems like optimizing for the uncommon case.)
@@ -195,7 +195,7 @@
   current_num_bytes_ = 0;
 }
 
-MojoResult LocalDataPipe::ConsumerReadDataImplNoLock(
+MojoResult LocalDataPipeImpl::ConsumerReadDataImplNoLock(
     UserPointer<void> elements,
     UserPointer<uint32_t> num_bytes,
     uint32_t max_num_bytes_to_read,
@@ -236,7 +236,7 @@
   return MOJO_RESULT_OK;
 }
 
-MojoResult LocalDataPipe::ConsumerDiscardDataImplNoLock(
+MojoResult LocalDataPipeImpl::ConsumerDiscardDataImplNoLock(
     UserPointer<uint32_t> num_bytes,
     uint32_t max_num_bytes_to_discard,
     uint32_t min_num_bytes_to_discard) {
@@ -264,14 +264,14 @@
   return MOJO_RESULT_OK;
 }
 
-MojoResult LocalDataPipe::ConsumerQueryDataImplNoLock(
+MojoResult LocalDataPipeImpl::ConsumerQueryDataImplNoLock(
     UserPointer<uint32_t> num_bytes) {
   // Note: This cast is safe, since the capacity fits into a |uint32_t|.
   num_bytes.Put(static_cast<uint32_t>(current_num_bytes_));
   return MOJO_RESULT_OK;
 }
 
-MojoResult LocalDataPipe::ConsumerBeginReadDataImplNoLock(
+MojoResult LocalDataPipeImpl::ConsumerBeginReadDataImplNoLock(
     UserPointer<const void*> buffer,
     UserPointer<uint32_t> buffer_num_bytes,
     uint32_t min_num_bytes_to_read) {
@@ -296,7 +296,7 @@
   return MOJO_RESULT_OK;
 }
 
-MojoResult LocalDataPipe::ConsumerEndReadDataImplNoLock(
+MojoResult LocalDataPipeImpl::ConsumerEndReadDataImplNoLock(
     uint32_t num_bytes_read) {
   DCHECK_LE(num_bytes_read, consumer_two_phase_max_num_bytes_read_no_lock());
   DCHECK_LE(start_index_ + num_bytes_read, capacity_num_bytes());
@@ -305,7 +305,7 @@
   return MOJO_RESULT_OK;
 }
 
-HandleSignalsState LocalDataPipe::ConsumerGetHandleSignalsStateImplNoLock()
+HandleSignalsState LocalDataPipeImpl::ConsumerGetHandleSignalsStateImplNoLock()
     const {
   HandleSignalsState rv;
   if (current_num_bytes_ > 0) {
@@ -321,7 +321,7 @@
   return rv;
 }
 
-void LocalDataPipe::ConsumerStartSerializeImplNoLock(
+void LocalDataPipeImpl::ConsumerStartSerializeImplNoLock(
     Channel* channel,
     size_t* max_size,
     size_t* max_platform_handles) {
@@ -330,7 +330,7 @@
   *max_platform_handles = 0;
 }
 
-bool LocalDataPipe::ConsumerEndSerializeImplNoLock(
+bool LocalDataPipeImpl::ConsumerEndSerializeImplNoLock(
     Channel* channel,
     void* destination,
     size_t* actual_size,
@@ -340,7 +340,7 @@
   return false;
 }
 
-void LocalDataPipe::EnsureBufferNoLock() {
+void LocalDataPipeImpl::EnsureBufferNoLock() {
   DCHECK(producer_open_no_lock());
   if (buffer_)
     return;
@@ -349,7 +349,7 @@
                          GetConfiguration().data_pipe_buffer_alignment_bytes)));
 }
 
-void LocalDataPipe::DestroyBufferNoLock() {
+void LocalDataPipeImpl::DestroyBufferNoLock() {
 #ifndef NDEBUG
   // Scribble on the buffer to help detect use-after-frees. (This also helps the
   // unit test detect certain bugs without needing ASAN or similar.)
@@ -359,7 +359,7 @@
   buffer_.reset();
 }
 
-size_t LocalDataPipe::GetMaxNumBytesToWriteNoLock() {
+size_t LocalDataPipeImpl::GetMaxNumBytesToWriteNoLock() {
   size_t next_index = start_index_ + current_num_bytes_;
   if (next_index >= capacity_num_bytes()) {
     next_index %= capacity_num_bytes();
@@ -371,13 +371,13 @@
   return capacity_num_bytes() - next_index;
 }
 
-size_t LocalDataPipe::GetMaxNumBytesToReadNoLock() {
+size_t LocalDataPipeImpl::GetMaxNumBytesToReadNoLock() {
   if (start_index_ + current_num_bytes_ > capacity_num_bytes())
     return capacity_num_bytes() - start_index_;
   return current_num_bytes_;
 }
 
-void LocalDataPipe::MarkDataAsConsumedNoLock(size_t num_bytes) {
+void LocalDataPipeImpl::MarkDataAsConsumedNoLock(size_t num_bytes) {
   DCHECK_LE(num_bytes, current_num_bytes_);
   start_index_ += num_bytes;
   start_index_ %= capacity_num_bytes();
diff --git a/mojo/edk/system/local_data_pipe.h b/mojo/edk/system/local_data_pipe_impl.h
similarity index 87%
rename from mojo/edk/system/local_data_pipe.h
rename to mojo/edk/system/local_data_pipe_impl.h
index a3e57f5..c241366 100644
--- a/mojo/edk/system/local_data_pipe.h
+++ b/mojo/edk/system/local_data_pipe_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_H_
-#define MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_H_
+#ifndef MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_
+#define MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_
 
 #include "base/macros.h"
 #include "base/memory/aligned_memory.h"
@@ -15,19 +15,20 @@
 namespace mojo {
 namespace system {
 
-// |LocalDataPipe| is a subclass that "implements" |DataPipe| for data pipes
+// |LocalDataPipeImpl| is a subclass that "implements" |DataPipe| for data pipes
 // whose producer and consumer are both local. This class is thread-safe (with
 // protection provided by |DataPipe|'s |lock_|.
-class MOJO_SYSTEM_IMPL_EXPORT LocalDataPipe : public DataPipe {
+class MOJO_SYSTEM_IMPL_EXPORT LocalDataPipeImpl : public DataPipe {
  public:
   // |validated_options| should be the output of |DataPipe::ValidateOptions()|.
   // In particular: |struct_size| is ignored (so |validated_options| must be the
   // current version of the struct) and |capacity_num_bytes| must be nonzero.
-  explicit LocalDataPipe(const MojoCreateDataPipeOptions& validated_options);
+  explicit LocalDataPipeImpl(
+      const MojoCreateDataPipeOptions& validated_options);
 
  private:
-  friend class base::RefCountedThreadSafe<LocalDataPipe>;
-  ~LocalDataPipe() override;
+  friend class base::RefCountedThreadSafe<LocalDataPipeImpl>;
+  ~LocalDataPipeImpl() override;
 
   // |DataPipe| implementation:
   void ProducerCloseImplNoLock() override;
@@ -96,10 +97,10 @@
   size_t start_index_;
   size_t current_num_bytes_;
 
-  DISALLOW_COPY_AND_ASSIGN(LocalDataPipe);
+  DISALLOW_COPY_AND_ASSIGN(LocalDataPipeImpl);
 };
 
 }  // namespace system
 }  // namespace mojo
 
-#endif  // MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_H_
+#endif  // MOJO_EDK_SYSTEM_LOCAL_DATA_PIPE_IMPL_H_
diff --git a/mojo/edk/system/local_data_pipe_unittest.cc b/mojo/edk/system/local_data_pipe_impl_unittest.cc
similarity index 96%
rename from mojo/edk/system/local_data_pipe_unittest.cc
rename to mojo/edk/system/local_data_pipe_impl_unittest.cc
index 1223a2b..1e66903 100644
--- a/mojo/edk/system/local_data_pipe_unittest.cc
+++ b/mojo/edk/system/local_data_pipe_impl_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/edk/system/local_data_pipe.h"
+#include "mojo/edk/system/local_data_pipe_impl.h"
 
 #include <string.h>
 
@@ -20,14 +20,14 @@
     static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions));
 
 // Validate options.
-TEST(LocalDataPipeTest, Creation) {
+TEST(LocalDataPipeImplTest, Creation) {
   // Create using default options.
   {
     // Get default options.
     MojoCreateDataPipeOptions default_options = {0};
     EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                   NullUserPointer(), &default_options));
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(default_options));
+    scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(default_options));
     dp->ProducerClose();
     dp->ConsumerClose();
   }
@@ -44,7 +44,8 @@
     EXPECT_EQ(MOJO_RESULT_OK,
               DataPipe::ValidateCreateOptions(MakeUserPointer(&options),
                                               &validated_options));
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     dp->ProducerClose();
     dp->ConsumerClose();
   }
@@ -59,7 +60,8 @@
     EXPECT_EQ(MOJO_RESULT_OK,
               DataPipe::ValidateCreateOptions(MakeUserPointer(&options),
                                               &validated_options));
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     dp->ProducerClose();
     dp->ConsumerClose();
   }
@@ -74,7 +76,8 @@
     EXPECT_EQ(MOJO_RESULT_OK,
               DataPipe::ValidateCreateOptions(MakeUserPointer(&options),
                                               &validated_options));
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     dp->ProducerClose();
     dp->ConsumerClose();
   }
@@ -90,13 +93,14 @@
     EXPECT_EQ(MOJO_RESULT_OK,
               DataPipe::ValidateCreateOptions(MakeUserPointer(&options),
                                               &validated_options));
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     dp->ProducerClose();
     dp->ConsumerClose();
   }
 }
 
-TEST(LocalDataPipeTest, SimpleReadWrite) {
+TEST(LocalDataPipeImplTest, SimpleReadWrite) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -107,7 +111,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   int32_t elements[10] = {0};
   uint32_t num_bytes = 0;
@@ -213,9 +217,9 @@
 // Note: The "basic" waiting tests test that the "wait states" are correct in
 // various situations; they don't test that waiters are properly awoken on state
 // changes. (For that, we need to use multiple threads.)
-TEST(LocalDataPipeTest, BasicProducerWaiting) {
-  // Note: We take advantage of the fact that for |LocalDataPipe|, capacities
-  // are strict maximums. This is not guaranteed by the API.
+TEST(LocalDataPipeImplTest, BasicProducerWaiting) {
+  // Note: We take advantage of the fact that for |LocalDataPipeImpl|,
+  // capacities are strict maximums. This is not guaranteed by the API.
 
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
@@ -227,7 +231,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
   Waiter waiter;
   uint32_t context = 0;
   HandleSignalsState hss;
@@ -392,7 +396,7 @@
   dp->ProducerClose();
 }
 
-TEST(LocalDataPipeTest, PeerClosedWaiting) {
+TEST(LocalDataPipeImplTest, PeerClosedWaiting) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -408,7 +412,8 @@
 
   // Check MOJO_HANDLE_SIGNAL_PEER_CLOSED on producer.
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     // Add a waiter.
     waiter.Init();
     ASSERT_EQ(MOJO_RESULT_OK,
@@ -432,7 +437,8 @@
 
   // Check MOJO_HANDLE_SIGNAL_PEER_CLOSED on consumer.
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     // Add a waiter.
     waiter.Init();
     ASSERT_EQ(MOJO_RESULT_OK,
@@ -455,7 +461,7 @@
   }
 }
 
-TEST(LocalDataPipeTest, BasicConsumerWaiting) {
+TEST(LocalDataPipeImplTest, BasicConsumerWaiting) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -467,7 +473,8 @@
                                 MakeUserPointer(&options), &validated_options));
 
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     Waiter waiter;
     uint32_t context = 0;
     HandleSignalsState hss;
@@ -622,7 +629,8 @@
   // Test with two-phase APIs and closing the producer with an active consumer
   // waiter.
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
     Waiter waiter;
     uint32_t context = 0;
     HandleSignalsState hss;
@@ -713,7 +721,7 @@
 }
 
 // Tests that data pipes aren't writable/readable during two-phase writes/reads.
-TEST(LocalDataPipeTest, BasicTwoPhaseWaiting) {
+TEST(LocalDataPipeImplTest, BasicTwoPhaseWaiting) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -724,7 +732,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
   Waiter waiter;
   HandleSignalsState hss;
 
@@ -866,7 +874,7 @@
 }
 
 // Test that a "may discard" data pipe is writable even when it's full.
-TEST(LocalDataPipeTest, BasicMayDiscardWaiting) {
+TEST(LocalDataPipeImplTest, BasicMayDiscardWaiting) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                                  // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD,  // |flags|.
@@ -877,7 +885,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
   Waiter waiter;
   HandleSignalsState hss;
 
@@ -998,7 +1006,7 @@
     out[i] = start + static_cast<int32_t>(i);
 }
 
-TEST(LocalDataPipeTest, MayDiscard) {
+TEST(LocalDataPipeImplTest, MayDiscard) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                                  // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD,  // |flags|.
@@ -1009,7 +1017,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   int32_t buffer[100] = {0};
   uint32_t num_bytes = 0;
@@ -1191,7 +1199,7 @@
   dp->ConsumerClose();
 }
 
-TEST(LocalDataPipeTest, AllOrNone) {
+TEST(LocalDataPipeImplTest, AllOrNone) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -1202,7 +1210,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   // Try writing way too much.
   uint32_t num_bytes = 20u * sizeof(int32_t);
@@ -1351,7 +1359,7 @@
   dp->ConsumerClose();
 }
 
-TEST(LocalDataPipeTest, AllOrNoneMayDiscard) {
+TEST(LocalDataPipeImplTest, AllOrNoneMayDiscard) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                                  // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD,  // |flags|.
@@ -1362,7 +1370,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   // Try writing way too much.
   uint32_t num_bytes = 20u * sizeof(int32_t);
@@ -1444,13 +1452,13 @@
   EXPECT_EQ(0, memcmp(buffer, expected_buffer, sizeof(buffer)));
 
   // Note: All-or-none two-phase writes on a "may discard" data pipe are tested
-  // in LocalDataPipeTest.MayDiscard.
+  // in LocalDataPipeImplTest.MayDiscard.
 
   dp->ProducerClose();
   dp->ConsumerClose();
 }
 
-TEST(LocalDataPipeTest, TwoPhaseAllOrNone) {
+TEST(LocalDataPipeImplTest, TwoPhaseAllOrNone) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -1461,7 +1469,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   // Try writing way too much (two-phase).
   uint32_t num_bytes = 20u * sizeof(int32_t);
@@ -1585,7 +1593,7 @@
 // respectively, as much as possible, even if it has to "wrap around" the
 // internal circular buffer. (Note that the two-phase write and read do not do
 // this.)
-TEST(LocalDataPipeTest, WrapAround) {
+TEST(LocalDataPipeImplTest, WrapAround) {
   unsigned char test_data[1000];
   for (size_t i = 0; i < arraysize(test_data); i++)
     test_data[i] = static_cast<unsigned char>(i);
@@ -1603,7 +1611,7 @@
   // pipe more space.
   ASSERT_EQ(100u, validated_options.capacity_num_bytes);
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   // Write 20 bytes.
   uint32_t num_bytes = 20u;
@@ -1670,7 +1678,7 @@
 
 // Tests the behavior of closing the producer or consumer with respect to
 // writes and reads (simple and two-phase).
-TEST(LocalDataPipeTest, CloseWriteRead) {
+TEST(LocalDataPipeImplTest, CloseWriteRead) {
   const char kTestData[] = "hello world";
   const uint32_t kTestDataSize = static_cast<uint32_t>(sizeof(kTestData));
 
@@ -1686,7 +1694,8 @@
 
   // Close producer first, then consumer.
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
 
     // Write some data, so we'll have something to read.
     uint32_t num_bytes = kTestDataSize;
@@ -1742,7 +1751,8 @@
 
   // Close consumer first, then producer.
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
 
     // Write some data, so we'll have something to read.
     uint32_t num_bytes = kTestDataSize;
@@ -1798,7 +1808,8 @@
   // Test closing the consumer first, then the producer, with an active
   // two-phase write.
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
 
     // Start two-phase write.
     void* write_buffer_ptr = nullptr;
@@ -1815,7 +1826,8 @@
 
   // Test closing the producer and then trying to read (with no data).
   {
-    scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+    scoped_refptr<LocalDataPipeImpl> dp(
+        new LocalDataPipeImpl(validated_options));
 
     // Write some data, so we'll have something to read.
     uint32_t num_bytes = kTestDataSize;
@@ -1867,7 +1879,7 @@
   }
 }
 
-TEST(LocalDataPipeTest, TwoPhaseMoreInvalidArguments) {
+TEST(LocalDataPipeImplTest, TwoPhaseMoreInvalidArguments) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                           // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
@@ -1878,7 +1890,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   // No data.
   uint32_t num_bytes = 1000u;
@@ -1993,7 +2005,7 @@
 // |ConsumerBeginReadData()| isn't discardable until |ConsumerEndReadData()|,
 // and thus we erroneously allow |ProducerWriteData()| to succeed. Second, the
 // |ProducerWriteData()| then changes the data underneath the two-phase read.)
-TEST(LocalDataPipeTest, DISABLED_MayDiscardTwoPhaseConsistent) {
+TEST(LocalDataPipeImplTest, DISABLED_MayDiscardTwoPhaseConsistent) {
   const MojoCreateDataPipeOptions options = {
       kSizeOfOptions,                                  // |struct_size|.
       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD,  // |flags|.
@@ -2004,7 +2016,7 @@
   EXPECT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
                                 MakeUserPointer(&options), &validated_options));
 
-  scoped_refptr<LocalDataPipe> dp(new LocalDataPipe(validated_options));
+  scoped_refptr<LocalDataPipeImpl> dp(new LocalDataPipeImpl(validated_options));
 
   // Write some elements.
   char elements[2] = {'a', 'b'};