Chromium Code Reviews| Index: content/common/gpu/gpu_command_buffer_stub.cc |
| diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc |
| index 3795fa7acf1e09a2c7472093ce1e3d2967cee6c1..026184c96230cbf856d72d4f51360fb4999427e5 100644 |
| --- a/content/common/gpu/gpu_command_buffer_stub.cc |
| +++ b/content/common/gpu/gpu_command_buffer_stub.cc |
| @@ -14,6 +14,7 @@ |
| #include "content/common/gpu/gpu_channel.h" |
| #include "content/common/gpu/gpu_channel_manager.h" |
| #include "content/common/gpu/gpu_command_buffer_stub.h" |
| +#include "content/common/gpu/gpu_memory_buffer_factory.h" |
| #include "content/common/gpu/gpu_memory_manager.h" |
| #include "content/common/gpu/gpu_memory_tracking.h" |
| #include "content/common/gpu/gpu_messages.h" |
| @@ -928,13 +929,19 @@ void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( |
| void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
| int32 id, |
| - gfx::GpuMemoryBufferHandle gpu_memory_buffer, |
| + gfx::GpuMemoryBufferHandle handle, |
| uint32 width, |
| uint32 height, |
| uint32 internalformat) { |
| TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); |
| + |
| + // Verify that renderer is not trying to use a buffer it doesn't own. |
| + if (!GpuMemoryBufferFactory::RequestAccessToGpuMemoryBuffer( |
| + handle, channel()->client_id())) { |
| + LOG(ERROR) << "Access to GPU memory buffer by renderer denied."; |
| + return; |
| + } |
|
piman
2014/06/17 23:38:11
Because XID is a field of handle, if you grab the
reveman
2014/06/18 22:06:28
That works in the case of X11 pixmaps and XIDs but
piman
2014/06/18 22:14:36
If the GpuMemoryBufferHandle doesn't include the n
|
| #if defined(OS_ANDROID) |
| - // Verify that renderer is not trying to use a surface texture it doesn't own. |
| if (gpu_memory_buffer.type == gfx::SURFACE_TEXTURE_BUFFER && |
| gpu_memory_buffer.surface_texture_id.secondary_id != |
| channel()->client_id()) { |
| @@ -942,9 +949,10 @@ void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
| return; |
| } |
| #endif |
| + |
| if (gpu_control_service_) { |
| gpu_control_service_->RegisterGpuMemoryBuffer( |
| - id, gpu_memory_buffer, width, height, internalformat); |
| + id, handle, width, height, internalformat); |
| } |
| } |