| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SHARED_MEMORY_H_ | 5 #ifndef BASE_SHARED_MEMORY_H_ |
| 6 #define BASE_SHARED_MEMORY_H_ | 6 #define BASE_SHARED_MEMORY_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Destructor. Will close any open files. | 54 // Destructor. Will close any open files. |
| 55 ~SharedMemory(); | 55 ~SharedMemory(); |
| 56 | 56 |
| 57 // Return true iff the given handle is valid (i.e. not the distingished | 57 // Return true iff the given handle is valid (i.e. not the distingished |
| 58 // invalid value; NULL for a HANDLE and -1 for a file descriptor) | 58 // invalid value; NULL for a HANDLE and -1 for a file descriptor) |
| 59 static bool IsHandleValid(const SharedMemoryHandle& handle); | 59 static bool IsHandleValid(const SharedMemoryHandle& handle); |
| 60 | 60 |
| 61 // Return invalid handle (see comment above for exact definition). | 61 // Return invalid handle (see comment above for exact definition). |
| 62 static SharedMemoryHandle NULLHandle(); | 62 static SharedMemoryHandle NULLHandle(); |
| 63 | 63 |
| 64 // Close a shared memory handle. |
| 65 static void CloseHandle(const SharedMemoryHandle& handle); |
| 66 |
| 64 // Creates or opens a shared memory segment based on a name. | 67 // Creates or opens a shared memory segment based on a name. |
| 65 // If read_only is true, opens the memory as read-only. | 68 // If read_only is true, opens the memory as read-only. |
| 66 // If open_existing is true, and the shared memory already exists, | 69 // If open_existing is true, and the shared memory already exists, |
| 67 // opens the existing shared memory and ignores the size parameter. | 70 // opens the existing shared memory and ignores the size parameter. |
| 68 // If name is the empty string, use a unique name. | 71 // If name is the empty string, use a unique name. |
| 69 // Returns true on success, false on failure. | 72 // Returns true on success, false on failure. |
| 70 bool Create(const std::wstring& name, bool read_only, bool open_existing, | 73 bool Create(const std::wstring& name, bool read_only, bool open_existing, |
| 71 size_t size); | 74 size_t size); |
| 72 | 75 |
| 73 // Deletes resources associated with a shared memory segment based on name. | 76 // Deletes resources associated with a shared memory segment based on name. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 200 } |
| 198 | 201 |
| 199 private: | 202 private: |
| 200 SharedMemory* shared_memory_; | 203 SharedMemory* shared_memory_; |
| 201 DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock); | 204 DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock); |
| 202 }; | 205 }; |
| 203 | 206 |
| 204 } // namespace base | 207 } // namespace base |
| 205 | 208 |
| 206 #endif // BASE_SHARED_MEMORY_H_ | 209 #endif // BASE_SHARED_MEMORY_H_ |
| OLD | NEW |