OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <errno.h> | 7 #include <errno.h> |
8 #include <mach/mach_vm.h> | 8 #include <mach/mach_vm.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 Unmap(); | 102 Unmap(); |
103 Close(); | 103 Close(); |
104 } | 104 } |
105 | 105 |
106 // static | 106 // static |
107 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { | 107 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { |
108 return handle.IsValid(); | 108 return handle.IsValid(); |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 SharedMemoryHandle SharedMemory::NULLHandle() { | |
113 return SharedMemoryHandle(); | |
114 } | |
115 | |
116 // static | |
117 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { | 112 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { |
118 handle.Close(); | 113 handle.Close(); |
119 } | 114 } |
120 | 115 |
121 // static | 116 // static |
122 size_t SharedMemory::GetHandleLimit() { | 117 size_t SharedMemory::GetHandleLimit() { |
123 return GetMaxFds(); | 118 return GetMaxFds(); |
124 } | 119 } |
125 | 120 |
126 // static | 121 // static |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 ShareMode share_mode) { | 314 ShareMode share_mode) { |
320 bool success = Share(new_handle, share_mode); | 315 bool success = Share(new_handle, share_mode); |
321 if (close_self) { | 316 if (close_self) { |
322 Unmap(); | 317 Unmap(); |
323 Close(); | 318 Close(); |
324 } | 319 } |
325 return success; | 320 return success; |
326 } | 321 } |
327 | 322 |
328 } // namespace base | 323 } // namespace base |
OLD | NEW |