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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 enum ShareMode { | 275 enum ShareMode { |
276 SHARE_READONLY, | 276 SHARE_READONLY, |
277 SHARE_CURRENT_MODE, | 277 SHARE_CURRENT_MODE, |
278 }; | 278 }; |
279 bool ShareToProcessCommon(ProcessHandle process, | 279 bool ShareToProcessCommon(ProcessHandle process, |
280 SharedMemoryHandle* new_handle, | 280 SharedMemoryHandle* new_handle, |
281 bool close_self, | 281 bool close_self, |
282 ShareMode); | 282 ShareMode); |
283 | 283 |
284 #if defined(OS_WIN) | 284 #if defined(OS_WIN) |
| 285 // If true indicates this came from an external source so needs extra checks |
| 286 // before being mapped. |
| 287 bool external_section_; |
285 std::wstring name_; | 288 std::wstring name_; |
286 HANDLE mapped_file_; | 289 HANDLE mapped_file_; |
287 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 290 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
288 // The OS primitive that backs the shared memory region. | 291 // The OS primitive that backs the shared memory region. |
289 SharedMemoryHandle shm_; | 292 SharedMemoryHandle shm_; |
290 | 293 |
291 // The mechanism by which the memory is mapped. Only valid if |memory_| is not | 294 // The mechanism by which the memory is mapped. Only valid if |memory_| is not |
292 // |nullptr|. | 295 // |nullptr|. |
293 SharedMemoryHandle::Type mapped_memory_mechanism_; | 296 SharedMemoryHandle::Type mapped_memory_mechanism_; |
294 | 297 |
295 int readonly_mapped_file_; | 298 int readonly_mapped_file_; |
296 #elif defined(OS_POSIX) | 299 #elif defined(OS_POSIX) |
297 int mapped_file_; | 300 int mapped_file_; |
298 int readonly_mapped_file_; | 301 int readonly_mapped_file_; |
299 #endif | 302 #endif |
300 size_t mapped_size_; | 303 size_t mapped_size_; |
301 void* memory_; | 304 void* memory_; |
302 bool read_only_; | 305 bool read_only_; |
303 size_t requested_size_; | 306 size_t requested_size_; |
304 | 307 |
305 DISALLOW_COPY_AND_ASSIGN(SharedMemory); | 308 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
306 }; | 309 }; |
307 } // namespace base | 310 } // namespace base |
308 | 311 |
309 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 312 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
OLD | NEW |