OLD | NEW |
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 | 373 |
374 void SharedMemory::Close() { | 374 void SharedMemory::Close() { |
375 mapped_file_.Close(); | 375 mapped_file_.Close(); |
376 } | 376 } |
377 | 377 |
378 SharedMemoryHandle SharedMemory::handle() const { | 378 SharedMemoryHandle SharedMemory::handle() const { |
379 return SharedMemoryHandle(mapped_file_.Get(), base::GetCurrentProcId()); | 379 return SharedMemoryHandle(mapped_file_.Get(), base::GetCurrentProcId()); |
380 } | 380 } |
381 | 381 |
| 382 SharedMemoryHandle SharedMemory::TakeHandle() { |
| 383 SharedMemoryHandle handle(mapped_file_.Take(), base::GetCurrentProcId()); |
| 384 handle.SetOwnershipPassesToIPC(true); |
| 385 memory_ = nullptr; |
| 386 mapped_size_ = 0; |
| 387 return handle; |
| 388 } |
| 389 |
382 } // namespace base | 390 } // namespace base |
OLD | NEW |