summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorboliu <boliu@chromium.org>2015-10-05 11:16:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-05 18:16:55 +0000
commitb3aaf649b11a4777e2fb4a81fd74ed65f4f47948 (patch)
treea5aa475fcf51f18453b937464e651348618a92d4 /content/browser
parentac84a37c07ae9377fcb7baed8791b76640f341a5 (diff)
downloadchromium_src-b3aaf649b11a4777e2fb4a81fd74ed65f4f47948.zip
chromium_src-b3aaf649b11a4777e2fb4a81fd74ed65f4f47948.tar.gz
chromium_src-b3aaf649b11a4777e2fb4a81fd74ed65f4f47948.tar.bz2
android webview: Remove support for in-proc command buffer
For most things in android webview except in-line video. IPC-based command buffer path is ready. See bug for details. BUG=509702 Review URL: https://codereview.chromium.org/1325733003 Cr-Commit-Position: refs/heads/master@{#352350}
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/android/in_process/synchronous_compositor_factory_impl.cc132
-rw-r--r--content/browser/android/in_process/synchronous_compositor_factory_impl.h16
-rw-r--r--content/browser/android/in_process/synchronous_compositor_impl.cc5
3 files changed, 24 insertions, 129 deletions
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 7048000..9bd0f24 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
@@ -18,7 +18,6 @@
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.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/public/common/content_switches.h"
#include "content/renderer/gpu/frame_swap_message_queue.h"
#include "content/renderer/render_thread_impl.h"
@@ -147,8 +146,7 @@ class SynchronousCompositorFactoryImpl::VideoContextProvider
};
SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl()
- : use_ipc_command_buffer_(false),
- num_hardware_compositors_(0) {
+ : num_hardware_compositors_(0) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess)) {
// TODO(boliu): Figure out how to deal with this more nicely.
@@ -192,22 +190,6 @@ SynchronousCompositorFactoryImpl::CreateExternalBeginFrameSource(
new SynchronousCompositorExternalBeginFrameSource(routing_id));
}
-bool SynchronousCompositorFactoryImpl::OverrideWithFactory() {
- return !use_ipc_command_buffer_;
-}
-
-scoped_refptr<ContextProviderWebContext>
-SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- const std::string& debug_name) {
- DCHECK(!use_ipc_command_buffer_);
- ContextHolder holder =
- CreateContextHolder(attributes, GpuThreadService(),
- gpu::GLInProcessContextSharedMemoryLimits(), true);
- return ContextProviderInProcess::Create(holder.command_buffer.Pass(),
- debug_name);
-}
-
scoped_refptr<cc::ContextProvider>
SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor(
int surface_id,
@@ -222,21 +204,12 @@ SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor(
(base::SysInfo::IsLowEndDevice() ? 2 : 6) * 1024 * 1024;
blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs();
- if (use_ipc_command_buffer_) {
- WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits mem_limits;
- mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit;
- scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context =
- CreateContext3D(surface_id, GetDefaultAttribs(), mem_limits);
- return make_scoped_refptr(
- new SynchronousCompositorContextProvider(context.Pass(), type));
- }
-
- gpu::GLInProcessContextSharedMemoryLimits mem_limits;
+ WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits mem_limits;
mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit;
- ContextHolder holder =
- CreateContextHolder(attributes, GpuThreadService(), mem_limits, true);
- return ContextProviderInProcess::Create(holder.command_buffer.Pass(),
- "Child-Compositor");
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context =
+ CreateContext3D(surface_id, GetDefaultAttribs(), mem_limits);
+ return make_scoped_refptr(
+ new SynchronousCompositorContextProvider(context.Pass(), type));
}
scoped_refptr<cc::ContextProvider>
@@ -247,57 +220,30 @@ SynchronousCompositorFactoryImpl::GetSharedWorkerContextProvider() {
unsigned int mapped_memory_reclaim_limit =
(base::SysInfo::IsLowEndDevice() ? 2 : 6) * 1024 * 1024;
- if (use_ipc_command_buffer_) {
- bool shared_worker_context_lost = false;
- if (shared_worker_context_) {
- // Note: If context is lost, we delete reference after releasing the lock.
- base::AutoLock lock(*shared_worker_context_->GetLock());
- if (shared_worker_context_->ContextGL()->GetGraphicsResetStatusKHR() !=
- GL_NO_ERROR) {
- shared_worker_context_lost = true;
- }
- }
- if (!shared_worker_context_ || shared_worker_context_lost) {
- WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits mem_limits;
- mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit;
- scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context =
- CreateContext3D(0, GetDefaultAttribs(), mem_limits);
- shared_worker_context_ =
- make_scoped_refptr(new SynchronousCompositorContextProvider(
- context.Pass(), RENDER_WORKER_CONTEXT));
- if (!shared_worker_context_->BindToCurrentThread())
- shared_worker_context_ = nullptr;
- if (shared_worker_context_)
- shared_worker_context_->SetupLock();
- }
-
- return shared_worker_context_;
- }
-
- bool in_process_shared_worker_context_lost = false;
- if (in_process_shared_worker_context_) {
+ bool shared_worker_context_lost = false;
+ if (shared_worker_context_) {
// Note: If context is lost, we delete reference after releasing the lock.
- base::AutoLock lock(*in_process_shared_worker_context_->GetLock());
- if (in_process_shared_worker_context_->ContextGL()
- ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
- in_process_shared_worker_context_lost = true;
+ base::AutoLock lock(*shared_worker_context_->GetLock());
+ if (shared_worker_context_->ContextGL()->GetGraphicsResetStatusKHR() !=
+ GL_NO_ERROR) {
+ shared_worker_context_lost = true;
}
}
- if (!in_process_shared_worker_context_ ||
- in_process_shared_worker_context_lost) {
- gpu::GLInProcessContextSharedMemoryLimits mem_limits;
+ if (!shared_worker_context_ || shared_worker_context_lost) {
+ WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits mem_limits;
mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit;
- ContextHolder holder = CreateContextHolder(
- GetDefaultAttribs(), GpuThreadService(), mem_limits, true);
- in_process_shared_worker_context_ = ContextProviderInProcess::Create(
- holder.command_buffer.Pass(), "Child-Worker");
- if (!in_process_shared_worker_context_->BindToCurrentThread())
- in_process_shared_worker_context_ = nullptr;
- if (in_process_shared_worker_context_)
- in_process_shared_worker_context_->SetupLock();
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context =
+ CreateContext3D(0, GetDefaultAttribs(), mem_limits);
+ shared_worker_context_ =
+ make_scoped_refptr(new SynchronousCompositorContextProvider(
+ context.Pass(), RENDER_WORKER_CONTEXT));
+ if (!shared_worker_context_->BindToCurrentThread())
+ shared_worker_context_ = nullptr;
+ if (shared_worker_context_)
+ shared_worker_context_->SetupLock();
}
- return in_process_shared_worker_context_;
+ return shared_worker_context_;
}
scoped_refptr<StreamTextureFactory>
@@ -311,21 +257,6 @@ SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
return factory;
}
-WebGraphicsContext3DInProcessCommandBufferImpl*
-SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D(
- const blink::WebGraphicsContext3D::Attributes& attributes) {
- DCHECK(!use_ipc_command_buffer_);
- ContextHolder holder =
- CreateContextHolder(attributes, GpuThreadService(),
- gpu::GLInProcessContextSharedMemoryLimits(), true);
- return holder.command_buffer.release();
-}
-
-gpu::GPUInfo SynchronousCompositorFactoryImpl::GetGPUInfo() const {
- DCHECK(!use_ipc_command_buffer_);
- return content::GpuDataManager::GetInstance()->GetGPUInfo();
-}
-
void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() {
base::AutoLock lock(num_hardware_compositor_lock_);
num_hardware_compositors_++;
@@ -401,19 +332,4 @@ base::Thread* SynchronousCompositorFactoryImpl::CreateInProcessGpuThread(
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::SetUseIpcCommandBuffer() {
- use_ipc_command_buffer_ = true;
-}
-
} // namespace content
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.h b/content/browser/android/in_process/synchronous_compositor_factory_impl.h
index b78d2c8..87bf544 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.h
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.h
@@ -47,15 +47,6 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
int routing_id) override;
scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
int view_id) override;
- bool OverrideWithFactory() override;
- scoped_refptr<cc_blink::ContextProviderWebContext>
- CreateOffscreenContextProvider(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- const std::string& debug_name) override;
- gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl*
- CreateOffscreenGraphicsContext3D(
- const blink::WebGraphicsContext3D::Attributes& attributes) override;
- gpu::GPUInfo GetGPUInfo() const override;
SynchronousInputEventFilter* synchronous_input_event_filter() {
return &synchronous_input_event_filter_;
@@ -65,7 +56,6 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
base::Thread* CreateInProcessGpuThread(
const InProcessChildThreadParams& params);
- void SetUseIpcCommandBuffer();
void CompositorInitializedHardwareDraw();
void CompositorReleasedHardwareDraw();
@@ -79,21 +69,15 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>
TryCreateStreamTextureFactory();
void RestoreContextOnMainThread();
- scoped_refptr<gpu::InProcessCommandBuffer::Service> GpuThreadService();
SynchronousInputEventFilter synchronous_input_event_filter_;
scoped_refptr<gpu::InProcessCommandBuffer::Service> android_view_service_;
- scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_thread_service_;
class VideoContextProvider;
scoped_refptr<VideoContextProvider> video_context_provider_;
scoped_refptr<SynchronousCompositorContextProvider> shared_worker_context_;
- scoped_refptr<cc_blink::ContextProviderWebContext>
- in_process_shared_worker_context_;
-
- bool use_ipc_command_buffer_;
// |num_hardware_compositor_lock_| is updated on UI thread only but can be
// read on renderer main thread.
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc
index 9846672..215fdb1 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
@@ -145,11 +145,6 @@ void SynchronousCompositor::SetGpuService(
CreateInProcessGpuThreadForSynchronousCompositor);
}
-// static
-void SynchronousCompositor::SetUseIpcCommandBuffer() {
- g_factory.Get().SetUseIpcCommandBuffer();
-}
-
void SynchronousCompositorImpl::DidInitializeRendererObjects(
SynchronousCompositorOutputSurface* output_surface,
SynchronousCompositorExternalBeginFrameSource* begin_frame_source,