| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SharedMemory(SharedMemoryHandle handle, bool read_only, | 51 SharedMemory(SharedMemoryHandle handle, bool read_only, |
| 52 base::ProcessHandle process); | 52 base::ProcessHandle process); |
| 53 | 53 |
| 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). |
| 62 static SharedMemoryHandle NULLHandle(); |
| 63 |
| 61 // Creates or opens a shared memory segment based on a name. | 64 // Creates or opens a shared memory segment based on a name. |
| 62 // If read_only is true, opens the memory as read-only. | 65 // If read_only is true, opens the memory as read-only. |
| 63 // If open_existing is true, and the shared memory already exists, | 66 // If open_existing is true, and the shared memory already exists, |
| 64 // opens the existing shared memory and ignores the size parameter. | 67 // opens the existing shared memory and ignores the size parameter. |
| 65 // If name is the empty string, use a unique name. | 68 // If name is the empty string, use a unique name. |
| 66 // Returns true on success, false on failure. | 69 // Returns true on success, false on failure. |
| 67 bool Create(const std::wstring& name, bool read_only, bool open_existing, | 70 bool Create(const std::wstring& name, bool read_only, bool open_existing, |
| 68 size_t size); | 71 size_t size); |
| 69 | 72 |
| 70 // Deletes resources associated with a shared memory segment based on name. | 73 // Deletes resources associated with a shared memory segment based on name. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 197 } |
| 195 | 198 |
| 196 private: | 199 private: |
| 197 SharedMemory* shared_memory_; | 200 SharedMemory* shared_memory_; |
| 198 DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock); | 201 DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 } // namespace base | 204 } // namespace base |
| 202 | 205 |
| 203 #endif // BASE_SHARED_MEMORY_H_ | 206 #endif // BASE_SHARED_MEMORY_H_ |
| OLD | NEW |