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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 | 123 |
124 #if defined(OS_POSIX) | 124 #if defined(OS_POSIX) |
125 // The underlying OS primitives are duplicated. | 125 // The underlying OS primitives are duplicated. |
126 // |clean_up_resources_on_destruction| indicates whether the underlying OS | 126 // |clean_up_resources_on_destruction| indicates whether the underlying OS |
127 // primitives are cleaned up on destruction. | 127 // primitives are cleaned up on destruction. |
128 static SharedMemoryHandle DeepCopyHandle( | 128 static SharedMemoryHandle DeepCopyHandle( |
129 const SharedMemoryHandle& handle, | 129 const SharedMemoryHandle& handle, |
130 bool clean_up_resources_on_destruction); | 130 bool clean_up_resources_on_destruction); |
131 #endif | 131 #endif |
132 | 132 |
133 #if defined(OS_POSIX) && !defined(OS_ANDROID) | |
erikchen
2015/05/30 00:00:35
I find longer preprocessor conditionals easier to
| |
134 // Returns the size of the shared memory region referred to by |handle|. | |
135 // Returns '-1' on a failure to determine the size. | |
136 static int GetSizeFromSharedMemoryHandle(const SharedMemoryHandle& handle); | |
137 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | |
138 | |
133 // Creates a shared memory object as described by the options struct. | 139 // Creates a shared memory object as described by the options struct. |
134 // Returns true on success and false on failure. | 140 // Returns true on success and false on failure. |
135 bool Create(const SharedMemoryCreateOptions& options); | 141 bool Create(const SharedMemoryCreateOptions& options); |
136 | 142 |
137 // Creates and maps an anonymous shared memory segment of size size. | 143 // Creates and maps an anonymous shared memory segment of size size. |
138 // Returns true on success and false on failure. | 144 // Returns true on success and false on failure. |
139 bool CreateAndMapAnonymous(size_t size); | 145 bool CreateAndMapAnonymous(size_t size); |
140 | 146 |
141 // Creates an anonymous shared memory segment of size size. | 147 // Creates an anonymous shared memory segment of size size. |
142 // Returns true on success and false on failure. | 148 // Returns true on success and false on failure. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 } | 337 } |
332 | 338 |
333 private: | 339 private: |
334 SharedMemory* shared_memory_; | 340 SharedMemory* shared_memory_; |
335 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLockDeprecated); | 341 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLockDeprecated); |
336 }; | 342 }; |
337 | 343 |
338 } // namespace base | 344 } // namespace base |
339 | 345 |
340 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 346 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
OLD | NEW |