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

Unified Diff: content/browser/android/in_process/synchronous_compositor_factory_impl.cc

Issue 1231263003: Share SyncPointManager between ipc and in-process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove forward decl/includes Created 5 years, 5 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/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(

Powered by Google App Engine
This is Rietveld 408576698