| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static SharedMemoryHandle NULLHandle(); | 72 static SharedMemoryHandle NULLHandle(); |
| 73 | 73 |
| 74 // Closes a shared memory handle. | 74 // Closes a shared memory handle. |
| 75 static void CloseHandle(const SharedMemoryHandle& handle); | 75 static void CloseHandle(const SharedMemoryHandle& handle); |
| 76 | 76 |
| 77 // Creates and maps an anonymous shared memory segment of size size. | 77 // Creates and maps an anonymous shared memory segment of size size. |
| 78 // Returns true on success and false on failure. | 78 // Returns true on success and false on failure. |
| 79 bool CreateAndMapAnonymous(uint32 size); | 79 bool CreateAndMapAnonymous(uint32 size); |
| 80 | 80 |
| 81 // Creates an anonymous shared memory segment of size size. | 81 // Creates an anonymous shared memory segment of size size. |
| 82 // If executable is true, mappings might need to be made executable later. |
| 82 // Returns true on success and false on failure. | 83 // Returns true on success and false on failure. |
| 83 bool CreateAnonymous(uint32 size); | 84 bool CreateAnonymous(uint32 size, bool executable); |
| 84 | 85 |
| 85 // Creates or opens a shared memory segment based on a name. | 86 // Creates or opens a shared memory segment based on a name. |
| 86 // If open_existing is true, and the shared memory already exists, | 87 // If open_existing is true, and the shared memory already exists, |
| 87 // opens the existing shared memory and ignores the size parameter. | 88 // opens the existing shared memory and ignores the size parameter. |
| 88 // If open_existing is false, shared memory must not exist. | 89 // If open_existing is false, shared memory must not exist. |
| 89 // size is the size of the block to be created. | 90 // size is the size of the block to be created. |
| 91 // If executable is true, mappings might need to be made executable later. |
| 90 // Returns true on success, false on failure. | 92 // Returns true on success, false on failure. |
| 91 bool CreateNamed(const std::string& name, bool open_existing, uint32 size); | 93 bool CreateNamed(const std::string& name, bool open_existing, |
| 94 uint32 size, bool executable); |
| 92 | 95 |
| 93 // Deletes resources associated with a shared memory segment based on name. | 96 // Deletes resources associated with a shared memory segment based on name. |
| 94 // Not all platforms require this call. | 97 // Not all platforms require this call. |
| 95 bool Delete(const std::string& name); | 98 bool Delete(const std::string& name); |
| 96 | 99 |
| 97 // Opens a shared memory segment based on a name. | 100 // Opens a shared memory segment based on a name. |
| 98 // If read_only is true, opens for read-only access. | 101 // If read_only is true, opens for read-only access. |
| 99 // Returns true on success, false on failure. | 102 // Returns true on success, false on failure. |
| 100 bool Open(const std::string& name, bool read_only); | 103 bool Open(const std::string& name, bool read_only); |
| 101 | 104 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 229 } |
| 227 | 230 |
| 228 private: | 231 private: |
| 229 SharedMemory* shared_memory_; | 232 SharedMemory* shared_memory_; |
| 230 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLock); | 233 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLock); |
| 231 }; | 234 }; |
| 232 | 235 |
| 233 } // namespace base | 236 } // namespace base |
| 234 | 237 |
| 235 #endif // BASE_SHARED_MEMORY_H_ | 238 #endif // BASE_SHARED_MEMORY_H_ |
| OLD | NEW |