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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 SharedMemoryHandle handle() const; | 193 SharedMemoryHandle handle() const; |
194 | 194 |
195 #if defined(OS_POSIX) && !defined(OS_NACL) | 195 #if defined(OS_POSIX) && !defined(OS_NACL) |
196 // Returns a unique identifier for this shared memory segment. Inode numbers | 196 // Returns a unique identifier for this shared memory segment. Inode numbers |
197 // are technically only unique to a single filesystem. However, we always | 197 // are technically only unique to a single filesystem. However, we always |
198 // allocate shared memory backing files from the same directory, so will end | 198 // allocate shared memory backing files from the same directory, so will end |
199 // up on the same filesystem. | 199 // up on the same filesystem. |
200 SharedMemoryId id() const { return inode_; } | 200 SharedMemoryId id() const { return inode_; } |
201 #endif | 201 #endif |
202 | 202 |
203 // Closes the open shared memory segment. | 203 // Closes the open shared memory segment. The memory will remain mapped if |
| 204 // it was previously mapped. |
204 // It is safe to call Close repeatedly. | 205 // It is safe to call Close repeatedly. |
205 void Close(); | 206 void Close(); |
206 | 207 |
207 // Shares the shared memory to another process. Attempts to create a | 208 // Shares the shared memory to another process. Attempts to create a |
208 // platform-specific new_handle which can be used in a remote process to read | 209 // platform-specific new_handle which can be used in a remote process to read |
209 // the shared memory file. new_handle is an output parameter to receive the | 210 // the shared memory file. new_handle is an output parameter to receive the |
210 // handle for use in the remote process. | 211 // handle for use in the remote process. |
211 // | 212 // |
212 // |*this| must have been initialized using one of the Create*() or Open() | 213 // |*this| must have been initialized using one of the Create*() or Open() |
213 // methods with share_read_only=true. If it was constructed from a | 214 // methods with share_read_only=true. If it was constructed from a |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 317 } |
317 | 318 |
318 private: | 319 private: |
319 SharedMemory* shared_memory_; | 320 SharedMemory* shared_memory_; |
320 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLockDeprecated); | 321 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLockDeprecated); |
321 }; | 322 }; |
322 | 323 |
323 } // namespace base | 324 } // namespace base |
324 | 325 |
325 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 326 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
OLD | NEW |