| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Closes any open files. | 91 // Closes any open files. |
| 92 ~SharedMemory(); | 92 ~SharedMemory(); |
| 93 | 93 |
| 94 // Return true iff the given handle is valid (i.e. not the distingished | 94 // Return true iff the given handle is valid (i.e. not the distingished |
| 95 // invalid value; NULL for a HANDLE and -1 for a file descriptor) | 95 // invalid value; NULL for a HANDLE and -1 for a file descriptor) |
| 96 static bool IsHandleValid(const SharedMemoryHandle& handle); | 96 static bool IsHandleValid(const SharedMemoryHandle& handle); |
| 97 | 97 |
| 98 // Returns invalid handle (see comment above for exact definition). | 98 // Returns invalid handle (see comment above for exact definition). |
| 99 static SharedMemoryHandle NULLHandle(); | 99 static SharedMemoryHandle NULLHandle(); |
| 100 | 100 |
| 101 // Create and returns a copy of the SharedMemoryHandle passed. |
| 102 static SharedMemoryHandle DuplicateHandle(const SharedMemoryHandle& handle); |
| 103 |
| 101 // Closes a shared memory handle. | 104 // Closes a shared memory handle. |
| 102 static void CloseHandle(const SharedMemoryHandle& handle); | 105 static void CloseHandle(const SharedMemoryHandle& handle); |
| 103 | 106 |
| 104 // Returns the maximum number of handles that can be open at once per process. | 107 // Returns the maximum number of handles that can be open at once per process. |
| 105 static size_t GetHandleLimit(); | 108 static size_t GetHandleLimit(); |
| 106 | 109 |
| 107 // Creates a shared memory object as described by the options struct. | 110 // Creates a shared memory object as described by the options struct. |
| 108 // Returns true on success and false on failure. | 111 // Returns true on success and false on failure. |
| 109 bool Create(const SharedMemoryCreateOptions& options); | 112 bool Create(const SharedMemoryCreateOptions& options); |
| 110 | 113 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 275 } |
| 273 | 276 |
| 274 private: | 277 private: |
| 275 SharedMemory* shared_memory_; | 278 SharedMemory* shared_memory_; |
| 276 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLock); | 279 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLock); |
| 277 }; | 280 }; |
| 278 | 281 |
| 279 } // namespace base | 282 } // namespace base |
| 280 | 283 |
| 281 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 284 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
| OLD | NEW |