| 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 b90edd69a2f25dd9b17141dcebeb9b44df9be868..2f54b96f4f36c4fa7da16e0b6d9c1295bfae97df 100644
|
| --- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
|
| +++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
|
| @@ -24,6 +24,7 @@
|
| #include "content/renderer/render_thread_impl.h"
|
| #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
|
| #include "gpu/command_buffer/client/gl_in_process_context.h"
|
| +#include "gpu/command_buffer/client/gles2_interface.h"
|
| #include "gpu/command_buffer/common/gles2_cmd_utils.h"
|
| #include "ui/gl/android/surface_texture.h"
|
| #include "ui/gl/gl_surface.h"
|
| @@ -169,11 +170,39 @@ SynchronousCompositorFactoryImpl::CreateOutputSurface(
|
| scoped_refptr<content::FrameSwapMessageQueue> frame_swap_message_queue) {
|
| scoped_refptr<cc::ContextProvider> onscreen_context =
|
| CreateContextProviderForCompositor(surface_id, RENDER_COMPOSITOR_CONTEXT);
|
| - scoped_refptr<cc::ContextProvider> worker_context =
|
| - CreateContextProviderForCompositor(0, RENDER_WORKER_CONTEXT);
|
| +
|
| + bool shared_worker_context_lost = false;
|
| + if (shared_worker_context_) {
|
| + base::AutoLock lock(*shared_worker_context_->GetLock());
|
| + if (shared_worker_context_->ContextGL()->GetGraphicsResetStatusKHR() !=
|
| + GL_NO_ERROR) {
|
| + shared_worker_context_lost = true;
|
| + }
|
| + }
|
| + // Note: shared worker context support requires |use_ipc_command_buffer_|.
|
| + if (use_ipc_command_buffer_ &&
|
| + (!shared_worker_context_ || shared_worker_context_lost)) {
|
| + // TODO(reveman): This limit is based on the usage required by async
|
| + // uploads. Determine what a good limit is now that async uploads are
|
| + // no longer used.
|
| + unsigned int mapped_memory_reclaim_limit =
|
| + (base::SysInfo::IsLowEndDevice() ? 2 : 6) * 1024 * 1024;
|
| + 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 make_scoped_ptr(new SynchronousCompositorOutputSurface(
|
| - onscreen_context, worker_context, routing_id, frame_swap_message_queue));
|
| + onscreen_context, shared_worker_context_, routing_id,
|
| + frame_swap_message_queue));
|
| }
|
|
|
| InputHandlerManagerClient*
|
| @@ -211,6 +240,9 @@ SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor(
|
| // This is half of what RenderWidget uses because synchronous compositor
|
| // pipeline is only one frame deep. But twice of half for low end here
|
| // because 16bit texture is not supported.
|
| + // TODO(reveman): This limit is based on the usage required by async
|
| + // uploads. Determine what a good limit is now that async uploads are
|
| + // no longer used.
|
| unsigned int mapped_memory_reclaim_limit =
|
| (base::SysInfo::IsLowEndDevice() ? 2 : 6) * 1024 * 1024;
|
| blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs();
|
|
|