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

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 7065046: PPAPI: Do not try to allocation shared memory directly from a renderer. Always ask the browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1294
1295 std::string PepperPluginDelegateImpl::GetFlashCommandLineArgs() { 1295 std::string PepperPluginDelegateImpl::GetFlashCommandLineArgs() {
1296 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 1296 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
1297 switches::kPpapiFlashArgs); 1297 switches::kPpapiFlashArgs);
1298 } 1298 }
1299 1299
1300 base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( 1300 base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory(
1301 uint32_t size) { 1301 uint32_t size) {
1302 if (size == 0) 1302 if (size == 0)
1303 return NULL; 1303 return NULL;
1304 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
1305 if (shm->CreateAnonymous(size))
1306 return shm.release();
1307 // The sandbox can prevent CreateAnonymous from succeeding, in which case we
1308 // need to IPC to the browser process.
1309 base::SharedMemoryHandle handle; 1304 base::SharedMemoryHandle handle;
1310 if (!render_view_->Send( 1305 if (!render_view_->Send(
1311 new ViewHostMsg_AllocateSharedMemoryBuffer(size, &handle))) { 1306 new ViewHostMsg_AllocateSharedMemoryBuffer(size, &handle))) {
1312 DLOG(WARNING) << "Browser allocation request message failed"; 1307 DLOG(WARNING) << "Browser allocation request message failed";
1313 return NULL; 1308 return NULL;
1314 } 1309 }
1315 if (!base::SharedMemory::IsHandleValid(handle)) { 1310 if (!base::SharedMemory::IsHandleValid(handle)) {
1316 DLOG(WARNING) << "Browser failed to allocate shared memory"; 1311 DLOG(WARNING) << "Browser failed to allocate shared memory";
1317 return NULL; 1312 return NULL;
1318 } 1313 }
1319 shm.reset(new base::SharedMemory(handle, false)); 1314 return new base::SharedMemory(handle, false);
1320 return shm.release();
1321 } 1315 }
OLDNEW
« 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