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

Unified Diff: base/memory/shared_memory_mac.cc

Issue 1474073002: Reland of base: Make shared memory backed by Mach primitives by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/shared_memory.h ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_mac.cc
diff --git a/base/memory/shared_memory_mac.cc b/base/memory/shared_memory_mac.cc
index 61ebf89aa1540c8f646af5b79b31618b124432a3..cdf0bc9fefa4eb60fd4333abdfd66c64b1009b89 100644
--- a/base/memory/shared_memory_mac.cc
+++ b/base/memory/shared_memory_mac.cc
@@ -53,7 +53,7 @@
group = SharedMemoryHandle::POSIX;
found_group = true;
} else {
- group = SharedMemoryHandle::POSIX;
+ group = SharedMemoryHandle::MACH;
}
return group;
@@ -175,10 +175,20 @@
} // namespace
SharedMemoryCreateOptions::SharedMemoryCreateOptions()
- : type(SharedMemoryHandle::POSIX),
+ : type(SharedMemoryHandle::MACH),
size(0),
executable(false),
- share_read_only(false) {}
+ share_read_only(false) {
+ if (mac::IsOSLionOrLater()) {
+ // A/B test the mechanism. Once the experiment is over, this will always be
+ // set to SharedMemoryHandle::MACH.
+ // http://crbug.com/547261
+ type = GetABTestMechanism();
+ } else {
+ // Mach shared memory isn't supported on OSX 10.6 or older.
+ type = SharedMemoryHandle::POSIX;
+ }
+}
SharedMemory::SharedMemory()
: mapped_memory_mechanism_(SharedMemoryHandle::POSIX),
@@ -263,22 +273,6 @@
return Create(options);
}
-bool SharedMemory::CreateAndMapAnonymousMach(size_t size) {
- SharedMemoryCreateOptions options;
-
- if (mac::IsOSLionOrLater()) {
- // A/B test the mechanism. Once the experiment is over, this will always be
- // set to SharedMemoryHandle::MACH.
- // http://crbug.com/547261
- options.type = GetABTestMechanism();
- } else {
- // Mach shared memory isn't supported on OSX 10.6 or older.
- options.type = SharedMemoryHandle::POSIX;
- }
- options.size = size;
- return Create(options) && Map(size);
-}
-
// static
bool SharedMemory::GetSizeFromSharedMemoryHandle(
const SharedMemoryHandle& handle,
« no previous file with comments | « base/memory/shared_memory.h ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698