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

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

Issue 1453383002: base: Make shared memory backed by Mach primitives by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Force a POSIX test to use POSIX shared memory. Created 5 years 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_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 (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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 bool CreateAndMapAnonymous(size_t size); 133 bool CreateAndMapAnonymous(size_t size);
134 134
135 #if defined(OS_MACOSX) && !defined(OS_IOS) 135 #if defined(OS_MACOSX) && !defined(OS_IOS)
136 // These two methods are analogs of CreateAndMapAnonymous and CreateAnonymous 136 // These two methods are analogs of CreateAndMapAnonymous and CreateAnonymous
137 // that force the underlying OS primitive to be a POSIX fd. Do not add new 137 // that force the underlying OS primitive to be a POSIX fd. Do not add new
138 // uses of these methods unless absolutely necessary, since constructing a 138 // uses of these methods unless absolutely necessary, since constructing a
139 // fd-backed SharedMemory object frequently takes 100ms+. 139 // fd-backed SharedMemory object frequently takes 100ms+.
140 // http://crbug.com/466437. 140 // http://crbug.com/466437.
141 bool CreateAndMapAnonymousPosix(size_t size); 141 bool CreateAndMapAnonymousPosix(size_t size);
142 bool CreateAnonymousPosix(size_t size); 142 bool CreateAnonymousPosix(size_t size);
143
144 // This method is an analog of CreateAndMapAnonymous that forces the
145 // underlying OS primitive to be a Mach memory object.
146 bool CreateAndMapAnonymousMach(size_t size);
147 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 143 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
148 144
149 // Creates an anonymous shared memory segment of size size. 145 // Creates an anonymous shared memory segment of size size.
150 // Returns true on success and false on failure. 146 // Returns true on success and false on failure.
151 bool CreateAnonymous(size_t size) { 147 bool CreateAnonymous(size_t size) {
152 SharedMemoryCreateOptions options; 148 SharedMemoryCreateOptions options;
153 options.size = size; 149 options.size = size;
154 return Create(options); 150 return Create(options);
155 } 151 }
156 152
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 size_t mapped_size_; 300 size_t mapped_size_;
305 void* memory_; 301 void* memory_;
306 bool read_only_; 302 bool read_only_;
307 size_t requested_size_; 303 size_t requested_size_;
308 304
309 DISALLOW_COPY_AND_ASSIGN(SharedMemory); 305 DISALLOW_COPY_AND_ASSIGN(SharedMemory);
310 }; 306 };
311 } // namespace base 307 } // namespace base
312 308
313 #endif // BASE_MEMORY_SHARED_MEMORY_H_ 309 #endif // BASE_MEMORY_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698