Chromium Code Reviews| Index: content/common/gpu/client/command_buffer_proxy_impl.cc |
| diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc |
| index 631eea96641ac85446e394e408e527a1982ef29c..191984bc6157c88d4212aad01ee39499d9f81ef5 100644 |
| --- a/content/common/gpu/client/command_buffer_proxy_impl.cc |
| +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc |
| @@ -5,6 +5,7 @@ |
| #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| #include "base/callback.h" |
| +#include "base/command_line.h" |
| #include "base/debug/trace_event.h" |
| #include "base/logging.h" |
| #include "base/memory/shared_memory.h" |
| @@ -14,6 +15,7 @@ |
| #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
| #include "content/common/gpu/gpu_messages.h" |
| #include "content/common/view_messages.h" |
| +#include "content/public/common/content_switches.h" |
| #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| #include "gpu/command_buffer/common/command_buffer_shared.h" |
| #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| @@ -381,10 +383,8 @@ gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer( |
| if (last_state_.error != gpu::error::kNoError) |
| return NULL; |
| - |
| int32 new_id = channel_->ReserveGpuMemoryBufferId(); |
| DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end()); |
| - |
| scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer( |
| channel_->factory()->AllocateGpuMemoryBuffer(width, |
| height, |
| @@ -398,10 +398,28 @@ gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer( |
| // This handle is owned by the GPU process and must be passed to it or it |
| // will leak. In otherwords, do not early out on error between here and the |
| // sending of the RegisterGpuMemoryBuffer IPC below. |
| + |
| gfx::GpuMemoryBufferHandle handle = |
| channel_->ShareGpuMemoryBufferToGpuProcess( |
| gpu_memory_buffer->GetHandle()); |
| +#if defined(OS_ANDROID) |
| + if (CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::KEnableSurfaceTextureBuffer)) { |
| + uint32 surface_texture_handle = 0; |
| + uint32 texture_id = 0; |
| + Send(new GpuCommandBufferMsg_CreateSurfaceTexture( |
| + route_id_, |
| + reinterpret_cast<uint32>(gpu_memory_buffer.get()), |
| + &surface_texture_handle, |
| + &texture_id)); |
| + |
| + handle.surface_texture_handle = |
| + reinterpret_cast<void*>(surface_texture_handle); |
| + handle.texture_id = texture_id; |
| + } |
| +#endif |
|
reveman
2014/02/26 08:02:34
I haven't looked at what this code does in detail
|
| + |
| if (!Send(new GpuCommandBufferMsg_RegisterGpuMemoryBuffer( |
| route_id_, |
| new_id, |