Commit 52d1b4e3 authored by teravest@chromium.org's avatar teravest@chromium.org

Enable shared memory handle sharing in NaCl.

The destructor for base::SharedMemory closes its handle on destruction.
To keep a shared memory region alive after using it, we need to
duplicate the handle. This uses dup(), which is available in native
client.

BUG=


Review URL: https://chromiumcodereview.appspot.com/11817020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176133 0039d316-1c4b-4281-b951-d872f2087c98
parent f884f308
......@@ -142,7 +142,18 @@ void SharedMemory::Unlock() {
bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
SharedMemoryHandle *new_handle,
bool close_self) {
return false;
const int new_fd = dup(mapped_file_);
if (new_fd < 0) {
DPLOG(ERROR) << "dup() failed.";
return false;
}
new_handle->fd = new_fd;
new_handle->auto_close = true;
if (close_self)
Close();
return true;
}
} // namespace base
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment