EDK: Move {platform_handle,scoped_platform_handle}.* to //mojo/edk/platform.

R=vardhan@google.com

Review URL: https://codereview.chromium.org/1483823004 .
diff --git a/mojo/edk/embedder/BUILD.gn b/mojo/edk/embedder/BUILD.gn
index b651dfe..8cbadec 100644
--- a/mojo/edk/embedder/BUILD.gn
+++ b/mojo/edk/embedder/BUILD.gn
@@ -56,13 +56,10 @@
     "platform_channel_pair.h",
     "platform_channel_utils.cc",
     "platform_channel_utils.h",
-    "platform_handle.cc",
-    "platform_handle.h",
     "platform_handle_utils.h",
     "platform_handle_utils_posix.cc",
     "platform_shared_buffer.h",
     "platform_support.h",
-    "scoped_platform_handle.h",
     "simple_platform_shared_buffer.cc",
     "simple_platform_shared_buffer.h",
     "simple_platform_support.cc",
@@ -71,6 +68,8 @@
 
   mojo_sdk_public_deps = [ "mojo/public/cpp/system" ]
 
+  mojo_edk_public_deps = [ "mojo/edk/platform" ]
+
   deps = [
     "//base",
   ]
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc
index 74b38dd..b058b36 100644
--- a/mojo/edk/embedder/embedder.cc
+++ b/mojo/edk/embedder/embedder.cc
@@ -25,6 +25,7 @@
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/util/ref_ptr.h"
 
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/embedder/embedder.h b/mojo/edk/embedder/embedder.h
index 0ae1249..0ca05d6 100644
--- a/mojo/edk/embedder/embedder.h
+++ b/mojo/edk/embedder/embedder.h
@@ -12,8 +12,8 @@
 #include "base/callback.h"
 #include "mojo/edk/embedder/channel_info_forward.h"
 #include "mojo/edk/embedder/process_type.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/embedder/slave_info.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/public/cpp/system/message_pipe.h"
 
@@ -56,14 +56,15 @@
 // failure, which is different from what you'd expect from a Mojo API, but it
 // makes for a more convenient embedder API.
 MojoResult CreatePlatformHandleWrapper(
-    ScopedPlatformHandle platform_handle,
+    platform::ScopedPlatformHandle platform_handle,
     MojoHandle* platform_handle_wrapper_handle);
 
 // Retrieves the |PlatformHandle| that was wrapped into a |MojoHandle| (using
 // |CreatePlatformHandleWrapper()| above). Note that the |MojoHandle| must still
 // be closed separately.
-MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
-                                     ScopedPlatformHandle* platform_handle);
+MojoResult PassWrappedPlatformHandle(
+    MojoHandle platform_handle_wrapper_handle,
+    platform::ScopedPlatformHandle* platform_handle);
 
 // Initialialization/shutdown for interprocess communication (IPC) -------------
 
@@ -92,7 +93,7 @@
     util::RefPtr<platform::TaskRunner>&& delegate_thread_task_runner,
     ProcessDelegate* process_delegate,
     util::RefPtr<platform::TaskRunner>&& io_thread_task_runner,
-    ScopedPlatformHandle platform_handle);
+    platform::ScopedPlatformHandle platform_handle);
 
 // Shuts down the subsystem initialized by |InitIPCSupport()|. This must be
 // called on the I/O thread (given to |InitIPCSupport()|). This completes
@@ -130,7 +131,7 @@
 // TODO(vtl): The API is a little crazy with respect to the |ChannelInfo*|.
 ScopedMessagePipeHandle ConnectToSlave(
     SlaveInfo slave_info,
-    ScopedPlatformHandle platform_handle,
+    platform::ScopedPlatformHandle platform_handle,
     const base::Closure& did_connect_to_slave_callback,
     util::RefPtr<platform::TaskRunner>&& did_connect_to_slave_runner,
     std::string* platform_connection_id,
@@ -193,7 +194,7 @@
 // the "out" value |*channel_info| should be passed to |DestoryChannel()| to
 // tear down the channel. Returns a handle to the bootstrap message pipe.
 ScopedMessagePipeHandle CreateChannelOnIOThread(
-    ScopedPlatformHandle platform_handle,
+    platform::ScopedPlatformHandle platform_handle,
     ChannelInfo** channel_info);
 
 // Creates a channel asynchronously; may be called from any thread.
@@ -207,7 +208,7 @@
 // Note: This should only be used to establish a channel with a process of type
 // |ProcessType::NONE|. This function may be removed in the future.
 ScopedMessagePipeHandle CreateChannel(
-    ScopedPlatformHandle platform_handle,
+    platform::ScopedPlatformHandle platform_handle,
     const base::Callback<void(ChannelInfo*)>& did_create_channel_callback,
     util::RefPtr<platform::TaskRunner>&& did_create_channel_runner);
 
diff --git a/mojo/edk/embedder/embedder_unittest.cc b/mojo/edk/embedder/embedder_unittest.cc
index 4b7619f..28b87f3 100644
--- a/mojo/edk/embedder/embedder_unittest.cc
+++ b/mojo/edk/embedder/embedder_unittest.cc
@@ -29,6 +29,7 @@
 #include "mojo/public/cpp/system/message_pipe.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::system::test::TestIOThread;
 using mojo::util::ManualResetWaitableEvent;
diff --git a/mojo/edk/embedder/platform_channel_pair.cc b/mojo/edk/embedder/platform_channel_pair.cc
index 735ceac..98761de 100644
--- a/mojo/edk/embedder/platform_channel_pair.cc
+++ b/mojo/edk/embedder/platform_channel_pair.cc
@@ -13,7 +13,10 @@
 #include "base/posix/global_descriptors.h"
 #include "base/strings/string_number_conversions.h"
 #include "build/build_config.h"
-#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 
 namespace mojo {
 namespace embedder {
diff --git a/mojo/edk/embedder/platform_channel_pair.h b/mojo/edk/embedder/platform_channel_pair.h
index 3e3c341..d1bdf74 100644
--- a/mojo/edk/embedder/platform_channel_pair.h
+++ b/mojo/edk/embedder/platform_channel_pair.h
@@ -8,7 +8,7 @@
 #include <string>
 
 #include "base/process/launch.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
@@ -43,10 +43,10 @@
   PlatformChannelPair();
   ~PlatformChannelPair();
 
-  ScopedPlatformHandle PassServerHandle();
+  platform::ScopedPlatformHandle PassServerHandle();
 
   // For in-process use (e.g., in tests or to pass over another channel).
-  ScopedPlatformHandle PassClientHandle();
+  platform::ScopedPlatformHandle PassClientHandle();
 
   // To be called in the child process, after the parent process called
   // |PrepareToPassClientHandleToChildProcess()| and launched the child (using
@@ -54,7 +54,7 @@
   // handle (in the parent process). |string_from_parent| should be the string
   // that was produced (in the parent process) by
   // |PrepareToPassClientHandleToChildProcess()|.
-  static ScopedPlatformHandle PassClientHandleFromParentProcess(
+  static platform::ScopedPlatformHandle PassClientHandleFromParentProcess(
       const std::string& string_from_parent);
 
   // Prepares to pass the client channel to a new child process, to be launched
@@ -73,8 +73,8 @@
  private:
   static const char kMojoPlatformChannelHandleSwitch[];
 
-  ScopedPlatformHandle server_handle_;
-  ScopedPlatformHandle client_handle_;
+  platform::ScopedPlatformHandle server_handle_;
+  platform::ScopedPlatformHandle client_handle_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformChannelPair);
 };
diff --git a/mojo/edk/embedder/platform_channel_pair_unittest.cc b/mojo/edk/embedder/platform_channel_pair_unittest.cc
index 2869660..15250aa 100644
--- a/mojo/edk/embedder/platform_channel_pair_unittest.cc
+++ b/mojo/edk/embedder/platform_channel_pair_unittest.cc
@@ -20,14 +20,17 @@
 #include "base/logging.h"
 #include "build/build_config.h"
 #include "mojo/edk/embedder/platform_channel_utils.h"
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/test/scoped_test_dir.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/edk/util/scoped_file.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
+
 namespace mojo {
 namespace embedder {
 namespace {
diff --git a/mojo/edk/embedder/platform_channel_utils.cc b/mojo/edk/embedder/platform_channel_utils.cc
index 21e1c00..75f4d17 100644
--- a/mojo/edk/embedder/platform_channel_utils.cc
+++ b/mojo/edk/embedder/platform_channel_utils.cc
@@ -12,6 +12,9 @@
 #include "base/posix/eintr_wrapper.h"
 #include "build/build_config.h"
 
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
+
 namespace mojo {
 namespace embedder {
 
diff --git a/mojo/edk/embedder/platform_channel_utils.h b/mojo/edk/embedder/platform_channel_utils.h
index 0e88673..9787fdc 100644
--- a/mojo/edk/embedder/platform_channel_utils.h
+++ b/mojo/edk/embedder/platform_channel_utils.h
@@ -10,8 +10,8 @@
 
 #include <deque>
 
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 
 struct iovec;  // Declared in <sys/uio.h>.
 
@@ -28,10 +28,10 @@
 // equivalent). These are like |write()| and |writev()|, but handle |EINTR| and
 // never raise |SIGPIPE|. (Note: On Mac, the suppression of |SIGPIPE| is set up
 // by |PlatformChannelPair|.)
-ssize_t PlatformChannelWrite(PlatformHandle h,
+ssize_t PlatformChannelWrite(platform::PlatformHandle h,
                              const void* bytes,
                              size_t num_bytes);
-ssize_t PlatformChannelWritev(PlatformHandle h,
+ssize_t PlatformChannelWritev(platform::PlatformHandle h,
                               struct iovec* iov,
                               size_t num_iov);
 
@@ -43,20 +43,21 @@
 // bytes of data sent on success (note that this may not be all the data
 // specified by |iov|). (The handles are not closed, regardless of success or
 // failure.)
-ssize_t PlatformChannelSendmsgWithHandles(PlatformHandle h,
-                                          struct iovec* iov,
-                                          size_t num_iov,
-                                          PlatformHandle* platform_handles,
-                                          size_t num_platform_handles);
+ssize_t PlatformChannelSendmsgWithHandles(
+    platform::PlatformHandle h,
+    struct iovec* iov,
+    size_t num_iov,
+    platform::PlatformHandle* platform_handles,
+    size_t num_platform_handles);
 
 // Wrapper around |recvmsg()|, which will extract any attached file descriptors
 // (in the control message) to |ScopedPlatformHandle|s (and append them to
 // |platform_handles|). (This also handles |EINTR|.)
 ssize_t PlatformChannelRecvmsg(
-    PlatformHandle h,
+    platform::PlatformHandle h,
     void* buf,
     size_t num_bytes,
-    std::deque<ScopedPlatformHandle>* platform_handles);
+    std::deque<platform::ScopedPlatformHandle>* platform_handles);
 
 }  // namespace embedder
 }  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle.cc b/mojo/edk/embedder/platform_handle.cc
deleted file mode 100644
index 570aac9..0000000
--- a/mojo/edk/embedder/platform_handle.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/edk/embedder/platform_handle.h"
-
-#include <unistd.h>
-
-#include "base/logging.h"
-
-namespace mojo {
-namespace embedder {
-
-void PlatformHandle::CloseIfNecessary() {
-  if (!is_valid())
-    return;
-
-  bool success = (close(fd) == 0);
-  DPCHECK(success);
-  fd = -1;
-}
-
-}  // namespace embedder
-}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle_utils.h b/mojo/edk/embedder/platform_handle_utils.h
index f00f865..8003e95 100644
--- a/mojo/edk/embedder/platform_handle_utils.h
+++ b/mojo/edk/embedder/platform_handle_utils.h
@@ -5,8 +5,8 @@
 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_UTILS_H_
 #define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_UTILS_H_
 
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 
 namespace mojo {
 namespace embedder {
@@ -22,7 +22,8 @@
 
 // Duplicates the given |PlatformHandle| (which must be valid). (Returns an
 // invalid |ScopedPlatformHandle| on failure.)
-ScopedPlatformHandle DuplicatePlatformHandle(PlatformHandle platform_handle);
+platform::ScopedPlatformHandle DuplicatePlatformHandle(
+    platform::PlatformHandle platform_handle);
 
 }  // namespace embedder
 }  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle_utils_posix.cc b/mojo/edk/embedder/platform_handle_utils_posix.cc
index b3be93f..07b138e 100644
--- a/mojo/edk/embedder/platform_handle_utils_posix.cc
+++ b/mojo/edk/embedder/platform_handle_utils_posix.cc
@@ -8,6 +8,9 @@
 
 #include "base/logging.h"
 
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
+
 namespace mojo {
 namespace embedder {
 
diff --git a/mojo/edk/embedder/platform_shared_buffer.h b/mojo/edk/embedder/platform_shared_buffer.h
index 8907366..219dc35 100644
--- a/mojo/edk/embedder/platform_shared_buffer.h
+++ b/mojo/edk/embedder/platform_shared_buffer.h
@@ -9,7 +9,7 @@
 
 #include <memory>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/util/ref_counted.h"
 #include "mojo/public/cpp/system/macros.h"
 
@@ -56,13 +56,13 @@
 
   // Duplicates the underlying platform handle and passes it to the caller.
   // TODO(vtl): On POSIX, we'll need two FDs to support sharing read-only.
-  virtual ScopedPlatformHandle DuplicatePlatformHandle() = 0;
+  virtual platform::ScopedPlatformHandle DuplicatePlatformHandle() = 0;
 
   // Passes the underlying platform handle to the caller. This should only be
   // called if there's a unique reference to this object (owned by the caller).
   // After calling this, this object should no longer be used, but should only
   // be disposed of.
-  virtual ScopedPlatformHandle PassPlatformHandle() = 0;
+  virtual platform::ScopedPlatformHandle PassPlatformHandle() = 0;
 
  protected:
   friend class util::RefCountedThreadSafe<PlatformSharedBuffer>;
diff --git a/mojo/edk/embedder/platform_support.h b/mojo/edk/embedder/platform_support.h
index ae02504..09041e4 100644
--- a/mojo/edk/embedder/platform_support.h
+++ b/mojo/edk/embedder/platform_support.h
@@ -7,7 +7,7 @@
 
 #include <stddef.h>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/util/ref_ptr.h"
 #include "mojo/public/c/system/types.h"
 #include "mojo/public/cpp/system/macros.h"
@@ -47,7 +47,7 @@
       size_t num_bytes) = 0;
   virtual util::RefPtr<PlatformSharedBuffer> CreateSharedBufferFromHandle(
       size_t num_bytes,
-      ScopedPlatformHandle platform_handle) = 0;
+      platform::ScopedPlatformHandle platform_handle) = 0;
 
  protected:
   PlatformSupport() {}
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer.cc b/mojo/edk/embedder/simple_platform_shared_buffer.cc
index 64e4705..a3045c4 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer.cc
@@ -27,6 +27,8 @@
 #include "third_party/ashmem/ashmem.h"
 #endif  // defined(OS_ANDROID)
 
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer.h b/mojo/edk/embedder/simple_platform_shared_buffer.h
index 75dfa82..e2aaf38 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer.h
+++ b/mojo/edk/embedder/simple_platform_shared_buffer.h
@@ -23,7 +23,7 @@
 
   static util::RefPtr<SimplePlatformSharedBuffer> CreateFromPlatformHandle(
       size_t num_bytes,
-      ScopedPlatformHandle platform_handle);
+      platform::ScopedPlatformHandle platform_handle);
 
   // |PlatformSharedBuffer| implementation:
   size_t GetNumBytes() const override;
@@ -33,8 +33,8 @@
   std::unique_ptr<PlatformSharedBufferMapping> MapNoCheck(
       size_t offset,
       size_t length) override;
-  ScopedPlatformHandle DuplicatePlatformHandle() override;
-  ScopedPlatformHandle PassPlatformHandle() override;
+  platform::ScopedPlatformHandle DuplicatePlatformHandle() override;
+  platform::ScopedPlatformHandle PassPlatformHandle() override;
 
  private:
   explicit SimplePlatformSharedBuffer(size_t num_bytes);
@@ -46,14 +46,14 @@
   // This is like |Init()|, but for |CreateFromPlatformHandle()|. (Note: It
   // should verify that |platform_handle| is an appropriate handle for the
   // claimed |num_bytes_|.)
-  bool InitFromPlatformHandle(ScopedPlatformHandle platform_handle);
+  bool InitFromPlatformHandle(platform::ScopedPlatformHandle platform_handle);
 
   const size_t num_bytes_;
 
   // This is set in |Init()|/|InitFromPlatformHandle()| and never modified
   // (except by |PassPlatformHandle()|; see the comments above its declaration),
   // hence does not need to be protected by a lock.
-  ScopedPlatformHandle handle_;
+  platform::ScopedPlatformHandle handle_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSharedBuffer);
 };
diff --git a/mojo/edk/embedder/simple_platform_support.cc b/mojo/edk/embedder/simple_platform_support.cc
index d0b3110..f4e969c 100644
--- a/mojo/edk/embedder/simple_platform_support.cc
+++ b/mojo/edk/embedder/simple_platform_support.cc
@@ -4,10 +4,13 @@
 
 #include "mojo/edk/embedder/simple_platform_support.h"
 
+#include <utility>
+
 #include "base/rand_util.h"
 #include "base/time/time.h"
 #include "mojo/edk/embedder/simple_platform_shared_buffer.h"
 
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
@@ -32,7 +35,7 @@
     size_t num_bytes,
     ScopedPlatformHandle platform_handle) {
   return SimplePlatformSharedBuffer::CreateFromPlatformHandle(
-      num_bytes, platform_handle.Pass());
+      num_bytes, std::move(platform_handle));
 }
 
 }  // namespace embedder
diff --git a/mojo/edk/embedder/simple_platform_support.h b/mojo/edk/embedder/simple_platform_support.h
index 41c1602..d348be9 100644
--- a/mojo/edk/embedder/simple_platform_support.h
+++ b/mojo/edk/embedder/simple_platform_support.h
@@ -27,7 +27,7 @@
       size_t num_bytes) override;
   util::RefPtr<PlatformSharedBuffer> CreateSharedBufferFromHandle(
       size_t num_bytes,
-      ScopedPlatformHandle platform_handle) override;
+      platform::ScopedPlatformHandle platform_handle) override;
 
  private:
   MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport);
diff --git a/mojo/edk/platform/BUILD.gn b/mojo/edk/platform/BUILD.gn
index 2aa5fd7..5ed7a68 100644
--- a/mojo/edk/platform/BUILD.gn
+++ b/mojo/edk/platform/BUILD.gn
@@ -8,6 +8,9 @@
   sources = [
     "message_loop.h",
     "message_loop_for_io.h",
+    "platform_handle.cc",
+    "platform_handle.h",
+    "scoped_platform_handle.h",
     "task_runner.h",
   ]
 
diff --git a/mojo/edk/platform/platform_handle.cc b/mojo/edk/platform/platform_handle.cc
new file mode 100644
index 0000000..8a7c7be
--- /dev/null
+++ b/mojo/edk/platform/platform_handle.cc
@@ -0,0 +1,30 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/platform/platform_handle.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+
+namespace mojo {
+namespace platform {
+
+void PlatformHandle::CloseIfNecessary() {
+  if (!is_valid())
+    return;
+
+  if (close(fd) != 0) {
+    // The possible errors are EBADF (which is very bad -- it indicates a bug in
+    // our code), EINTR, or EIO. On EINTR, don't retry |close()| (this is the
+    // correct behavior on Linux, and the only safe thing to do on Mac: see,
+    // e.g., http://crbug.com/269623). EIO is sad (it indicates potential data
+    // loss), but again there's nothing more to do.
+    assert(errno == EINTR || errno == EIO);
+  }
+  fd = -1;
+}
+
+}  // namespace embedder
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle.h b/mojo/edk/platform/platform_handle.h
similarity index 71%
rename from mojo/edk/embedder/platform_handle.h
rename to mojo/edk/platform/platform_handle.h
index 6035294..e959a8d 100644
--- a/mojo/edk/embedder/platform_handle.h
+++ b/mojo/edk/platform/platform_handle.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
-#define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
+#ifndef MOJO_EDK_PLATFORM_PLATFORM_HANDLE_H_
+#define MOJO_EDK_PLATFORM_PLATFORM_HANDLE_H_
 
 namespace mojo {
-namespace embedder {
+namespace platform {
 
 // A |PlatformHandle| is just a file descriptor on POSIX.
 struct PlatformHandle {
@@ -20,7 +20,7 @@
   int fd;
 };
 
-}  // namespace embedder
+}  // namespace platform
 }  // namespace mojo
 
-#endif  // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
+#endif  // MOJO_EDK_PLATFORM_PLATFORM_HANDLE_H_
diff --git a/mojo/edk/embedder/scoped_platform_handle.h b/mojo/edk/platform/scoped_platform_handle.h
similarity index 84%
rename from mojo/edk/embedder/scoped_platform_handle.h
rename to mojo/edk/platform/scoped_platform_handle.h
index fca3990..448a764 100644
--- a/mojo/edk/embedder/scoped_platform_handle.h
+++ b/mojo/edk/platform/scoped_platform_handle.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
-#define MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
+#ifndef MOJO_EDK_PLATFORM_SCOPED_PLATFORM_HANDLE_H_
+#define MOJO_EDK_PLATFORM_SCOPED_PLATFORM_HANDLE_H_
 
-#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
 #include "mojo/public/c/system/macros.h"
 #include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
-namespace embedder {
+namespace platform {
 
 // Scoper for |PlatformHandle|s, which are just file descriptors.
 class ScopedPlatformHandle {
@@ -56,7 +56,7 @@
   MOJO_MOVE_ONLY_TYPE(ScopedPlatformHandle);
 };
 
-}  // namespace embedder
+}  // namespace platform
 }  // namespace mojo
 
-#endif  // MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
+#endif  // MOJO_EDK_PLATFORM_SCOPED_PLATFORM_HANDLE_H_
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc
index 45c5812..c26a374 100644
--- a/mojo/edk/system/channel.cc
+++ b/mojo/edk/system/channel.cc
@@ -13,7 +13,7 @@
 #include "mojo/edk/system/endpoint_relayer.h"
 #include "mojo/edk/system/transport_data.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeRefCounted;
 using mojo::util::MutexLocker;
 using mojo::util::RefPtr;
diff --git a/mojo/edk/system/channel.h b/mojo/edk/system/channel.h
index 166e385..4ec69fe 100644
--- a/mojo/edk/system/channel.h
+++ b/mojo/edk/system/channel.h
@@ -10,7 +10,7 @@
 #include <memory>
 #include <unordered_map>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/channel_endpoint_id.h"
 #include "mojo/edk/system/incoming_endpoint.h"
@@ -191,18 +191,18 @@
   // |RawChannel::Delegate| implementation (only called on the creation thread):
   void OnReadMessage(
       const MessageInTransit::View& message_view,
-      std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+      std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
           platform_handles) override;
   void OnError(Error error) override;
 
   // Helpers for |OnReadMessage| (only called on the creation thread):
   void OnReadMessageForEndpoint(
       const MessageInTransit::View& message_view,
-      std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+      std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
           platform_handles);
   void OnReadMessageForChannel(
       const MessageInTransit::View& message_view,
-      std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+      std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
           platform_handles);
 
   // Handles "attach and run endpoint" messages.
diff --git a/mojo/edk/system/channel_manager.cc b/mojo/edk/system/channel_manager.cc
index 134ae1d..370e59e 100644
--- a/mojo/edk/system/channel_manager.cc
+++ b/mojo/edk/system/channel_manager.cc
@@ -12,7 +12,7 @@
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/message_pipe_dispatcher.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::util::MakeRefCounted;
 using mojo::util::MutexLocker;
diff --git a/mojo/edk/system/channel_manager.h b/mojo/edk/system/channel_manager.h
index 82f95b3..77efea7 100644
--- a/mojo/edk/system/channel_manager.h
+++ b/mojo/edk/system/channel_manager.h
@@ -10,7 +10,7 @@
 #include <unordered_map>
 
 #include "base/callback_forward.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/edk/system/channel_id.h"
 #include "mojo/edk/util/mutex.h"
@@ -74,7 +74,7 @@
   // |ChannelManager|.
   util::RefPtr<MessagePipeDispatcher> CreateChannelOnIOThread(
       ChannelId channel_id,
-      embedder::ScopedPlatformHandle platform_handle);
+      platform::ScopedPlatformHandle platform_handle);
 
   // Like |CreateChannelOnIOThread()|, but doesn't create a bootstrap message
   // pipe. Returns the newly-created |Channel|.
@@ -82,7 +82,7 @@
   // general).
   util::RefPtr<Channel> CreateChannelWithoutBootstrapOnIOThread(
       ChannelId channel_id,
-      embedder::ScopedPlatformHandle platform_handle);
+      platform::ScopedPlatformHandle platform_handle);
 
   // Like |CreateChannelOnIOThread()|, but may be called from any thread. On
   // completion, will call |callback| (using |callback_thread_task_runner| if it
@@ -90,7 +90,7 @@
   // the I/O thread, even if called from that thread.
   util::RefPtr<MessagePipeDispatcher> CreateChannel(
       ChannelId channel_id,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       const base::Closure& callback,
       util::RefPtr<platform::TaskRunner>&& callback_thread_task_runner);
 
@@ -134,7 +134,7 @@
   // Returns the newly-created |Channel|.
   util::RefPtr<Channel> CreateChannelOnIOThreadHelper(
       ChannelId channel_id,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       util::RefPtr<ChannelEndpoint>&& bootstrap_channel_endpoint);
 
   // Used by |CreateChannel()|. Called on the I/O thread.
@@ -143,7 +143,7 @@
   // base::Bind.
   void CreateChannelHelper(
       ChannelId channel_id,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       util::RefPtr<ChannelEndpoint> bootstrap_channel_endpoint,
       const base::Closure& callback,
       util::RefPtr<platform::TaskRunner> callback_thread_task_runner);
diff --git a/mojo/edk/system/connection_manager.h b/mojo/edk/system/connection_manager.h
index 13d7584..914dd71 100644
--- a/mojo/edk/system/connection_manager.h
+++ b/mojo/edk/system/connection_manager.h
@@ -16,6 +16,9 @@
 
 namespace embedder {
 class PlatformSupport;
+}  // namespace embedder
+
+namespace platform {
 class ScopedPlatformHandle;
 }  // namespace embedder
 
@@ -106,7 +109,7 @@
   virtual Result Connect(const ConnectionIdentifier& connection_id,
                          ProcessIdentifier* peer_process_identifier,
                          bool* is_first,
-                         embedder::ScopedPlatformHandle* platform_handle) = 0;
+                         platform::ScopedPlatformHandle* platform_handle) = 0;
 
  protected:
   // |platform_support| must be valid and remain alive until after |Shutdown()|
diff --git a/mojo/edk/system/connection_manager_unittest.cc b/mojo/edk/system/connection_manager_unittest.cc
index a42eac9..4bb10d8 100644
--- a/mojo/edk/system/connection_manager_unittest.cc
+++ b/mojo/edk/system/connection_manager_unittest.cc
@@ -18,6 +18,7 @@
 #include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/edk/embedder/slave_process_delegate.h"
 #include "mojo/edk/platform/message_loop.h"
+#include "mojo/edk/platform/platform_handle.h"
 #include "mojo/edk/platform/test_message_loops.h"
 #include "mojo/edk/system/master_connection_manager.h"
 #include "mojo/edk/system/slave_connection_manager.h"
@@ -27,8 +28,9 @@
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
 using mojo::platform::MessageLoop;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::platform::test::CreateTestMessageLoop;
 using mojo::util::MakeRefCounted;
@@ -39,8 +41,8 @@
 namespace system {
 namespace {
 
-bool ArePlatformHandlesConnected(const embedder::PlatformHandle& h1,
-                                 const embedder::PlatformHandle& h2) {
+bool ArePlatformHandlesConnected(const PlatformHandle& h1,
+                                 const PlatformHandle& h2) {
   const uint32_t w1 = 0xdeadbeef;
   size_t num_bytes = 0;
   if (!mojo::test::BlockingWrite(h1, &w1, sizeof(w1), &num_bytes) ||
diff --git a/mojo/edk/system/data_pipe.cc b/mojo/edk/system/data_pipe.cc
index d3863df..f6830b6 100644
--- a/mojo/edk/system/data_pipe.cc
+++ b/mojo/edk/system/data_pipe.cc
@@ -25,7 +25,7 @@
 #include "mojo/edk/system/remote_producer_data_pipe_impl.h"
 #include "mojo/edk/util/make_unique.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeUnique;
 using mojo::util::MutexLocker;
 using mojo::util::RefPtr;
diff --git a/mojo/edk/system/data_pipe.h b/mojo/edk/system/data_pipe.h
index 866ad9d..30738e1 100644
--- a/mojo/edk/system/data_pipe.h
+++ b/mojo/edk/system/data_pipe.h
@@ -10,7 +10,7 @@
 #include <memory>
 #include <vector>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/channel_endpoint_client.h"
 #include "mojo/edk/system/handle_signals_state.h"
 #include "mojo/edk/system/memory.h"
@@ -124,7 +124,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+      std::vector<platform::ScopedPlatformHandle>* platform_handles);
   bool ProducerIsBusy() const;
 
   // These are called by the consumer dispatcher to implement its methods of
@@ -157,7 +157,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+      std::vector<platform::ScopedPlatformHandle>* platform_handles);
   bool ConsumerIsBusy() const;
 
   // The following are only to be used by |DataPipeImpl| (and its subclasses):
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
index b0101e3..a32e05e 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -10,7 +10,7 @@
 #include "mojo/edk/system/data_pipe.h"
 #include "mojo/edk/system/memory.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MutexLocker;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.h b/mojo/edk/system/data_pipe_consumer_dispatcher.h
index f650c7b..5880346 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.h
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.h
@@ -69,7 +69,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override
       MOJO_NOT_THREAD_SAFE;
   bool IsBusyNoLock() const override;
 
diff --git a/mojo/edk/system/data_pipe_impl.h b/mojo/edk/system/data_pipe_impl.h
index 4596a62..46682e5 100644
--- a/mojo/edk/system/data_pipe_impl.h
+++ b/mojo/edk/system/data_pipe_impl.h
@@ -10,7 +10,7 @@
 #include <utility>
 #include <vector>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/data_pipe.h"
 #include "mojo/edk/system/handle_signals_state.h"
 #include "mojo/edk/system/memory.h"
@@ -76,7 +76,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) = 0;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) = 0;
 
   virtual void ConsumerClose() = 0;
   // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|.
@@ -103,7 +103,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) = 0;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) = 0;
 
   virtual bool OnReadMessage(unsigned port, MessageInTransit* message) = 0;
   virtual void OnDetachFromChannel(unsigned port) = 0;
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index c08bd88..726f1bb 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -10,7 +10,7 @@
 #include "mojo/edk/system/data_pipe.h"
 #include "mojo/edk/system/memory.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MutexLocker;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.h b/mojo/edk/system/data_pipe_producer_dispatcher.h
index 6118449..daab3a9 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.h
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.h
@@ -69,7 +69,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override
       MOJO_NOT_THREAD_SAFE;
   bool IsBusyNoLock() const override;
 
diff --git a/mojo/edk/system/dispatcher.cc b/mojo/edk/system/dispatcher.cc
index 9433ccc..ed3ba08 100644
--- a/mojo/edk/system/dispatcher.cc
+++ b/mojo/edk/system/dispatcher.cc
@@ -12,7 +12,7 @@
 #include "mojo/edk/system/platform_handle_dispatcher.h"
 #include "mojo/edk/system/shared_buffer_dispatcher.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MutexLocker;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h
index b9bb895..c3c14f0 100644
--- a/mojo/edk/system/dispatcher.h
+++ b/mojo/edk/system/dispatcher.h
@@ -12,7 +12,7 @@
 #include <ostream>
 #include <vector>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/handle_signals_state.h"
 #include "mojo/edk/system/memory.h"
 #include "mojo/edk/util/mutex.h"
@@ -200,7 +200,7 @@
         Channel* channel,
         void* destination,
         size_t* actual_size,
-        std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+        std::vector<platform::ScopedPlatformHandle>* platform_handles);
 
     // Deserialization API.
     // Note: This "clears" (i.e., reset to the invalid handle) any platform
@@ -210,7 +210,7 @@
         int32_t type,
         const void* source,
         size_t size,
-        std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+        std::vector<platform::ScopedPlatformHandle>* platform_handles);
   };
 
  protected:
@@ -304,7 +304,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles)
+      std::vector<platform::ScopedPlatformHandle>* platform_handles)
       MOJO_NOT_THREAD_SAFE;
 
   // This should be overridden to return true if/when there's an ongoing
@@ -372,7 +372,7 @@
   bool EndSerializeAndClose(Channel* channel,
                             void* destination,
                             size_t* actual_size,
-                            std::vector<embedder::ScopedPlatformHandle>*
+                            std::vector<platform::ScopedPlatformHandle>*
                                 platform_handles) MOJO_NOT_THREAD_SAFE;
 
   // This protects the following members as well as any state added by
diff --git a/mojo/edk/system/ipc_support.cc b/mojo/edk/system/ipc_support.cc
index 0e0697c..5ff1168 100644
--- a/mojo/edk/system/ipc_support.cc
+++ b/mojo/edk/system/ipc_support.cc
@@ -15,7 +15,7 @@
 #include "mojo/edk/system/message_pipe_dispatcher.h"
 #include "mojo/edk/system/slave_connection_manager.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/ipc_support.h b/mojo/edk/system/ipc_support.h
index 40658d9..c1c2c00 100644
--- a/mojo/edk/system/ipc_support.h
+++ b/mojo/edk/system/ipc_support.h
@@ -10,8 +10,8 @@
 #include "base/callback_forward.h"
 #include "base/gtest_prod_util.h"
 #include "mojo/edk/embedder/process_type.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/embedder/slave_info.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/edk/system/channel_id.h"
 #include "mojo/edk/system/connection_identifier.h"
@@ -67,7 +67,7 @@
              util::RefPtr<platform::TaskRunner>&& delegate_thread_task_runner,
              embedder::ProcessDelegate* process_delegate,
              util::RefPtr<platform::TaskRunner>&& io_thread_task_runner,
-             embedder::ScopedPlatformHandle platform_handle);
+             platform::ScopedPlatformHandle platform_handle);
   // Note: This object must be shut down before destruction (see
   // |ShutdownOnIOThread()|).
   ~IPCSupport();
@@ -102,7 +102,7 @@
   util::RefPtr<MessagePipeDispatcher> ConnectToSlave(
       const ConnectionIdentifier& connection_id,
       embedder::SlaveInfo slave_info,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       const base::Closure& callback,
       util::RefPtr<platform::TaskRunner>&& callback_thread_task_runner,
       ChannelId* channel_id);
@@ -147,17 +147,17 @@
   // and slave) and creates a second OS "pipe" between the master and slave
   // (returning the master's handle). |*slave_process_identifier| will be set to
   // the process identifier assigned to the slave.
-  embedder::ScopedPlatformHandle ConnectToSlaveInternal(
+  platform::ScopedPlatformHandle ConnectToSlaveInternal(
       const ConnectionIdentifier& connection_id,
       embedder::SlaveInfo slave_info,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       ProcessIdentifier* slave_process_identifier);
 
   // Helper for |ConnectToMaster()|. Connects (using the connection manager) to
   // the master (using the handle to the OS "pipe" that was given to
   // |SlaveConnectionManager::Init()|) and creates a second OS "pipe" between
   // the master and slave (returning the slave's handle).
-  embedder::ScopedPlatformHandle ConnectToMasterInternal(
+  platform::ScopedPlatformHandle ConnectToMasterInternal(
       const ConnectionIdentifier& connection_id);
 
   ConnectionManager* connection_manager() const {
diff --git a/mojo/edk/system/ipc_support_unittest.cc b/mojo/edk/system/ipc_support_unittest.cc
index 25cf613..af986e9 100644
--- a/mojo/edk/system/ipc_support_unittest.cc
+++ b/mojo/edk/system/ipc_support_unittest.cc
@@ -31,7 +31,7 @@
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::AutoResetWaitableEvent;
 using mojo::util::ManualResetWaitableEvent;
 using mojo::util::RefPtr;
diff --git a/mojo/edk/system/local_data_pipe_impl.cc b/mojo/edk/system/local_data_pipe_impl.cc
index 3835ea7..3b11041 100644
--- a/mojo/edk/system/local_data_pipe_impl.cc
+++ b/mojo/edk/system/local_data_pipe_impl.cc
@@ -25,7 +25,7 @@
 #include "mojo/edk/system/remote_producer_data_pipe_impl.h"
 #include "mojo/edk/util/make_unique.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeUnique;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/local_data_pipe_impl.h b/mojo/edk/system/local_data_pipe_impl.h
index b4f513e..0374289 100644
--- a/mojo/edk/system/local_data_pipe_impl.h
+++ b/mojo/edk/system/local_data_pipe_impl.h
@@ -43,7 +43,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override;
   void ConsumerClose() override;
   MojoResult ConsumerReadData(UserPointer<void> elements,
                               UserPointer<uint32_t> num_bytes,
@@ -66,7 +66,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override;
   bool OnReadMessage(unsigned port, MessageInTransit* message) override;
   void OnDetachFromChannel(unsigned port) override;
 
diff --git a/mojo/edk/system/master_connection_manager.cc b/mojo/edk/system/master_connection_manager.cc
index d64ee63..af86373 100644
--- a/mojo/edk/system/master_connection_manager.cc
+++ b/mojo/edk/system/master_connection_manager.cc
@@ -16,8 +16,8 @@
 #include "base/message_loop/message_loop.h"
 #include "mojo/edk/embedder/master_process_delegate.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/connection_manager_messages.h"
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/raw_channel.h"
@@ -26,7 +26,8 @@
 #include "mojo/edk/util/waitable_event.h"
 #include "mojo/public/cpp/system/macros.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::util::AutoResetWaitableEvent;
 using mojo::util::MakeUnique;
@@ -293,7 +294,7 @@
     // Pending:
     if (pending_platform_handle) {
       pending_platform_handle->reset(it->second);
-      it->second = embedder::PlatformHandle();
+      it->second = PlatformHandle();
     }
     return ConnectionStatus::PENDING;
   }
@@ -306,7 +307,7 @@
 
     if (status == ConnectionStatus::RUNNING) {
       DCHECK(!pending_platform_handle.is_valid());
-      process_connections_[to_process_identifier] = embedder::PlatformHandle();
+      process_connections_[to_process_identifier] = PlatformHandle();
     } else if (status == ConnectionStatus::PENDING) {
       DCHECK(pending_platform_handle.is_valid());
       process_connections_[to_process_identifier] =
@@ -318,7 +319,7 @@
 
  private:
   // TODO(vtl): Make |second| |ScopedPlatformHandle|s.
-  std::unordered_map<ProcessIdentifier, embedder::PlatformHandle>
+  std::unordered_map<ProcessIdentifier, PlatformHandle>
       process_connections_;  // "Owns" any valid platform handles.
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(ProcessConnections);
diff --git a/mojo/edk/system/master_connection_manager.h b/mojo/edk/system/master_connection_manager.h
index 863b76b..1f4d4b7 100644
--- a/mojo/edk/system/master_connection_manager.h
+++ b/mojo/edk/system/master_connection_manager.h
@@ -10,7 +10,7 @@
 #include <unordered_map>
 
 #include "base/threading/thread.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/edk/system/connection_manager.h"
 #include "mojo/edk/util/mutex.h"
@@ -66,7 +66,7 @@
   // assuming proper shutdown. Returns the process identifier for the
   // newly-added slave.
   ProcessIdentifier AddSlave(embedder::SlaveInfo slave_info,
-                             embedder::ScopedPlatformHandle platform_handle);
+                             platform::ScopedPlatformHandle platform_handle);
 
   // Like |AddSlave()|, but allows a connection to be bootstrapped: both the
   // master and slave may call |Connect()| with |connection_id| immediately (as
@@ -76,7 +76,7 @@
   // tests.)
   ProcessIdentifier AddSlaveAndBootstrap(
       embedder::SlaveInfo slave_info,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       const ConnectionIdentifier& connection_id);
 
   // |ConnectionManager| methods:
@@ -86,7 +86,7 @@
   Result Connect(const ConnectionIdentifier& connection_id,
                  ProcessIdentifier* peer_process_identifier,
                  bool* is_first,
-                 embedder::ScopedPlatformHandle* platform_handle) override;
+                 platform::ScopedPlatformHandle* platform_handle) override;
 
  private:
   class Helper;
@@ -101,7 +101,7 @@
                      const ConnectionIdentifier& connection_id,
                      ProcessIdentifier* peer_process_identifier,
                      bool* is_first,
-                     embedder::ScopedPlatformHandle* platform_handle);
+                     platform::ScopedPlatformHandle* platform_handle);
 
   // Helper for |ConnectImpl()|. This is called when the two process identifiers
   // are known (and known to be valid), and all that remains is to determine the
@@ -110,14 +110,14 @@
   Result ConnectImplHelperNoLock(
       ProcessIdentifier process_identifier,
       ProcessIdentifier peer_process_identifier,
-      embedder::ScopedPlatformHandle* platform_handle)
+      platform::ScopedPlatformHandle* platform_handle)
       MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
 
   // These should only be called on |private_thread_|:
   void ShutdownOnPrivateThread() MOJO_NOT_THREAD_SAFE;
   // Signals |*event| on completion.
   void AddSlaveOnPrivateThread(embedder::SlaveInfo slave_info,
-                               embedder::ScopedPlatformHandle platform_handle,
+                               platform::ScopedPlatformHandle platform_handle,
                                ProcessIdentifier slave_process_identifier,
                                util::AutoResetWaitableEvent* event);
   // Called by |Helper::OnError()|.
diff --git a/mojo/edk/system/message_pipe.cc b/mojo/edk/system/message_pipe.cc
index 12239b0..26f93cb 100644
--- a/mojo/edk/system/message_pipe.cc
+++ b/mojo/edk/system/message_pipe.cc
@@ -19,7 +19,7 @@
 #include "mojo/edk/system/proxy_message_pipe_endpoint.h"
 #include "mojo/edk/util/make_unique.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeRefCounted;
 using mojo::util::MakeUnique;
 using mojo::util::MutexLocker;
diff --git a/mojo/edk/system/message_pipe.h b/mojo/edk/system/message_pipe.h
index 4e82e03..4f0b126 100644
--- a/mojo/edk/system/message_pipe.h
+++ b/mojo/edk/system/message_pipe.h
@@ -11,7 +11,7 @@
 #include <memory>
 #include <vector>
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/channel_endpoint_client.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/handle_signals_state.h"
@@ -114,7 +114,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+      std::vector<platform::ScopedPlatformHandle>* platform_handles);
 
   // |ChannelEndpointClient| methods:
   bool OnReadMessage(unsigned port, MessageInTransit* message) override;
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index cc400d5..7028cbe 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -14,7 +14,7 @@
 #include "mojo/edk/system/options_validation.h"
 #include "mojo/edk/system/proxy_message_pipe_endpoint.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/message_pipe_dispatcher.h b/mojo/edk/system/message_pipe_dispatcher.h
index a26fdf0..054fe0f 100644
--- a/mojo/edk/system/message_pipe_dispatcher.h
+++ b/mojo/edk/system/message_pipe_dispatcher.h
@@ -106,7 +106,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override
       MOJO_NOT_THREAD_SAFE;
 
   // This will be null if closed.
diff --git a/mojo/edk/system/message_pipe_perftest.cc b/mojo/edk/system/message_pipe_perftest.cc
index 92915d0..27394c6 100644
--- a/mojo/edk/system/message_pipe_perftest.cc
+++ b/mojo/edk/system/message_pipe_perftest.cc
@@ -10,7 +10,7 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/strings/stringprintf.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/local_message_pipe_endpoint.h"
 #include "mojo/edk/system/message_pipe.h"
 #include "mojo/edk/system/message_pipe_test_utils.h"
@@ -22,7 +22,7 @@
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/message_pipe_test_utils.cc b/mojo/edk/system/message_pipe_test_utils.cc
index d394b20..8d76c97 100644
--- a/mojo/edk/system/message_pipe_test_utils.cc
+++ b/mojo/edk/system/message_pipe_test_utils.cc
@@ -14,7 +14,7 @@
 #include "mojo/edk/system/test/timeouts.h"
 #include "mojo/edk/system/waiter.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeRefCounted;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/message_pipe_test_utils.h b/mojo/edk/system/message_pipe_test_utils.h
index 29bf709..cbd0b70 100644
--- a/mojo/edk/system/message_pipe_test_utils.h
+++ b/mojo/edk/system/message_pipe_test_utils.h
@@ -6,6 +6,7 @@
 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
 
 #include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/test/multiprocess_test_helper.h"
@@ -30,14 +31,14 @@
   explicit ChannelThread(embedder::PlatformSupport* platform_support);
   ~ChannelThread();
 
-  void Start(embedder::ScopedPlatformHandle platform_handle,
+  void Start(platform::ScopedPlatformHandle platform_handle,
              util::RefPtr<ChannelEndpoint>&& channel_endpoint);
   void Stop();
 
  private:
   // TODO(vtl): |channel_endpoint| should be an rvalue reference, but that
   // doesn't currently work correctly with base::Bind.
-  void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle,
+  void InitChannelOnIOThread(platform::ScopedPlatformHandle platform_handle,
                              util::RefPtr<ChannelEndpoint> channel_endpoint);
   void ShutdownChannelOnIOThread();
 
diff --git a/mojo/edk/system/multiprocess_message_pipe_unittest.cc b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
index e54bee8..71c1b5a 100644
--- a/mojo/edk/system/multiprocess_message_pipe_unittest.cc
+++ b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
@@ -15,7 +15,7 @@
 #include "base/logging.h"
 #include "build/build_config.h"  // TODO(vtl): Remove this.
 #include "mojo/edk/embedder/platform_shared_buffer.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/edk/system/message_pipe.h"
@@ -29,7 +29,7 @@
 #include "mojo/edk/util/scoped_file.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/platform_handle_dispatcher.cc b/mojo/edk/system/platform_handle_dispatcher.cc
index 7cb7110..aab08d7 100644
--- a/mojo/edk/system/platform_handle_dispatcher.cc
+++ b/mojo/edk/system/platform_handle_dispatcher.cc
@@ -9,7 +9,7 @@
 
 #include "base/logging.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MutexLocker;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/platform_handle_dispatcher.h b/mojo/edk/system/platform_handle_dispatcher.h
index 16ce340..426f0c3 100644
--- a/mojo/edk/system/platform_handle_dispatcher.h
+++ b/mojo/edk/system/platform_handle_dispatcher.h
@@ -5,7 +5,9 @@
 #ifndef MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
 #define MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
 
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include <vector>
+
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/simple_dispatcher.h"
 #include "mojo/edk/util/ref_ptr.h"
 #include "mojo/edk/util/thread_annotations.h"
@@ -19,11 +21,11 @@
 class PlatformHandleDispatcher final : public SimpleDispatcher {
  public:
   static util::RefPtr<PlatformHandleDispatcher> Create(
-      embedder::ScopedPlatformHandle platform_handle) {
+      platform::ScopedPlatformHandle platform_handle) {
     return AdoptRef(new PlatformHandleDispatcher(platform_handle.Pass()));
   }
 
-  embedder::ScopedPlatformHandle PassPlatformHandle();
+  platform::ScopedPlatformHandle PassPlatformHandle();
 
   // |Dispatcher| public methods:
   Type GetType() const override;
@@ -34,11 +36,11 @@
       Channel* channel,
       const void* source,
       size_t size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+      std::vector<platform::ScopedPlatformHandle>* platform_handles);
 
  private:
   explicit PlatformHandleDispatcher(
-      embedder::ScopedPlatformHandle platform_handle);
+      platform::ScopedPlatformHandle platform_handle);
   ~PlatformHandleDispatcher() override;
 
   // |Dispatcher| protected methods:
@@ -53,10 +55,10 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override
       MOJO_NOT_THREAD_SAFE;
 
-  embedder::ScopedPlatformHandle platform_handle_ MOJO_GUARDED_BY(mutex());
+  platform::ScopedPlatformHandle platform_handle_ MOJO_GUARDED_BY(mutex());
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformHandleDispatcher);
 };
diff --git a/mojo/edk/system/platform_handle_dispatcher_unittest.cc b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
index 6db55cb..bc33c06 100644
--- a/mojo/edk/system/platform_handle_dispatcher_unittest.cc
+++ b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
@@ -13,7 +13,7 @@
 #include "mojo/edk/util/scoped_file.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
index 3b83a67..19005c8 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -16,7 +16,8 @@
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/transport_data.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MutexLocker;
 
 namespace mojo {
@@ -75,7 +76,7 @@
 
 void RawChannel::WriteBuffer::GetPlatformHandlesToSend(
     size_t* num_platform_handles,
-    embedder::PlatformHandle** platform_handles,
+    PlatformHandle** platform_handles,
     void** serialization_data) {
   DCHECK(HavePlatformHandlesToSend());
 
@@ -85,7 +86,7 @@
       transport_data->platform_handles();
   *num_platform_handles =
       all_platform_handles->size() - platform_handles_offset_;
-  *platform_handles = reinterpret_cast<embedder::PlatformHandle*>(
+  *platform_handles = reinterpret_cast<PlatformHandle*>(
       &(*all_platform_handles)[platform_handles_offset_]);
 
   if (serialized_platform_handle_size_ > 0) {
diff --git a/mojo/edk/system/raw_channel.h b/mojo/edk/system/raw_channel.h
index f085120..03a3c88 100644
--- a/mojo/edk/system/raw_channel.h
+++ b/mojo/edk/system/raw_channel.h
@@ -9,7 +9,8 @@
 #include <vector>
 
 #include "base/memory/weak_ptr.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/message_in_transit_queue.h"
 #include "mojo/edk/util/mutex.h"
@@ -66,7 +67,7 @@
     // |Shutdown()| and then (if desired) destroy it.
     virtual void OnReadMessage(
         const MessageInTransit::View& message_view,
-        std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+        std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
             platform_handles) = 0;
 
     // Called when there's a (fatal) error. This may call the |RawChannel|'s
@@ -85,7 +86,7 @@
   // (platform-appropriate) bidirectional communication channel (e.g., a socket
   // on POSIX, a named pipe on Windows).
   static std::unique_ptr<RawChannel> Create(
-      embedder::ScopedPlatformHandle handle);
+      platform::ScopedPlatformHandle handle);
 
   // This must be called (on an I/O thread) before this object is used. Does
   // *not* take ownership of |delegate|. Both the I/O thread and |delegate| must
@@ -171,7 +172,7 @@
     // |PlatformHandle::CloseIfNecessary()| isn't const (and actually modifies
     // state).
     void GetPlatformHandlesToSend(size_t* num_platform_handles,
-                                  embedder::PlatformHandle** platform_handles,
+                                  platform::PlatformHandle** platform_handles,
                                   void** serialization_data);
 
     // Gets buffers to be written. These buffers will always come from the front
@@ -261,7 +262,7 @@
   // called when |num_platform_handles| is nonzero. Returns null if the
   // |num_platform_handles| handles are not available. Only called on the I/O
   // thread.
-  virtual std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+  virtual std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
   GetReadPlatformHandles(size_t num_platform_handles,
                          const void* platform_handle_table)
       MOJO_LOCKS_EXCLUDED(write_mutex_) = 0;
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
index 33b94e0..614e1d8 100644
--- a/mojo/edk/system/raw_channel_posix.cc
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -21,13 +21,14 @@
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "mojo/edk/embedder/platform_channel_utils.h"
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/transport_data.h"
 #include "mojo/edk/util/make_unique.h"
 #include "mojo/public/cpp/system/macros.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeUnique;
 using mojo::util::MutexLocker;
 
@@ -228,7 +229,7 @@
   size_t num_platform_handles = 0;
   ssize_t write_result;
   if (write_buffer_no_lock()->HavePlatformHandlesToSend()) {
-    embedder::PlatformHandle* platform_handles;
+    PlatformHandle* platform_handles;
     void* serialization_data;  // Actually unused.
     write_buffer_no_lock()->GetPlatformHandlesToSend(
         &num_platform_handles, &platform_handles, &serialization_data);
diff --git a/mojo/edk/system/raw_channel_unittest.cc b/mojo/edk/system/raw_channel_unittest.cc
index 5776b99..a73f530 100644
--- a/mojo/edk/system/raw_channel_unittest.cc
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -14,8 +14,8 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/test/random.h"
 #include "mojo/edk/system/test/scoped_test_dir.h"
@@ -31,7 +31,8 @@
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::AutoResetWaitableEvent;
 using mojo::util::MakeUnique;
 using mojo::util::Mutex;
@@ -64,7 +65,7 @@
   raw_channel->Init(delegate);
 }
 
-bool WriteTestMessageToHandle(const embedder::PlatformHandle& handle,
+bool WriteTestMessageToHandle(const PlatformHandle& handle,
                               uint32_t num_bytes) {
   std::unique_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
 
@@ -132,7 +133,7 @@
 
 class TestMessageReaderAndChecker {
  public:
-  explicit TestMessageReaderAndChecker(embedder::PlatformHandle handle)
+  explicit TestMessageReaderAndChecker(PlatformHandle handle)
       : handle_(handle) {}
   ~TestMessageReaderAndChecker() { CHECK(bytes_.empty()); }
 
@@ -186,7 +187,7 @@
   }
 
  private:
-  const embedder::PlatformHandle handle_;
+  const PlatformHandle handle_;
 
   // The start of the received data should always be on a message boundary.
   std::vector<unsigned char> bytes_;
diff --git a/mojo/edk/system/remote_consumer_data_pipe_impl.cc b/mojo/edk/system/remote_consumer_data_pipe_impl.cc
index a3bd83d..60cc009 100644
--- a/mojo/edk/system/remote_consumer_data_pipe_impl.cc
+++ b/mojo/edk/system/remote_consumer_data_pipe_impl.cc
@@ -18,7 +18,7 @@
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/remote_data_pipe_ack.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/remote_consumer_data_pipe_impl.h b/mojo/edk/system/remote_consumer_data_pipe_impl.h
index 4c8e8e8..3c8ff83 100644
--- a/mojo/edk/system/remote_consumer_data_pipe_impl.h
+++ b/mojo/edk/system/remote_consumer_data_pipe_impl.h
@@ -62,7 +62,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override;
   void ConsumerClose() override;
   MojoResult ConsumerReadData(UserPointer<void> elements,
                               UserPointer<uint32_t> num_bytes,
@@ -85,7 +85,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override;
   bool OnReadMessage(unsigned port, MessageInTransit* message) override;
   void OnDetachFromChannel(unsigned port) override;
 
diff --git a/mojo/edk/system/remote_message_pipe_unittest.cc b/mojo/edk/system/remote_message_pipe_unittest.cc
index ee3877e..560ae64 100644
--- a/mojo/edk/system/remote_message_pipe_unittest.cc
+++ b/mojo/edk/system/remote_message_pipe_unittest.cc
@@ -14,8 +14,8 @@
 #include "base/logging.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/edk/embedder/platform_shared_buffer.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/channel_endpoint.h"
 #include "mojo/edk/system/channel_endpoint_id.h"
@@ -36,7 +36,7 @@
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeRefCounted;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/system/remote_producer_data_pipe_impl.cc b/mojo/edk/system/remote_producer_data_pipe_impl.cc
index c473499..7c5741f 100644
--- a/mojo/edk/system/remote_producer_data_pipe_impl.cc
+++ b/mojo/edk/system/remote_producer_data_pipe_impl.cc
@@ -20,7 +20,7 @@
 #include "mojo/edk/system/remote_consumer_data_pipe_impl.h"
 #include "mojo/edk/system/remote_data_pipe_ack.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/remote_producer_data_pipe_impl.h b/mojo/edk/system/remote_producer_data_pipe_impl.h
index 0073814..6784a8f 100644
--- a/mojo/edk/system/remote_producer_data_pipe_impl.h
+++ b/mojo/edk/system/remote_producer_data_pipe_impl.h
@@ -63,7 +63,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override;
   void ConsumerClose() override;
   MojoResult ConsumerReadData(UserPointer<void> elements,
                               UserPointer<uint32_t> num_bytes,
@@ -86,7 +86,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override;
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override;
   bool OnReadMessage(unsigned port, MessageInTransit* message) override;
   void OnDetachFromChannel(unsigned port) override;
 
diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc
index 128708e..cd0ca58 100644
--- a/mojo/edk/system/shared_buffer_dispatcher.cc
+++ b/mojo/edk/system/shared_buffer_dispatcher.cc
@@ -15,7 +15,7 @@
 #include "mojo/edk/system/options_validation.h"
 #include "mojo/public/c/system/macros.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::RefPtr;
 
 namespace mojo {
diff --git a/mojo/edk/system/shared_buffer_dispatcher.h b/mojo/edk/system/shared_buffer_dispatcher.h
index bcb8279..72fce6d 100644
--- a/mojo/edk/system/shared_buffer_dispatcher.h
+++ b/mojo/edk/system/shared_buffer_dispatcher.h
@@ -59,7 +59,7 @@
       Channel* channel,
       const void* source,
       size_t size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles);
+      std::vector<platform::ScopedPlatformHandle>* platform_handles);
 
  private:
   static util::RefPtr<SharedBufferDispatcher> CreateInternal(
@@ -100,7 +100,7 @@
       Channel* channel,
       void* destination,
       size_t* actual_size,
-      std::vector<embedder::ScopedPlatformHandle>* platform_handles) override
+      std::vector<platform::ScopedPlatformHandle>* platform_handles) override
       MOJO_NOT_THREAD_SAFE;
 
   util::RefPtr<embedder::PlatformSharedBuffer> shared_buffer_
diff --git a/mojo/edk/system/slave_connection_manager.cc b/mojo/edk/system/slave_connection_manager.cc
index 0ed7c5d..2f842f4 100644
--- a/mojo/edk/system/slave_connection_manager.cc
+++ b/mojo/edk/system/slave_connection_manager.cc
@@ -15,7 +15,7 @@
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/util/make_unique.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::util::MakeUnique;
 using mojo::util::MutexLocker;
diff --git a/mojo/edk/system/slave_connection_manager.h b/mojo/edk/system/slave_connection_manager.h
index 951f1e1..8b3b7b2 100644
--- a/mojo/edk/system/slave_connection_manager.h
+++ b/mojo/edk/system/slave_connection_manager.h
@@ -8,8 +8,8 @@
 #include <memory>
 
 #include "base/threading/thread.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/embedder/slave_process_delegate.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/edk/system/connection_manager.h"
 #include "mojo/edk/system/raw_channel.h"
@@ -52,7 +52,7 @@
   // must stay alive at least until after |Shutdown()| has been called.
   void Init(util::RefPtr<platform::TaskRunner>&& delegate_thread_task_runner,
             embedder::SlaveProcessDelegate* slave_process_delegate,
-            embedder::ScopedPlatformHandle platform_handle);
+            platform::ScopedPlatformHandle platform_handle);
 
   // |ConnectionManager| methods:
   void Shutdown() override;
@@ -61,11 +61,11 @@
   Result Connect(const ConnectionIdentifier& connection_id,
                  ProcessIdentifier* peer_process_identifier,
                  bool* is_first,
-                 embedder::ScopedPlatformHandle* platform_handle) override;
+                 platform::ScopedPlatformHandle* platform_handle) override;
 
  private:
   // These should only be called on |private_thread_|:
-  void InitOnPrivateThread(embedder::ScopedPlatformHandle platform_handle);
+  void InitOnPrivateThread(platform::ScopedPlatformHandle platform_handle);
   void ShutdownOnPrivateThread();
   void AllowConnectOnPrivateThread(const ConnectionIdentifier& connection_id,
                                    Result* result);
@@ -75,12 +75,12 @@
                               Result* result,
                               ProcessIdentifier* peer_process_identifier,
                               bool* is_first,
-                              embedder::ScopedPlatformHandle* platform_handle);
+                              platform::ScopedPlatformHandle* platform_handle);
 
   // |RawChannel::Delegate| methods (only called on |private_thread_|):
   void OnReadMessage(
       const MessageInTransit::View& message_view,
-      std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+      std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
           platform_handles) override;
   void OnError(Error error) override;
 
@@ -119,7 +119,7 @@
   // Used only when waiting for the ack to "connect":
   ProcessIdentifier* ack_peer_process_identifier_;
   bool* ack_is_first_;
-  embedder::ScopedPlatformHandle* ack_platform_handle_;
+  platform::ScopedPlatformHandle* ack_platform_handle_;
 
   // The (synchronous) |ConnectionManager| methods are implemented in the
   // following way (T is any thread other than |private_thread_|):
diff --git a/mojo/edk/system/transport_data.cc b/mojo/edk/system/transport_data.cc
index 1f7d8ea..aa528e0 100644
--- a/mojo/edk/system/transport_data.cc
+++ b/mojo/edk/system/transport_data.cc
@@ -13,7 +13,7 @@
 #include "mojo/edk/system/configuration.h"
 #include "mojo/edk/system/message_in_transit.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 
 namespace mojo {
 namespace system {
diff --git a/mojo/edk/system/transport_data.h b/mojo/edk/system/transport_data.h
index 60a0821..0d5795f 100644
--- a/mojo/edk/system/transport_data.h
+++ b/mojo/edk/system/transport_data.h
@@ -11,7 +11,7 @@
 #include <vector>
 
 #include "base/memory/aligned_memory.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/system/dispatcher.h"
 #include "mojo/public/cpp/system/macros.h"
 
@@ -94,7 +94,7 @@
   // |Dispatcher|s. (|Header| will be present, and zero except for
   // |num_platform_handles|, and |platform_handle_table_offset| if necessary.)
   explicit TransportData(
-      std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+      std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
           platform_handles,
       size_t serialized_platform_handle_size);
 
@@ -110,10 +110,10 @@
 
   // Gets attached platform-specific handles; this may return null if there are
   // none. Note that the caller may mutate the set of platform-specific handles.
-  const std::vector<embedder::ScopedPlatformHandle>* platform_handles() const {
+  const std::vector<platform::ScopedPlatformHandle>* platform_handles() const {
     return platform_handles_.get();
   }
-  std::vector<embedder::ScopedPlatformHandle>* platform_handles() {
+  std::vector<platform::ScopedPlatformHandle>* platform_handles() {
     return platform_handles_.get();
   }
 
@@ -142,7 +142,7 @@
   static std::unique_ptr<DispatcherVector> DeserializeDispatchers(
       const void* buffer,
       size_t buffer_size,
-      std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+      std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
           platform_handles,
       Channel* channel);
 
@@ -180,7 +180,7 @@
   // transport). The vector (if any) owns the handles that it contains (and is
   // responsible for closing them).
   // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s.
-  std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>>
+  std::unique_ptr<std::vector<platform::ScopedPlatformHandle>>
       platform_handles_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(TransportData);
diff --git a/mojo/edk/test/multiprocess_test_helper.cc b/mojo/edk/test/multiprocess_test_helper.cc
index 2e9abdc..81df315 100644
--- a/mojo/edk/test/multiprocess_test_helper.cc
+++ b/mojo/edk/test/multiprocess_test_helper.cc
@@ -9,7 +9,7 @@
 #include "base/test/test_timeouts.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 
 namespace mojo {
 namespace test {
diff --git a/mojo/edk/test/multiprocess_test_helper.h b/mojo/edk/test/multiprocess_test_helper.h
index 5358eb4..aa76212 100644
--- a/mojo/edk/test/multiprocess_test_helper.h
+++ b/mojo/edk/test/multiprocess_test_helper.h
@@ -10,7 +10,7 @@
 
 #include "base/process/process.h"
 #include "base/test/multiprocess_test.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/multiprocess_func_list.h"
 
@@ -55,10 +55,10 @@
   static void ChildSetup();
 
   // For use in the main process:
-  embedder::ScopedPlatformHandle server_platform_handle;
+  platform::ScopedPlatformHandle server_platform_handle;
 
   // For use (and only valid) in the child process:
-  static embedder::ScopedPlatformHandle client_platform_handle;
+  static platform::ScopedPlatformHandle client_platform_handle;
 
  private:
   std::unique_ptr<embedder::PlatformChannelPair> platform_channel_pair_;
diff --git a/mojo/edk/test/multiprocess_test_helper_unittest.cc b/mojo/edk/test/multiprocess_test_helper_unittest.cc
index 1ec85a3..41793a4 100644
--- a/mojo/edk/test/multiprocess_test_helper_unittest.cc
+++ b/mojo/edk/test/multiprocess_test_helper_unittest.cc
@@ -8,27 +8,29 @@
 
 #include "base/logging.h"
 #include "build/build_config.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/test/test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 
 namespace mojo {
 namespace test {
 namespace {
 
-bool IsNonBlocking(const embedder::PlatformHandle& handle) {
+bool IsNonBlocking(const PlatformHandle& handle) {
   return fcntl(handle.fd, F_GETFL) & O_NONBLOCK;
 }
 
-bool WriteByte(const embedder::PlatformHandle& handle, char c) {
+bool WriteByte(const PlatformHandle& handle, char c) {
   size_t bytes_written = 0;
   BlockingWrite(handle, &c, 1, &bytes_written);
   return bytes_written == 1;
 }
 
-bool ReadByte(const embedder::PlatformHandle& handle, char* c) {
+bool ReadByte(const PlatformHandle& handle, char* c) {
   size_t bytes_read = 0;
   BlockingRead(handle, c, 1, &bytes_read);
   return bytes_read == 1;
diff --git a/mojo/edk/test/scoped_ipc_support.cc b/mojo/edk/test/scoped_ipc_support.cc
index df04214..39fb560 100644
--- a/mojo/edk/test/scoped_ipc_support.cc
+++ b/mojo/edk/test/scoped_ipc_support.cc
@@ -7,7 +7,7 @@
 #include "base/message_loop/message_loop.h"
 #include "mojo/edk/embedder/embedder.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 using mojo::platform::TaskRunner;
 using mojo::util::RefPtr;
 
diff --git a/mojo/edk/test/scoped_ipc_support.h b/mojo/edk/test/scoped_ipc_support.h
index 6a14584..7aec5b0 100644
--- a/mojo/edk/test/scoped_ipc_support.h
+++ b/mojo/edk/test/scoped_ipc_support.h
@@ -9,8 +9,8 @@
 #include "mojo/edk/embedder/master_process_delegate.h"
 #include "mojo/edk/embedder/process_delegate.h"
 #include "mojo/edk/embedder/process_type.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/embedder/slave_process_delegate.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/edk/util/ref_ptr.h"
 #include "mojo/edk/util/waitable_event.h"
@@ -29,7 +29,7 @@
   void Init(embedder::ProcessType process_type,
             embedder::ProcessDelegate* process_delegate,
             util::RefPtr<platform::TaskRunner>&& io_thread_task_runner,
-            embedder::ScopedPlatformHandle platform_handle);
+            platform::ScopedPlatformHandle platform_handle);
 
   void OnShutdownCompleteImpl();
 
@@ -93,10 +93,10 @@
  public:
   ScopedSlaveIPCSupport(
       util::RefPtr<platform::TaskRunner>&& io_thread_task_runner,
-      embedder::ScopedPlatformHandle platform_handle);
+      platform::ScopedPlatformHandle platform_handle);
   ScopedSlaveIPCSupport(
       util::RefPtr<platform::TaskRunner>&& io_thread_task_runner,
-      embedder::ScopedPlatformHandle platform_handle,
+      platform::ScopedPlatformHandle platform_handle,
       base::Closure on_master_disconnect);
   ~ScopedSlaveIPCSupport() override;
 
diff --git a/mojo/edk/test/test_utils.cc b/mojo/edk/test/test_utils.cc
index 153fa1c..a69079f 100644
--- a/mojo/edk/test/test_utils.cc
+++ b/mojo/edk/test/test_utils.cc
@@ -11,12 +11,13 @@
 #include "base/logging.h"
 #include "base/posix/eintr_wrapper.h"
 
-using mojo::embedder::ScopedPlatformHandle;
+using mojo::platform::PlatformHandle;
+using mojo::platform::ScopedPlatformHandle;
 
 namespace mojo {
 namespace test {
 
-bool BlockingWrite(const embedder::PlatformHandle& handle,
+bool BlockingWrite(const PlatformHandle& handle,
                    const void* buffer,
                    size_t bytes_to_write,
                    size_t* bytes_written) {
@@ -37,7 +38,7 @@
   return true;
 }
 
-bool BlockingRead(const embedder::PlatformHandle& handle,
+bool BlockingRead(const PlatformHandle& handle,
                   void* buffer,
                   size_t buffer_size,
                   size_t* bytes_read) {
@@ -58,7 +59,7 @@
   return true;
 }
 
-bool NonBlockingRead(const embedder::PlatformHandle& handle,
+bool NonBlockingRead(const PlatformHandle& handle,
                      void* buffer,
                      size_t buffer_size,
                      size_t* bytes_read) {
@@ -80,7 +81,7 @@
   CHECK(fp);
   int rv = dup(fileno(fp.get()));
   PCHECK(rv != -1) << "dup";
-  return ScopedPlatformHandle(embedder::PlatformHandle(rv));
+  return ScopedPlatformHandle(PlatformHandle(rv));
 }
 
 util::ScopedFILE FILEFromPlatformHandle(ScopedPlatformHandle h,
diff --git a/mojo/edk/test/test_utils.h b/mojo/edk/test/test_utils.h
index 72f9257..42aa55b 100644
--- a/mojo/edk/test/test_utils.h
+++ b/mojo/edk/test/test_utils.h
@@ -7,8 +7,8 @@
 
 #include <stddef.h>
 
-#include "mojo/edk/embedder/platform_handle.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/platform/platform_handle.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/util/scoped_file.h"
 
 namespace mojo {
@@ -16,14 +16,14 @@
 
 // On success, |bytes_written| is updated to the number of bytes written;
 // otherwise it is untouched.
-bool BlockingWrite(const embedder::PlatformHandle& handle,
+bool BlockingWrite(const platform::PlatformHandle& handle,
                    const void* buffer,
                    size_t bytes_to_write,
                    size_t* bytes_written);
 
 // On success, |bytes_read| is updated to the number of bytes read; otherwise it
 // is untouched.
-bool BlockingRead(const embedder::PlatformHandle& handle,
+bool BlockingRead(const platform::PlatformHandle& handle,
                   void* buffer,
                   size_t buffer_size,
                   size_t* bytes_read);
@@ -32,16 +32,16 @@
 // and updates |bytes_read| to the number of bytes read (0 if the read would
 // block); otherwise it returns false and leaves |bytes_read| untouched.
 // |handle| must already be in non-blocking mode.
-bool NonBlockingRead(const embedder::PlatformHandle& handle,
+bool NonBlockingRead(const platform::PlatformHandle& handle,
                      void* buffer,
                      size_t buffer_size,
                      size_t* bytes_read);
 
 // Gets a (scoped) |PlatformHandle| from the given (scoped) |FILE|.
-embedder::ScopedPlatformHandle PlatformHandleFromFILE(util::ScopedFILE fp);
+platform::ScopedPlatformHandle PlatformHandleFromFILE(util::ScopedFILE fp);
 
 // Gets a (scoped) |FILE| from a (scoped) |PlatformHandle|.
-util::ScopedFILE FILEFromPlatformHandle(embedder::ScopedPlatformHandle h,
+util::ScopedFILE FILEFromPlatformHandle(platform::ScopedPlatformHandle h,
                                         const char* mode);
 
 }  // namespace test
diff --git a/shell/child_main.cc b/shell/child_main.cc
index c31c8a0..e145f1c 100644
--- a/shell/child_main.cc
+++ b/shell/child_main.cc
@@ -23,9 +23,9 @@
 #include "mojo/edk/base_edk/platform_task_runner_impl.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/edk/embedder/slave_process_delegate.h"
+#include "mojo/edk/platform/scoped_platform_handle.h"
 #include "mojo/edk/platform/task_runner.h"
 #include "mojo/edk/util/ref_ptr.h"
 #include "mojo/message_pump/message_pump_mojo.h"
@@ -36,6 +36,7 @@
 #include "shell/init.h"
 #include "shell/native_application_support.h"
 
+using mojo::platform::ScopedPlatformHandle;
 using mojo::util::MakeRefCounted;
 using mojo::util::RefPtr;
 
@@ -97,7 +98,7 @@
       : io_thread_("io_thread"), controller_thread_("controller_thread") {}
   ~AppContext() override {}
 
-  void Init(mojo::embedder::ScopedPlatformHandle platform_handle) {
+  void Init(ScopedPlatformHandle platform_handle) {
     // Initialize Mojo before starting any threads.
     // TODO(vtl): Use make_unique when C++14 is available.
     mojo::embedder::Init(std::unique_ptr<mojo::embedder::PlatformSupport>(
@@ -304,7 +305,7 @@
 
   std::string platform_channel_info =
       command_line.GetSwitchValueASCII(switches::kPlatformChannelHandleInfo);
-  mojo::embedder::ScopedPlatformHandle platform_handle =
+  ScopedPlatformHandle platform_handle =
       mojo::embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
           platform_channel_info);
   CHECK(platform_handle.is_valid());
diff --git a/shell/child_process_host.h b/shell/child_process_host.h
index 2044564..0017379 100644
--- a/shell/child_process_host.h
+++ b/shell/child_process_host.h
@@ -13,7 +13,6 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/process/process.h"
 #include "mojo/edk/embedder/channel_info_forward.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "shell/child_controller.mojom.h"
 
 namespace shell {
diff --git a/shell/context.cc b/shell/context.cc
index 3ecfa97..de76e22 100644
--- a/shell/context.cc
+++ b/shell/context.cc
@@ -319,7 +319,7 @@
   mojo::embedder::InitIPCSupport(mojo::embedder::ProcessType::MASTER,
                                  task_runners_->shell_runner().Clone(), this,
                                  task_runners_->io_runner().Clone(),
-                                 mojo::embedder::ScopedPlatformHandle());
+                                 mojo::platform::ScopedPlatformHandle());
 
   scoped_ptr<NativeRunnerFactory> runner_factory;
   if (command_line.HasSwitch(switches::kEnableMultiprocess))