Index: base/memory/shared_memory_win.cc |
diff --git a/base/memory/shared_memory_win.cc b/base/memory/shared_memory_win.cc |
index 881e0609378565e4386234ff2a60347a68296d63..ffa7bd72bd1530d3f3180de8c73f328fc1663d24 100644 |
--- a/base/memory/shared_memory_win.cc |
+++ b/base/memory/shared_memory_win.cc |
@@ -185,18 +185,7 @@ size_t SharedMemory::GetHandleLimit() { |
// static |
SharedMemoryHandle SharedMemory::DuplicateHandle( |
const SharedMemoryHandle& handle) { |
- DCHECK(handle.BelongsToCurrentProcess()); |
- HANDLE duped_handle; |
- ProcessHandle process = GetCurrentProcess(); |
- BOOL success = |
- ::DuplicateHandle(process, handle.GetHandle(), process, &duped_handle, 0, |
- FALSE, DUPLICATE_SAME_ACCESS); |
- if (success) { |
- base::SharedMemoryHandle handle(duped_handle, GetCurrentProcId()); |
- handle.SetOwnershipPassesToIPC(true); |
- return handle; |
- } |
- return SharedMemoryHandle(); |
+ return handle.Duplicate(); |
} |
bool SharedMemory::CreateAndMapAnonymous(size_t size) { |
@@ -352,8 +341,7 @@ SharedMemoryHandle SharedMemory::GetReadOnlyHandle() { |
} |
bool SharedMemory::ShareToProcessCommon(ProcessHandle process, |
- SharedMemoryHandle* new_handle, |
- bool close_self) { |
+ SharedMemoryHandle* new_handle) { |
*new_handle = SharedMemoryHandle(); |
DWORD access = FILE_MAP_READ | SECTION_QUERY; |
DWORD options = 0; |
@@ -361,18 +349,6 @@ bool SharedMemory::ShareToProcessCommon(ProcessHandle process, |
HANDLE result; |
if (!read_only_) |
access |= FILE_MAP_WRITE; |
- if (close_self) { |
- // DUPLICATE_CLOSE_SOURCE causes DuplicateHandle to close mapped_file. |
- options = DUPLICATE_CLOSE_SOURCE; |
- HANDLE detached_handle = mapped_file_.Take(); |
- DCHECK_EQ(detached_handle, mapped_file); |
- Unmap(); |
- } |
- |
- if (process == GetCurrentProcess() && close_self) { |
- *new_handle = SharedMemoryHandle(mapped_file, base::GetCurrentProcId()); |
- return true; |
- } |
if (!::DuplicateHandle(GetCurrentProcess(), mapped_file, process, &result, |
access, FALSE, options)) { |