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

Unified Diff: base/memory/shared_memory_android.cc

Issue 2875453002: Add a size parameter to SharedMemoryHandle. (Closed)
Patch Set: Fix IPC on POSIX. Created 3 years, 7 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
Index: base/memory/shared_memory_android.cc
diff --git a/base/memory/shared_memory_android.cc b/base/memory/shared_memory_android.cc
index da3c5953f044c8ca861427f7cecfd3661b60f930..5765403b26e7d63f6dc90c6a1d288ca6521fdd05 100644
--- a/base/memory/shared_memory_android.cc
+++ b/base/memory/shared_memory_android.cc
@@ -27,7 +27,7 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
int fd = ashmem_create_region(
options.name_deprecated == NULL ? "" : options.name_deprecated->c_str(),
options.size);
- shm_ = SharedMemoryHandle::ImportHandle(fd);
+ shm_ = SharedMemoryHandle::ImportHandle(fd, options.size);
if (!shm_.IsValid()) {
DLOG(ERROR) << "Shared memory creation failed";
return false;
@@ -42,8 +42,9 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
// Android doesn't appear to have a way to drop write access on an ashmem
// segment for a single descriptor. http://crbug.com/320865
- readonly_shm_ = SharedMemoryHandle(
- base::FileDescriptor(dup(shm_.GetHandle()), false), shm_.GetGUID());
+ readonly_shm_ =
+ SharedMemoryHandle(base::FileDescriptor(dup(shm_.GetHandle()), false),
Nico 2017/05/15 22:13:36 Maybe SharedMemoryHandle should have a ReadonlyDup
erikchen 2017/05/15 22:57:18 Actually, the GetReadOnlyHandle method is on Share
Nico 2017/05/15 23:11:55 I mean, this here and a few other places in this C
+ shm_.GetSize(), shm_.GetGUID());
if (!readonly_shm_.IsValid()) {
DPLOG(ERROR) << "dup() failed";
return false;

Powered by Google App Engine
This is Rietveld 408576698