Commit efa27203 authored by thestig@chromium.org's avatar thestig@chromium.org

PPAPI: Do not try to allocation shared memory directly from a renderer. Always ask the browser.

BUG=83667
TEST=see bug

Review URL: http://codereview.chromium.org/7065046

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86661 0039d316-1c4b-4281-b951-d872f2087c98
parent ebad02ea
...@@ -1301,11 +1301,6 @@ base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( ...@@ -1301,11 +1301,6 @@ base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory(
uint32_t size) { uint32_t size) {
if (size == 0) if (size == 0)
return NULL; return NULL;
scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
if (shm->CreateAnonymous(size))
return shm.release();
// The sandbox can prevent CreateAnonymous from succeeding, in which case we
// need to IPC to the browser process.
base::SharedMemoryHandle handle; base::SharedMemoryHandle handle;
if (!render_view_->Send( if (!render_view_->Send(
new ViewHostMsg_AllocateSharedMemoryBuffer(size, &handle))) { new ViewHostMsg_AllocateSharedMemoryBuffer(size, &handle))) {
...@@ -1316,6 +1311,5 @@ base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( ...@@ -1316,6 +1311,5 @@ base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory(
DLOG(WARNING) << "Browser failed to allocate shared memory"; DLOG(WARNING) << "Browser failed to allocate shared memory";
return NULL; return NULL;
} }
shm.reset(new base::SharedMemory(handle, false)); return new base::SharedMemory(handle, false);
return shm.release();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment