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

Unified Diff: content/child/child_thread_impl.cc

Issue 1705863003: Sandboxed processes must ask the browser to allocate shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from jschuh. Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index dbf6c3be0c2d5c13d2029ae0554bf191ce8b443f..86ee1f6fe0ae5e43ff9f473b7ceffb8989b51131 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -569,18 +569,11 @@ scoped_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory(
size_t buf_size,
IPC::Sender* sender) {
scoped_ptr<base::SharedMemory> shared_buf;
-#if defined(OS_WIN)
- shared_buf.reset(new base::SharedMemory);
- if (!shared_buf->CreateAnonymous(buf_size)) {
- NOTREACHED();
- return nullptr;
- }
-#else
- // On POSIX, we need to ask the browser to create the shared memory for us,
- // since this is blocked by the sandbox.
+ // Ask the browser to create the shared memory, since this is blocked by the
+ // sandbox on most platforms.
base::SharedMemoryHandle shared_mem_handle;
if (sender->Send(new ChildProcessHostMsg_SyncAllocateSharedMemory(
- buf_size, &shared_mem_handle))) {
+ buf_size, &shared_mem_handle))) {
if (base::SharedMemory::IsHandleValid(shared_mem_handle)) {
shared_buf.reset(new base::SharedMemory(shared_mem_handle, false));
} else {
@@ -591,7 +584,6 @@ scoped_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory(
// Send is allowed to fail during shutdown. Return null in this case.
return nullptr;
}
-#endif
return shared_buf;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698