diff options
author | erikchen <erikchen@chromium.org> | 2015-06-01 19:16:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-02 02:16:59 +0000 |
commit | 4fc32d5dd347edbc0dfac470e7fa9b78b0923b72 (patch) | |
tree | 8b030e41e7b6acb07b6206ce35c4410ceb4608cc /content/ppapi_plugin | |
parent | 4ed27c2cd3fbcc606b494c1c7e69e3b1a12ab537 (diff) | |
download | chromium_src-4fc32d5dd347edbc0dfac470e7fa9b78b0923b72.zip chromium_src-4fc32d5dd347edbc0dfac470e7fa9b78b0923b72.tar.gz chromium_src-4fc32d5dd347edbc0dfac470e7fa9b78b0923b72.tar.bz2 |
Update pepper to not assume that SharedMemoryHandle is an int.
This CL is a refactor. This CL contains no intended behavior changes.
Pepper code assumes that SharedMemoryHandle is backed by a PlatformFile, and
that the relevant HANDLE or fd can be cast to an int. These assumptions will no
longer be true once SharedMemory is backed by Mach primitives on Mac.
This CL adds the method ShareSharedMemoryHandleWithRemote() to
ProxyChannel::Delegate. This method is used in place of ShareHandleWithRemote()
when a SharedMemory object is being shared between processes. This CL updates
the type of all SharedMemory handles to be SharedMemoryHandle.
BUG=466437
Review URL: https://codereview.chromium.org/1154613006
Cr-Commit-Position: refs/heads/master@{#332325}
Diffstat (limited to 'content/ppapi_plugin')
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.cc | 15 | ||||
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc index a02b64d..a0ed633 100644 --- a/content/ppapi_plugin/ppapi_thread.cc +++ b/content/ppapi_plugin/ppapi_thread.cc @@ -199,6 +199,21 @@ IPC::PlatformFileForTransit PpapiThread::ShareHandleWithRemote( return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source); } +base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote( + const base::SharedMemoryHandle& handle, + base::ProcessId remote_pid) { + base::PlatformFile local_platform_file = +#if defined(OS_POSIX) + handle.fd; +#elif defined(OS_WIN) + handle; +#else +#error Not implemented. +#endif + return PpapiThread::ShareHandleWithRemote(local_platform_file, remote_pid, + false); +} + std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() { return &globally_seen_instance_ids_; } diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h index 190cfd8..283b033 100644 --- a/content/ppapi_plugin/ppapi_thread.h +++ b/content/ppapi_plugin/ppapi_thread.h @@ -80,6 +80,9 @@ class PpapiThread : public ChildThreadImpl, base::PlatformFile handle, base::ProcessId peer_pid, bool should_close_source) override; + base::SharedMemoryHandle ShareSharedMemoryHandleWithRemote( + const base::SharedMemoryHandle& handle, + base::ProcessId remote_pid) override; uint32 Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher) override; void Unregister(uint32 plugin_dispatcher_id) override; |