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 1437c80a4e31595f6eec411469d432487b66000d..88d69afc1567d5dba4dcad81ee866fd13101677b 100644 |
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc |
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc |
@@ -13,6 +13,7 @@ |
#include "content/browser/android/in_process/synchronous_compositor_impl.h" |
#include "content/browser/android/in_process/synchronous_compositor_output_surface.h" |
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
+#include "content/gpu/in_process_gpu_thread.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/gpu_data_manager.h" |
#include "content/renderer/gpu/frame_swap_message_queue.h" |
@@ -170,8 +171,9 @@ scoped_refptr<ContextProviderWebContext> |
SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider( |
const blink::WebGraphicsContext3D::Attributes& attributes, |
const std::string& debug_name) { |
- ContextHolder holder = CreateContextHolder( |
- attributes, nullptr, gpu::GLInProcessContextSharedMemoryLimits(), true); |
+ ContextHolder holder = |
+ CreateContextHolder(attributes, GpuThreadService(), |
+ gpu::GLInProcessContextSharedMemoryLimits(), true); |
return ContextProviderInProcess::Create(holder.command_buffer.Pass(), |
debug_name); |
} |
@@ -189,7 +191,7 @@ SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor() { |
mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; |
} |
ContextHolder holder = |
- CreateContextHolder(attributes, nullptr, mem_limits, true); |
+ CreateContextHolder(attributes, GpuThreadService(), mem_limits, true); |
return ContextProviderInProcess::Create(holder.command_buffer.Pass(), |
"Child-Compositor"); |
} |
@@ -208,9 +210,9 @@ SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { |
WebGraphicsContext3DInProcessCommandBufferImpl* |
SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D( |
const blink::WebGraphicsContext3D::Attributes& attributes) { |
- ContextHolder holder = CreateContextHolder( |
- attributes, nullptr, |
- gpu::GLInProcessContextSharedMemoryLimits(), true); |
+ ContextHolder holder = |
+ CreateContextHolder(attributes, GpuThreadService(), |
+ gpu::GLInProcessContextSharedMemoryLimits(), true); |
return holder.command_buffer.release(); |
} |
@@ -263,14 +265,14 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { |
} |
if (!video_context_provider_.get()) { |
- DCHECK(service_.get()); |
+ DCHECK(android_view_service_.get()); |
blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); |
attributes.shareResources = false; |
- // This needs to run in on-screen |service_| context due to SurfaceTexture |
- // limitations. |
+ // This needs to run in on-screen |android_view_service_| context due to |
+ // SurfaceTexture limitations. |
ContextHolder holder = |
- CreateContextHolder(attributes, service_, |
+ CreateContextHolder(attributes, android_view_service_, |
gpu::GLInProcessContextSharedMemoryLimits(), false); |
video_context_provider_ = new VideoContextProvider( |
ContextProviderInProcess::Create(holder.command_buffer.Pass(), |
@@ -282,8 +284,26 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { |
void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
- DCHECK(!service_.get()); |
- service_ = service; |
+ DCHECK(!android_view_service_.get()); |
+ android_view_service_ = service; |
+} |
+ |
+base::Thread* SynchronousCompositorFactoryImpl::CreateInProcessGpuThread( |
+ const InProcessChildThreadParams& params) { |
+ DCHECK(android_view_service_.get()); |
+ return new InProcessGpuThread(params, |
+ android_view_service_->sync_point_manager()); |
+} |
+ |
+scoped_refptr<gpu::InProcessCommandBuffer::Service> |
+SynchronousCompositorFactoryImpl::GpuThreadService() { |
+ DCHECK(android_view_service_.get()); |
+ // Create thread lazily on first use. |
+ if (!gpu_thread_service_.get()) { |
+ gpu_thread_service_ = new gpu::GpuInProcessThread( |
+ android_view_service_->sync_point_manager()); |
+ } |
+ return gpu_thread_service_; |
} |
void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |