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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 177953004: Enable SurfaceTexture based zero-copy texture uploading on Android platform Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
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,

Powered by Google App Engine
This is Rietveld 408576698