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

Side by Side Diff: base/memory/shared_memory_win.cc

Issue 1643253003: Add member ownership_passes_to_ipc_ to SharedMemoryHandle on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minimal test. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/shared_memory.h" 5 #include "base/memory/shared_memory.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 if (process == GetCurrentProcess() && close_self) { 300 if (process == GetCurrentProcess() && close_self) {
301 *new_handle = SharedMemoryHandle(mapped_file, base::GetCurrentProcId()); 301 *new_handle = SharedMemoryHandle(mapped_file, base::GetCurrentProcId());
302 return true; 302 return true;
303 } 303 }
304 304
305 if (!::DuplicateHandle(GetCurrentProcess(), mapped_file, process, &result, 305 if (!::DuplicateHandle(GetCurrentProcess(), mapped_file, process, &result,
306 access, FALSE, options)) { 306 access, FALSE, options)) {
307 return false; 307 return false;
308 } 308 }
309 *new_handle = SharedMemoryHandle(result, base::GetProcId(process)); 309 *new_handle = SharedMemoryHandle(result, base::GetProcId(process));
310 new_handle->SetOwnershipPassesToIPC(true);
310 return true; 311 return true;
311 } 312 }
312 313
313 314
314 void SharedMemory::Close() { 315 void SharedMemory::Close() {
315 if (mapped_file_ != NULL) { 316 if (mapped_file_ != NULL) {
316 ::CloseHandle(mapped_file_); 317 ::CloseHandle(mapped_file_);
317 mapped_file_ = NULL; 318 mapped_file_ = NULL;
318 } 319 }
319 } 320 }
320 321
321 SharedMemoryHandle SharedMemory::handle() const { 322 SharedMemoryHandle SharedMemory::handle() const {
322 return SharedMemoryHandle(mapped_file_, base::GetCurrentProcId()); 323 return SharedMemoryHandle(mapped_file_, base::GetCurrentProcId());
323 } 324 }
324 325
325 } // namespace base 326 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698