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

Unified Diff: content/browser/android/in_process/synchronous_compositor_output_surface.cc

Issue 16613002: Hook up android webview synchronous compositor GL init (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/browser/android/in_process/synchronous_compositor_output_surface.cc
diff --git a/content/browser/android/in_process/synchronous_compositor_output_surface.cc b/content/browser/android/in_process/synchronous_compositor_output_surface.cc
index b0e2d0e3a4918de3c5470bdce41541f0f433a657..8673c0f16e0a1fc677b401719c83db0bd1ca2eaf 100644
--- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc
+++ b/content/browser/android/in_process/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/browser/android/in_process/synchronous_compositor_impl.h"
@@ -34,9 +35,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;
@@ -91,7 +89,6 @@ class SynchronousCompositorOutputSurface::SoftwareDevice
SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
int routing_id)
: cc::OutputSurface(
- CreateWebGraphicsContext3D(),
scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
routing_id_(routing_id),
needs_begin_frame_(false),
@@ -150,10 +147,6 @@ void SynchronousCompositorOutputSurface::SwapBuffers(
did_swap_buffer_ = true;
}
-bool SynchronousCompositorOutputSurface::IsHwReady() {
- return context3d() != NULL;
-}
-
namespace {
void AdjustTransformForClip(gfx::Transform* transform, gfx::Rect clip) {
// The system-provided transform translates us from the screen origin to the
@@ -187,10 +180,25 @@ bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
return finished_draw;
}
+bool SynchronousCompositorOutputSurface::InitializeHwDraw() {
+ DCHECK(CalledOnValidThread());
+ DCHECK(client_);
+ DCHECK(!context3d_);
+
+ // TODO(boliu): Get a context provider in constructor and pass here.
+ bool success =
+ InitializeAndSetContext3D(CreateWebGraphicsContext3D().Pass(),
+ scoped_refptr<cc::ContextProvider>());
+ if (!success)
+ client_->DidLoseOutputSurface();
joth 2013/06/07 01:08:03 could base class InitializeAndSetContext3D() handl
boliu 2013/06/07 18:46:18 With the new contract in OutputSurface, we can jus
+
+ return success;
+}
+
bool SynchronousCompositorOutputSurface::DemandDrawHw(
- gfx::Size surface_size,
- const gfx::Transform& transform,
- gfx::Rect clip) {
+ gfx::Size surface_size,
+ const gfx::Transform& transform,
+ gfx::Rect clip) {
DCHECK(CalledOnValidThread());
DCHECK(client_);
DCHECK(context3d());
@@ -211,6 +219,8 @@ bool SynchronousCompositorOutputSurface::DemandDrawHw(
client_->SetExternalDrawConstraints(adjusted_transform, clip);
InvokeComposite(clip.size());
+ // TODO(boliu): Check if context is lost here.
+
return did_swap_buffer_;
}

Powered by Google App Engine
This is Rietveld 408576698