Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
| index 753244fbd4e2fc9e7c22bdeae970e52645a8215a..e65e01a0e0d8d095547c3b7947da616fc00db89f 100644 |
| --- a/content/renderer/render_thread_impl.cc |
| +++ b/content/renderer/render_thread_impl.cc |
| @@ -1102,21 +1102,29 @@ scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
| return scoped_ptr<gfx::GpuMemoryBuffer>(); |
| gfx::GpuMemoryBufferHandle handle; |
| - bool success; |
| - IPC::Message* message = |
| - new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(width, |
| - height, |
| - internalformat, |
| - &handle); |
|
reveman
2014/02/26 08:02:34
Please don't change any of code in this function.
|
| - // Allow calling this from the compositor thread. |
| - if (base::MessageLoop::current() == message_loop()) |
| - success = ChildThread::Send(message); |
| - else |
| - success = sync_message_filter()->Send(message); |
| +#if defined(OS_ANDROID) |
| + bool is_android = true; |
| +#else |
| + bool is_android = false; |
| +#endif |
| - if (!success) |
| - return scoped_ptr<gfx::GpuMemoryBuffer>(); |
| + if (!is_android || !CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::KEnableSurfaceTextureBuffer)) { |
| + bool success; |
| + IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( |
| + width, height, internalformat, &handle); |
| + |
| + // Allow calling this from the compositor thread. |
| + if (base::MessageLoop::current() == message_loop()) |
| + success = ChildThread::Send(message); |
| + else |
| + success = sync_message_filter()->Send(message); |
| + |
| + if (!success) |
| + return scoped_ptr<gfx::GpuMemoryBuffer>(); |
| + } else |
| + handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
| return GpuMemoryBufferImpl::Create( |
| handle, |