| Index: content/renderer/android/synchronous_compositor_output_surface.cc
|
| diff --git a/content/renderer/android/synchronous_compositor_output_surface.cc b/content/renderer/android/synchronous_compositor_output_surface.cc
|
| index 1c73f3d3ae3c630c7e8cee995490bfbb2c7f474c..dc9fc5499a04c5ef3bc99c47b9ac2cc4628be1a8 100644
|
| --- a/content/renderer/android/synchronous_compositor_output_surface.cc
|
| +++ b/content/renderer/android/synchronous_compositor_output_surface.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/time.h"
|
| #include "cc/output/compositor_frame.h"
|
| #include "cc/output/compositor_frame_ack.h"
|
| +#include "cc/output/context_provider.h"
|
| #include "cc/output/output_surface_client.h"
|
| #include "cc/output/software_output_device.h"
|
| #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
|
| @@ -32,9 +33,6 @@ namespace {
|
|
|
| // TODO(boliu): RenderThreadImpl should create in process contexts as well.
|
| scoped_ptr<WebKit::WebGraphicsContext3D> CreateWebGraphicsContext3D() {
|
| - if (!CommandLine::ForCurrentProcess()->HasSwitch("testing-webview-gl-mode"))
|
| - return scoped_ptr<WebKit::WebGraphicsContext3D>();
|
| -
|
| WebKit::WebGraphicsContext3D::Attributes attributes;
|
| attributes.antialias = false;
|
| attributes.shareResources = true;
|
| @@ -88,15 +86,13 @@ class SynchronousCompositorOutputSurface::SoftwareDevice
|
|
|
| SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
|
| int32 routing_id)
|
| - : cc::OutputSurface(CreateWebGraphicsContext3D(),
|
| - scoped_ptr<cc::SoftwareOutputDevice>(
|
| - new SoftwareDevice(this))),
|
| + : cc::OutputSurface(
|
| + scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
|
| compositor_client_(NULL),
|
| routing_id_(routing_id),
|
| vsync_enabled_(false),
|
| did_swap_buffer_(false),
|
| - current_sw_canvas_(NULL) {
|
| -}
|
| + current_sw_canvas_(NULL) {}
|
|
|
| SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
|
| DCHECK(CalledOnValidThread());
|
| @@ -148,10 +144,6 @@ void SynchronousCompositorOutputSurface::SetClient(
|
| UpdateCompositorClientSettings();
|
| }
|
|
|
| -bool SynchronousCompositorOutputSurface::IsHwReady() {
|
| - return context3d() != NULL;
|
| -}
|
| -
|
| bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(canvas);
|
| @@ -176,10 +168,24 @@ bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
|
| return finished_draw;
|
| }
|
|
|
| +bool SynchronousCompositorOutputSurface::InitializeHwDraw() {
|
| + DCHECK(CalledOnValidThread());
|
| + DCHECK(client_);
|
| + DCHECK(!context3d_);
|
| +
|
| + context3d_ = CreateWebGraphicsContext3D().Pass();
|
| +
|
| + // TODO(boliu): Get a context provider in constructor and pass here.
|
| + bool result = client_->InitializeForGL(scoped_refptr<cc::ContextProvider>());
|
| + if (!result)
|
| + client_->DidLoseOutputSurface();
|
| + return result;
|
| +}
|
| +
|
| bool SynchronousCompositorOutputSurface::DemandDrawHw(
|
| - gfx::Size view_size,
|
| - const gfx::Transform& transform,
|
| - gfx::Rect damage_area) {
|
| + gfx::Size view_size,
|
| + const gfx::Transform& transform,
|
| + gfx::Rect damage_area) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(client_);
|
|
|
|
|