Index: content/browser/android/in_process/synchronous_compositor_factory_impl.cc |
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc |
index 0fdf66ea9dfb8f0f849876ebc3f18eeb41b0dc5d..727125700b5f4e60ccf192e45cebedf902d20a61 100644 |
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc |
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc |
@@ -4,6 +4,7 @@ |
#include "content/browser/android/in_process/synchronous_compositor_factory_impl.h" |
+#include "base/command_line.h" |
#include "base/observer_list.h" |
#include "content/browser/android/in_process/synchronous_compositor_external_begin_frame_source.h" |
#include "content/browser/android/in_process/synchronous_compositor_impl.h" |
@@ -13,6 +14,7 @@ |
#include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
#include "gpu/command_buffer/client/gl_in_process_context.h" |
#include "gpu/command_buffer/common/gles2_cmd_utils.h" |
+#include "gpu/command_buffer/service/gpu_switches.h" |
#include "ui/gl/android/surface_texture.h" |
#include "ui/gl/gl_surface.h" |
#include "ui/gl/gl_surface_stub.h" |
@@ -64,7 +66,8 @@ scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext( |
scoped_ptr<gpu::GLInProcessContext> CreateContext( |
scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
- const gpu::GLInProcessContextSharedMemoryLimits& mem_limits) { |
+ const gpu::GLInProcessContextSharedMemoryLimits& mem_limits, |
+ bool is_offscreen) { |
const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
gpu::gles2::ContextCreationAttribHelper in_process_attribs; |
WebGraphicsContext3DImpl::ConvertAttributes( |
@@ -74,7 +77,7 @@ scoped_ptr<gpu::GLInProcessContext> CreateContext( |
scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create( |
service, |
NULL /* surface */, |
- false /* is_offscreen */, |
+ is_offscreen, |
gfx::kNullAcceleratedWidget, |
gfx::Size(1, 1), |
NULL /* share_context */, |
@@ -218,8 +221,16 @@ scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: |
// This is half of what RenderWidget uses because synchronous compositor |
// pipeline is only one frame deep. |
mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; |
+ |
+ scoped_refptr<gpu::InProcessCommandBuffer::Service> service; |
+ bool is_offscreen = true; |
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableAsyncPixelWithThreadedTextureMailboxes)) { |
+ service = service_; |
+ is_offscreen = false; |
+ } |
return webkit::gpu::ContextProviderInProcess::Create( |
- WrapContext(CreateContext(service_, mem_limits)), |
+ WrapContext(CreateContext(service, mem_limits, is_offscreen)), |
"Child-Compositor"); |
} |
@@ -288,9 +299,8 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { |
if (!video_context_provider_.get()) { |
DCHECK(service_.get()); |
- video_context_provider_ = new VideoContextProvider( |
- CreateContext(service_, |
- gpu::GLInProcessContextSharedMemoryLimits())); |
+ video_context_provider_ = new VideoContextProvider(CreateContext( |
+ service_, gpu::GLInProcessContextSharedMemoryLimits(), false)); |
no sievers
2015/01/15 20:26:05
Can you put a comment that this needs to be treate
boliu
2015/01/21 02:08:01
I put something generic. Can you look again?
What
no sievers
2015/01/23 21:48:35
Yes you cannot create another texture from a Surfa
|
} |
return video_context_provider_; |
} |