Index: base/memory/shared_memory_mac.cc |
diff --git a/base/memory/shared_memory_mac.cc b/base/memory/shared_memory_mac.cc |
index cdf0bc9fefa4eb60fd4333abdfd66c64b1009b89..61ebf89aa1540c8f646af5b79b31618b124432a3 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::MACH; |
+ group = SharedMemoryHandle::POSIX; |
} |
return group; |
@@ -175,20 +175,10 @@ |
} // namespace |
SharedMemoryCreateOptions::SharedMemoryCreateOptions() |
- : type(SharedMemoryHandle::MACH), |
+ : type(SharedMemoryHandle::POSIX), |
size(0), |
executable(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; |
- } |
-} |
+ share_read_only(false) {} |
SharedMemory::SharedMemory() |
: mapped_memory_mechanism_(SharedMemoryHandle::POSIX), |
@@ -273,6 +263,22 @@ |
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, |