Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: base/memory/shared_memory_handle.h

Issue 2854833004: Use SharedMemoryHandle instead ScopedHandle as ivar for SharedMemory (Closed)
Patch Set: close should be idempotent. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/memory/shared_memory.h ('k') | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « base/memory/shared_memory.h ('k') | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698