Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2469)

Unified Diff: base/shared_memory_nacl.cc

Issue 11817020: Enable shared memory handle sharing in NaCl. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory_nacl.cc
diff --git a/base/shared_memory_nacl.cc b/base/shared_memory_nacl.cc
index fef293719ebc6b4898ac561d16f768b8d5f9366e..8d749867b49cc470b35ad7f7128cd35f593c97e6 100644
--- a/base/shared_memory_nacl.cc
+++ b/base/shared_memory_nacl.cc
@@ -137,7 +137,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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698