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

Unified Diff: content/renderer/renderer_glue.cc

Issue 8229039: Make shared memory allocation possible for all child process types. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/renderer_glue.cc
===================================================================
--- content/renderer/renderer_glue.cc (revision 105562)
+++ content/renderer/renderer_glue.cc (working copy)
@@ -51,37 +51,12 @@
uint32 buf_size = 4 * size.width() * size.height();
// Allocate a shared memory buffer to hold the bitmap bits.
-#if defined(OS_POSIX)
- // On POSIX, we need to ask the browser to create the shared memory for us,
- // since this is blocked by the sandbox.
- base::SharedMemoryHandle shared_mem_handle;
- ViewHostMsg_AllocateSharedMemoryBuffer *msg =
- new ViewHostMsg_AllocateSharedMemoryBuffer(buf_size,
- &shared_mem_handle);
- if (RenderThreadImpl::current()->Send(msg)) {
- if (base::SharedMemory::IsHandleValid(shared_mem_handle)) {
- shared_buf_ = new base::SharedMemory(shared_mem_handle, false);
- if (!shared_buf_ || !shared_buf_->Map(buf_size)) {
- NOTREACHED() << "Map failed";
- return;
- }
- } else {
- NOTREACHED() << "Browser failed to allocate shared memory";
- return;
- }
- } else {
- NOTREACHED() << "Browser allocation request message failed";
+ shared_buf_ = ChildThread::current()->AllocateSharedMemory(buf_size);
+ if (!shared_buf_)
return;
- }
-#else // !OS_POSIX
- shared_buf_ = new base::SharedMemory;
- if (!shared_buf_->CreateAndMapAnonymous(buf_size)) {
- NOTREACHED();
- return;
- }
-#endif
// Copy the bits into shared memory
+ DCHECK(shared_buf_->memory());
memcpy(shared_buf_->memory(), pixels, buf_size);
shared_buf_->Unmap();
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698