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 #ifndef BASE_MEMORY_SHARED_MEMORY_H_ | 5 #ifndef BASE_MEMORY_SHARED_MEMORY_H_ |
6 #define BASE_MEMORY_SHARED_MEMORY_H_ | 6 #define BASE_MEMORY_SHARED_MEMORY_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 bool CreateAndMapAnonymous(size_t size); | 133 bool CreateAndMapAnonymous(size_t size); |
134 | 134 |
135 #if defined(OS_MACOSX) && !defined(OS_IOS) | 135 #if defined(OS_MACOSX) && !defined(OS_IOS) |
136 // These two methods are analogs of CreateAndMapAnonymous and CreateAnonymous | 136 // These two methods are analogs of CreateAndMapAnonymous and CreateAnonymous |
137 // that force the underlying OS primitive to be a POSIX fd. Do not add new | 137 // that force the underlying OS primitive to be a POSIX fd. Do not add new |
138 // uses of these methods unless absolutely necessary, since constructing a | 138 // uses of these methods unless absolutely necessary, since constructing a |
139 // fd-backed SharedMemory object frequently takes 100ms+. | 139 // fd-backed SharedMemory object frequently takes 100ms+. |
140 // http://crbug.com/466437. | 140 // http://crbug.com/466437. |
141 bool CreateAndMapAnonymousPosix(size_t size); | 141 bool CreateAndMapAnonymousPosix(size_t size); |
142 bool CreateAnonymousPosix(size_t size); | 142 bool CreateAnonymousPosix(size_t size); |
| 143 |
| 144 // This method is an analog of CreateAndMapAnonymous that forces the |
| 145 // underlying OS primitive to be a Mach memory object. |
| 146 bool CreateAndMapAnonymousMach(size_t size); |
143 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 147 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
144 | 148 |
145 // Creates an anonymous shared memory segment of size size. | 149 // Creates an anonymous shared memory segment of size size. |
146 // Returns true on success and false on failure. | 150 // Returns true on success and false on failure. |
147 bool CreateAnonymous(size_t size) { | 151 bool CreateAnonymous(size_t size) { |
148 SharedMemoryCreateOptions options; | 152 SharedMemoryCreateOptions options; |
149 options.size = size; | 153 options.size = size; |
150 return Create(options); | 154 return Create(options); |
151 } | 155 } |
152 | 156 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 size_t mapped_size_; | 304 size_t mapped_size_; |
301 void* memory_; | 305 void* memory_; |
302 bool read_only_; | 306 bool read_only_; |
303 size_t requested_size_; | 307 size_t requested_size_; |
304 | 308 |
305 DISALLOW_COPY_AND_ASSIGN(SharedMemory); | 309 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
306 }; | 310 }; |
307 } // namespace base | 311 } // namespace base |
308 | 312 |
309 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 313 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
OLD | NEW |