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

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

Issue 2875453002: Add a size parameter to SharedMemoryHandle. (Closed)
Patch Set: Remove extraneous period. 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 | « no previous file | base/memory/shared_memory_android.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 (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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Duplicates The underlying OS primitive. Returns an invalid handle on 120 // Duplicates The underlying OS primitive. Returns an invalid handle on
121 // failure. The caller is responsible for destroying the duplicated OS 121 // failure. The caller is responsible for destroying the duplicated OS
122 // primitive. 122 // primitive.
123 static SharedMemoryHandle DuplicateHandle(const SharedMemoryHandle& handle); 123 static SharedMemoryHandle DuplicateHandle(const SharedMemoryHandle& handle);
124 124
125 #if defined(OS_POSIX) 125 #if defined(OS_POSIX)
126 // This method requires that the SharedMemoryHandle is backed by a POSIX fd. 126 // This method requires that the SharedMemoryHandle is backed by a POSIX fd.
127 static int GetFdFromSharedMemoryHandle(const SharedMemoryHandle& handle); 127 static int GetFdFromSharedMemoryHandle(const SharedMemoryHandle& handle);
128 #endif 128 #endif
129 129
130 #if defined(OS_POSIX) && !defined(OS_ANDROID)
131 // Gets the size of the shared memory region referred to by |handle|.
132 // Returns false on a failure to determine the size. On success, populates the
133 // output variable |size|.
134 static bool GetSizeFromSharedMemoryHandle(const SharedMemoryHandle& handle,
135 size_t* size);
136 #endif // defined(OS_POSIX) && !defined(OS_ANDROID)
137
138 // Creates a shared memory object as described by the options struct. 130 // Creates a shared memory object as described by the options struct.
139 // Returns true on success and false on failure. 131 // Returns true on success and false on failure.
140 bool Create(const SharedMemoryCreateOptions& options); 132 bool Create(const SharedMemoryCreateOptions& options);
141 133
142 // Creates and maps an anonymous shared memory segment of size size. 134 // Creates and maps an anonymous shared memory segment of size size.
143 // Returns true on success and false on failure. 135 // Returns true on success and false on failure.
144 bool CreateAndMapAnonymous(size_t size); 136 bool CreateAndMapAnonymous(size_t size);
145 137
146 // Creates an anonymous shared memory segment of size size. 138 // Creates an anonymous shared memory segment of size size.
147 // Returns true on success and false on failure. 139 // Returns true on success and false on failure.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 bool read_only_ = false; 279 bool read_only_ = false;
288 size_t requested_size_ = 0; 280 size_t requested_size_ = 0;
289 SharedMemoryError last_error_ = SharedMemoryError::NO_ERRORS; 281 SharedMemoryError last_error_ = SharedMemoryError::NO_ERRORS;
290 282
291 DISALLOW_COPY_AND_ASSIGN(SharedMemory); 283 DISALLOW_COPY_AND_ASSIGN(SharedMemory);
292 }; 284 };
293 285
294 } // namespace base 286 } // namespace base
295 287
296 #endif // BASE_MEMORY_SHARED_MEMORY_H_ 288 #endif // BASE_MEMORY_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698