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

Unified Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 217593004: GPU: Fix NULL gpu::Buffer dereference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 9 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 | gpu/command_buffer/client/mapped_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/ppb_graphics_3d_impl.cc
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
index 18a8e90e0b63d61478acecaa2cfed2d7056d0f6a..1ba14bc3a8cd480d3eff2a2bfaeaaf2a34a46174 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -38,20 +38,19 @@ namespace {
const int32 kCommandBufferSize = 1024 * 1024;
const int32 kTransferBufferSize = 1024 * 1024;
-PP_Bool ShmToHandle(base::SharedMemory* shm,
- size_t size,
+PP_Bool BufferToHandle(scoped_refptr<gpu::Buffer> buffer,
int* shm_handle,
uint32_t* shm_size) {
- if (!shm || !shm_handle || !shm_size)
+ if (!buffer || !shm_handle || !shm_size)
return PP_FALSE;
#if defined(OS_POSIX)
- *shm_handle = shm->handle().fd;
+ *shm_handle = buffer->shared_memory()->handle().fd;
#elif defined(OS_WIN)
- *shm_handle = reinterpret_cast<int>(shm->handle());
+ *shm_handle = reinterpret_cast<int>(buffer->shared_memory()->handle());
#else
#error "Platform not supported."
#endif
- *shm_size = size;
+ *shm_size = buffer->size();
return PP_TRUE;
}
@@ -128,8 +127,7 @@ PP_Bool PPB_Graphics3D_Impl::GetTransferBuffer(int32_t id,
int* shm_handle,
uint32_t* shm_size) {
scoped_refptr<gpu::Buffer> buffer = GetCommandBuffer()->GetTransferBuffer(id);
- return ShmToHandle(
- buffer->shared_memory(), buffer->size(), shm_handle, shm_size);
+ return BufferToHandle(buffer, shm_handle, shm_size);
}
PP_Bool PPB_Graphics3D_Impl::Flush(int32_t put_offset) {
« no previous file with comments | « no previous file | gpu/command_buffer/client/mapped_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698