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

Side by Side Diff: base/shared_memory.h

Issue 10827400: Advertise a minimum alignment for SharedMemory::Map(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/shared_memory_nacl.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_SHARED_MEMORY_H_ 5 #ifndef BASE_SHARED_MEMORY_H_
6 #define BASE_SHARED_MEMORY_H_ 6 #define BASE_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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Not all platforms require this call. 135 // Not all platforms require this call.
136 bool Delete(const std::string& name); 136 bool Delete(const std::string& name);
137 137
138 // Opens a shared memory segment based on a name. 138 // Opens a shared memory segment based on a name.
139 // If read_only is true, opens for read-only access. 139 // If read_only is true, opens for read-only access.
140 // Returns true on success, false on failure. 140 // Returns true on success, false on failure.
141 bool Open(const std::string& name, bool read_only); 141 bool Open(const std::string& name, bool read_only);
142 142
143 // Maps the shared memory into the caller's address space. 143 // Maps the shared memory into the caller's address space.
144 // Returns true on success, false otherwise. The memory address 144 // Returns true on success, false otherwise. The memory address
145 // is accessed via the memory() accessor. 145 // is accessed via the memory() accessor. The mapped address is guaranteed to
146 // have an alignment of at least kMapMinimumAlignment.
146 bool Map(uint32 bytes); 147 bool Map(uint32 bytes);
148 enum { kMapMinimumAlignment = 32 };
jar (doing other things) 2012/08/17 21:32:32 nit: use MACRO_STYLE MAP_MINIMUM_ALIGNMENT (this
DaleCurtis 2012/08/17 21:43:46 Done.
147 149
148 // Unmaps the shared memory from the caller's address space. 150 // Unmaps the shared memory from the caller's address space.
149 // Returns true if successful; returns false on error or if the 151 // Returns true if successful; returns false on error or if the
150 // memory is not mapped. 152 // memory is not mapped.
151 bool Unmap(); 153 bool Unmap();
152 154
153 // Get the size of the shared memory backing file. 155 // Get the size of the shared memory backing file.
154 // Note: This size is only available to the creator of the 156 // Note: This size is only available to the creator of the
155 // shared memory, and not to those that opened shared memory 157 // shared memory, and not to those that opened shared memory
156 // created externally. 158 // created externally.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 266 }
265 267
266 private: 268 private:
267 SharedMemory* shared_memory_; 269 SharedMemory* shared_memory_;
268 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLock); 270 DISALLOW_COPY_AND_ASSIGN(SharedMemoryAutoLock);
269 }; 271 };
270 272
271 } // namespace base 273 } // namespace base
272 274
273 #endif // BASE_SHARED_MEMORY_H_ 275 #endif // BASE_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/shared_memory_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698