| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_HANDLE_H_ | 5 #ifndef BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
| 6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 6 #define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Returns false on a failure to determine the size. On success, populates the | 93 // Returns false on a failure to determine the size. On success, populates the |
| 94 // output variable |size|. | 94 // output variable |size|. |
| 95 bool GetSize(size_t* size) const; | 95 bool GetSize(size_t* size) const; |
| 96 | 96 |
| 97 // The SharedMemoryHandle must be valid. | 97 // The SharedMemoryHandle must be valid. |
| 98 // Returns whether the SharedMemoryHandle was successfully mapped into memory. | 98 // Returns whether the SharedMemoryHandle was successfully mapped into memory. |
| 99 // On success, |memory| is an output variable that contains the start of the | 99 // On success, |memory| is an output variable that contains the start of the |
| 100 // mapped memory. | 100 // mapped memory. |
| 101 bool MapAt(off_t offset, size_t bytes, void** memory, bool read_only); | 101 bool MapAt(off_t offset, size_t bytes, void** memory, bool read_only); |
| 102 #elif defined(OS_WIN) | 102 #elif defined(OS_WIN) |
| 103 // Takes implicit ownership of |h|. |
| 103 SharedMemoryHandle(HANDLE h); | 104 SharedMemoryHandle(HANDLE h); |
| 104 | 105 |
| 105 HANDLE GetHandle() const; | 106 HANDLE GetHandle() const; |
| 106 #else | 107 #else |
| 107 // This constructor is deprecated, as it fails to propagate the GUID, which | 108 // This constructor is deprecated, as it fails to propagate the GUID, which |
| 108 // will be added in the near future. | 109 // will be added in the near future. |
| 109 // TODO(rockot): Remove this constructor once Mojo supports GUIDs. | 110 // TODO(rockot): Remove this constructor once Mojo supports GUIDs. |
| 110 // https://crbug.com/713763. | 111 // https://crbug.com/713763. |
| 111 explicit SharedMemoryHandle(const base::FileDescriptor& file_descriptor); | 112 explicit SharedMemoryHandle(const base::FileDescriptor& file_descriptor); |
| 112 | 113 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Defaults to |false|. | 164 // Defaults to |false|. |
| 164 bool ownership_passes_to_ipc_; | 165 bool ownership_passes_to_ipc_; |
| 165 #else | 166 #else |
| 166 FileDescriptor file_descriptor_; | 167 FileDescriptor file_descriptor_; |
| 167 #endif | 168 #endif |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 } // namespace base | 171 } // namespace base |
| 171 | 172 |
| 172 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ | 173 #endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_ |
| OLD | NEW |