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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // When opening an existing object, this has no effect. | 56 // When opening an existing object, this has no effect. |
57 size_t size = 0; | 57 size_t size = 0; |
58 | 58 |
59 // If true, mappings might need to be made executable later. | 59 // If true, mappings might need to be made executable later. |
60 bool executable = false; | 60 bool executable = false; |
61 | 61 |
62 // If true, the file can be shared read-only to a process. | 62 // If true, the file can be shared read-only to a process. |
63 bool share_read_only = false; | 63 bool share_read_only = false; |
64 }; | 64 }; |
65 | 65 |
66 // Platform abstraction for shared memory. Provides a C++ wrapper | 66 // Platform abstraction for shared memory. |
67 // around the OS primitive for a memory mapped file. | 67 // SharedMemory consumes a SharedMemoryHandle [potentially one that it created] |
| 68 // to map a shared memory OS resource into the virtual address space of the |
| 69 // current process. |
68 class BASE_EXPORT SharedMemory { | 70 class BASE_EXPORT SharedMemory { |
69 public: | 71 public: |
70 SharedMemory(); | 72 SharedMemory(); |
71 | 73 |
72 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
73 // Similar to the default constructor, except that this allows for | 75 // Similar to the default constructor, except that this allows for |
74 // calling LockDeprecated() to acquire the named mutex before either Create or | 76 // calling LockDeprecated() to acquire the named mutex before either Create or |
75 // Open are called on Windows. | 77 // Open are called on Windows. |
76 explicit SharedMemory(const std::wstring& name); | 78 explicit SharedMemory(const std::wstring& name); |
77 #endif | 79 #endif |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 void* memory_; | 263 void* memory_; |
262 bool read_only_; | 264 bool read_only_; |
263 size_t requested_size_; | 265 size_t requested_size_; |
264 | 266 |
265 DISALLOW_COPY_AND_ASSIGN(SharedMemory); | 267 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
266 }; | 268 }; |
267 | 269 |
268 } // namespace base | 270 } // namespace base |
269 | 271 |
270 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 272 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
OLD | NEW |