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

Unified Diff: content/renderer/android/synchronous_compositor_output_surface.cc

Issue 14772021: cc::OutputSurfaceClient::InitializeForGL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc refactors to reduce duplication Created 7 years, 7 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/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 7acdf8a31b62e13e82872e3c2fdafe87a418f4b1..8d86600e8f65cf6259a1abc04b36a787310b7862 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,9 +86,8 @@ 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),
needs_begin_frame_(false),
@@ -149,10 +146,6 @@ void SynchronousCompositorOutputSurface::SetClient(
UpdateCompositorClientSettings();
}
-bool SynchronousCompositorOutputSurface::IsHwReady() {
- return context3d() != NULL;
-}
-
bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
DCHECK(CalledOnValidThread());
DCHECK(canvas);
@@ -177,10 +170,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_);
« cc/trees/thread_proxy.cc ('K') | « content/renderer/android/synchronous_compositor_output_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698