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

Unified Diff: base/memory/shared_memory_posix.cc

Issue 1200473003: Revert of Make SharedMemoryHandle a class on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_make_class3_base
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/shared_memory_nacl.cc ('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_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;
}
« no previous file with comments | « base/memory/shared_memory_nacl.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698