ppapi: Add methods for sharing new shared memory classes with remote

This CL adds two new methods, ShareUnsafeSharedMemoryRegionWithRemote() and
ShareReadOnlySharedMemoryRegionWithRemote() to
ppapi::proxy::ProxyChannel::Delegate and to content::RendererPpapiHost classes
and all implementation classes.

These new methods are similar to the SharedSharedMemoryHandleWithRemote()
method in those classes but are supposed to work with the new shared memory
API.

Bug: 845985
Change-Id: I8ccd92a1c81dca9495c85119e9a4e40fd6b69abf
Reviewed-on: https://chromium-review.googlesource.com/1078847
Commit-Queue: Alexandr Ilin <[email protected]>
Reviewed-by: Antoine Labour <[email protected]>
Reviewed-by: Raymes Khoury <[email protected]>
Cr-Commit-Position: refs/heads/master@{#563571}
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index 8a6af71e..ca41f58 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -9,7 +9,9 @@
 
 #include "base/files/scoped_file.h"
 #include "base/macros.h"
+#include "base/memory/read_only_shared_memory_region.h"
 #include "base/memory/shared_memory.h"
+#include "base/memory/unsafe_shared_memory_region.h"
 #include "base/process/process.h"
 #include "build/build_config.h"
 #include "ipc/ipc_listener.h"
@@ -63,6 +65,14 @@
     virtual base::SharedMemoryHandle ShareSharedMemoryHandleWithRemote(
         const base::SharedMemoryHandle& handle,
         base::ProcessId remote_pid) = 0;
+    virtual base::UnsafeSharedMemoryRegion
+    ShareUnsafeSharedMemoryRegionWithRemote(
+        const base::UnsafeSharedMemoryRegion& region,
+        base::ProcessId remote_pid) = 0;
+    virtual base::ReadOnlySharedMemoryRegion
+    ShareReadOnlySharedMemoryRegionWithRemote(
+        const base::ReadOnlySharedMemoryRegion& region,
+        base::ProcessId remote_pid) = 0;
   };
 
   ~ProxyChannel() override;
@@ -90,6 +100,10 @@
   // is not closed by this operation.
   base::SharedMemoryHandle ShareSharedMemoryHandleWithRemote(
       const base::SharedMemoryHandle& handle);
+  base::UnsafeSharedMemoryRegion ShareUnsafeSharedMemoryRegionWithRemote(
+      const base::UnsafeSharedMemoryRegion& region);
+  base::ReadOnlySharedMemoryRegion ShareReadOnlySharedMemoryRegionWithRemote(
+      const base::ReadOnlySharedMemoryRegion& region);
 
   // IPC::Sender implementation.
   bool Send(IPC::Message* msg) override;