Index: base/memory/shared_memory_posix.cc |
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc |
index 2e66b34cfcd7b5d3bcf8c0a10c90ea02e6dd28db..8aaa9ce443890f64140c06cb9e0a4b410bdf711d 100644 |
--- a/base/memory/shared_memory_posix.cc |
+++ b/base/memory/shared_memory_posix.cc |
@@ -18,6 +18,10 @@ |
#include "base/profiler/scoped_tracker.h" |
#include "base/scoped_generic.h" |
#include "base/strings/utf_string_conversions.h" |
+ |
+#if defined(OS_MACOSX) |
+#include "base/mac/foundation_util.h" |
+#endif // OS_MACOSX |
#if defined(OS_ANDROID) |
#include "base/os_compat_android.h" |
@@ -106,7 +110,7 @@ |
requested_size_(0) { |
} |
-SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only) |
+SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only) |
: mapped_file_(handle.fd), |
readonly_mapped_file_(-1), |
mapped_size_(0), |
@@ -115,8 +119,7 @@ |
requested_size_(0) { |
} |
-SharedMemory::SharedMemory(const SharedMemoryHandle& handle, |
- bool read_only, |
+SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only, |
ProcessHandle process) |
: mapped_file_(handle.fd), |
readonly_mapped_file_(-1), |
@@ -287,6 +290,7 @@ |
requested_size_ = options.size; |
} |
if (fp == NULL) { |
+#if !defined(OS_MACOSX) |
PLOG(ERROR) << "Creating shared memory in " << path.value() << " failed"; |
FilePath dir = path.DirName(); |
if (access(dir.value().c_str(), W_OK | X_OK) < 0) { |
@@ -296,6 +300,9 @@ |
<< "/dev/shm. Try 'sudo chmod 1777 /dev/shm' to fix."; |
} |
} |
+#else |
+ PLOG(ERROR) << "Creating shared memory in " << path.value() << " failed"; |
+#endif |
return false; |
} |
@@ -452,11 +459,15 @@ |
if (!GetShmemTempDir(false, &temp_dir)) |
return false; |
+#if !defined(OS_MACOSX) |
#if defined(GOOGLE_CHROME_BUILD) |
std::string name_base = std::string("com.google.Chrome"); |
#else |
std::string name_base = std::string("org.chromium.Chromium"); |
#endif |
+#else // OS_MACOSX |
+ std::string name_base = std::string(base::mac::BaseBundleID()); |
+#endif // OS_MACOSX |
*path = temp_dir.AppendASCII(name_base + ".shmem." + mem_name); |
return true; |
} |