#include "content/browser/android/in_process/synchronous_compositor_output_surface.h"
#include "content/public/browser/browser_thread.h"
+#include "content/renderer/gpu/frame_swap_message_queue.h"
#include "gpu/command_buffer/client/gl_in_process_context.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "ui/gl/android/surface_texture.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_surface_stub.h"
}
using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
+using webkit::gpu::WebGraphicsContext3DImpl;
scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext(
const blink::WebGraphicsContext3D::Attributes& attributes) {
const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
- gpu::GLInProcessContextAttribs in_process_attribs;
- WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
+ gpu::gles2::ContextCreationAttribHelper in_process_attribs;
+ WebGraphicsContext3DImpl::ConvertAttributes(
attributes, &in_process_attribs);
- in_process_attribs.lose_context_when_out_of_memory = 1;
+ in_process_attribs.lose_context_when_out_of_memory = true;
scoped_ptr<gpu::GLInProcessContext> context(
gpu::GLInProcessContext::Create(NULL /* service */,
scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
gpu::GLInProcessContext* share_context) {
const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
- gpu::GLInProcessContextAttribs in_process_attribs;
- WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
+ gpu::gles2::ContextCreationAttribHelper in_process_attribs;
+ WebGraphicsContext3DImpl::ConvertAttributes(
GetDefaultAttribs(), &in_process_attribs);
- in_process_attribs.lose_context_when_out_of_memory = 1;
+ in_process_attribs.lose_context_when_out_of_memory = true;
scoped_ptr<gpu::GLInProcessContext> context(
gpu::GLInProcessContext::Create(service,
}
scoped_ptr<cc::OutputSurface>
-SynchronousCompositorFactoryImpl::CreateOutputSurface(int routing_id) {
+SynchronousCompositorFactoryImpl::CreateOutputSurface(
+ int routing_id,
+ scoped_refptr<content::FrameSwapMessageQueue> frame_swap_message_queue) {
scoped_ptr<SynchronousCompositorOutputSurface> output_surface(
- new SynchronousCompositorOutputSurface(routing_id));
+ new SynchronousCompositorOutputSurface(routing_id,
+ frame_swap_message_queue));
return output_surface.PassAs<cc::OutputSurface>();
}
return synchronous_input_event_filter();
}
-scoped_refptr<ContextProviderWebContext> SynchronousCompositorFactoryImpl::
- GetSharedOffscreenContextProviderForMainThread() {
- bool failed = false;
- if ((!offscreen_context_for_main_thread_.get() ||
- offscreen_context_for_main_thread_->DestroyedOnMainThread())) {
- scoped_ptr<gpu::GLInProcessContext> context =
- CreateOffscreenContext(GetDefaultAttribs());
- offscreen_context_for_main_thread_ =
- webkit::gpu::ContextProviderInProcess::Create(
- WrapContext(context.Pass()),
- "Compositor-Offscreen-main-thread");
- failed = !offscreen_context_for_main_thread_.get() ||
- !offscreen_context_for_main_thread_->BindToCurrentThread();
- }
-
- if (failed) {
- offscreen_context_for_main_thread_ = NULL;
- }
- return offscreen_context_for_main_thread_;
+scoped_refptr<ContextProviderWebContext>
+SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider(
+ const blink::WebGraphicsContext3D::Attributes& attributes,
+ const std::string& debug_name) {
+ scoped_ptr<gpu::GLInProcessContext> context =
+ CreateOffscreenContext(attributes);
+ return webkit::gpu::ContextProviderInProcess::Create(
+ WrapContext(context.Pass()), debug_name);
}
scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::