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

Unified Diff: base/memory/shared_memory_win.cc

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 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 | « base/memory/shared_memory_posix.cc ('k') | base/message_loop/incoming_task_queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_win.cc
diff --git a/base/memory/shared_memory_win.cc b/base/memory/shared_memory_win.cc
index 7e0cf0bf23e67f0d13d22e56e0924cecda7456ce..eacf0d6ccefcd97bd42d6758d4c99597d41f1730 100644
--- a/base/memory/shared_memory_win.cc
+++ b/base/memory/shared_memory_win.cc
@@ -100,6 +100,18 @@ size_t SharedMemory::GetHandleLimit() {
return static_cast<size_t>(1 << 23);
}
+// static
+SharedMemoryHandle SharedMemory::DuplicateHandle(
+ const SharedMemoryHandle& handle) {
+ ProcessHandle process = GetCurrentProcess();
+ SharedMemoryHandle duped_handle;
+ BOOL success = ::DuplicateHandle(process, handle, process, &duped_handle, 0,
+ FALSE, DUPLICATE_SAME_ACCESS);
+ if (success)
+ return duped_handle;
+ return NULLHandle();
+}
+
bool SharedMemory::CreateAndMapAnonymous(size_t size) {
return CreateAnonymous(size) && Map(size);
}
@@ -242,9 +254,10 @@ bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
return true;
}
- if (!DuplicateHandle(GetCurrentProcess(), mapped_file, process,
- &result, access, FALSE, options))
+ if (!::DuplicateHandle(GetCurrentProcess(), mapped_file, process, &result,
+ access, FALSE, options)) {
return false;
+ }
*new_handle = result;
return true;
}
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | base/message_loop/incoming_task_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698