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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \ | 234 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \ |
235 (!defined(OS_MACOSX) || defined(OS_IOS)) | 235 (!defined(OS_MACOSX) || defined(OS_IOS)) |
236 bool FilePathForMemoryName(const std::string& mem_name, FilePath* path); | 236 bool FilePathForMemoryName(const std::string& mem_name, FilePath* path); |
237 #endif | 237 #endif |
238 | 238 |
239 #if defined(OS_WIN) | 239 #if defined(OS_WIN) |
240 // If true indicates this came from an external source so needs extra checks | 240 // If true indicates this came from an external source so needs extra checks |
241 // before being mapped. | 241 // before being mapped. |
242 bool external_section_; | 242 bool external_section_; |
243 std::wstring name_; | 243 std::wstring name_; |
244 win::ScopedHandle mapped_file_; | |
245 #else | 244 #else |
246 // The OS primitive that backs the shared memory region. | |
247 SharedMemoryHandle shm_; | |
248 | 245 |
249 // If valid, points to the same memory region as shm_, but with readonly | 246 // If valid, points to the same memory region as shm_, but with readonly |
250 // permissions. | 247 // permissions. |
251 SharedMemoryHandle readonly_shm_; | 248 SharedMemoryHandle readonly_shm_; |
252 #endif | 249 #endif |
253 | 250 |
254 #if defined(OS_MACOSX) && !defined(OS_IOS) | 251 #if defined(OS_MACOSX) && !defined(OS_IOS) |
255 // The mechanism by which the memory is mapped. Only valid if |memory_| is not | 252 // The mechanism by which the memory is mapped. Only valid if |memory_| is not |
256 // |nullptr|. | 253 // |nullptr|. |
257 SharedMemoryHandle::Type mapped_memory_mechanism_; | 254 SharedMemoryHandle::Type mapped_memory_mechanism_; |
258 #endif | 255 #endif |
259 | 256 |
| 257 // The OS primitive that backs the shared memory region. |
| 258 SharedMemoryHandle shm_; |
| 259 |
260 size_t mapped_size_; | 260 size_t mapped_size_; |
261 void* memory_; | 261 void* memory_; |
262 bool read_only_; | 262 bool read_only_; |
263 size_t requested_size_; | 263 size_t requested_size_; |
264 | 264 |
265 DISALLOW_COPY_AND_ASSIGN(SharedMemory); | 265 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
266 }; | 266 }; |
267 | 267 |
268 } // namespace base | 268 } // namespace base |
269 | 269 |
270 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 270 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
OLD | NEW |