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

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

Issue 15875009: Refactor SynchronousCompositor out of SynchronousCompositorOutputSurface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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..216bab831f328c8a4d19780ea5f5597791a57224 100644
--- a/content/renderer/android/synchronous_compositor_output_surface.cc
+++ b/content/renderer/android/synchronous_compositor_output_surface.cc
@@ -87,12 +87,11 @@ class SynchronousCompositorOutputSurface::SoftwareDevice
};
SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
- int32 routing_id)
- : cc::OutputSurface(CreateWebGraphicsContext3D(),
- scoped_ptr<cc::SoftwareOutputDevice>(
- new SoftwareDevice(this))),
- compositor_client_(NULL),
- routing_id_(routing_id),
+ SynchronousCompositorOutputSurfaceDelegate* delegate)
+ : cc::OutputSurface(
+ CreateWebGraphicsContext3D(),
+ scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
+ delegate_(delegate),
needs_begin_frame_(false),
did_swap_buffer_(false),
current_sw_canvas_(NULL) {
@@ -101,8 +100,7 @@ SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
DCHECK(CalledOnValidThread());
- if (compositor_client_)
- compositor_client_->DidDestroyCompositor(this);
+ delegate_->DidDestroySynchronousOutputSurface();
}
bool SynchronousCompositorOutputSurface::ForcedDrawToSoftwareDevice() const {
@@ -114,8 +112,7 @@ bool SynchronousCompositorOutputSurface::BindToClient(
DCHECK(CalledOnValidThread());
if (!cc::OutputSurface::BindToClient(surface_client))
return false;
- GetContentClient()->renderer()->DidCreateSynchronousCompositor(routing_id_,
- this);
+ delegate_->DidCreateSynchronousOutputSurface();
return true;
}
@@ -133,7 +130,7 @@ void SynchronousCompositorOutputSurface::SetNeedsBeginFrame(
bool enable) {
DCHECK(CalledOnValidThread());
needs_begin_frame_ = enable;
- UpdateCompositorClientSettings();
+ delegate_->SetContinuousInvalidate(needs_begin_frame_);
}
void SynchronousCompositorOutputSurface::SwapBuffers(
@@ -142,13 +139,6 @@ void SynchronousCompositorOutputSurface::SwapBuffers(
did_swap_buffer_ = true;
}
-void SynchronousCompositorOutputSurface::SetClient(
- SynchronousCompositorClient* compositor_client) {
- DCHECK(CalledOnValidThread());
- compositor_client_ = compositor_client;
- UpdateCompositorClientSettings();
-}
-
bool SynchronousCompositorOutputSurface::IsHwReady() {
return context3d() != NULL;
}
@@ -201,12 +191,6 @@ void SynchronousCompositorOutputSurface::InvokeComposite(
client_->BeginFrame(base::TimeTicks::Now());
}
-void SynchronousCompositorOutputSurface::UpdateCompositorClientSettings() {
- if (compositor_client_) {
- compositor_client_->SetContinuousInvalidate(needs_begin_frame_);
- }
-}
-
// Not using base::NonThreadSafe as we want to enforce a more exacting threading
// requirement: SynchronousCompositorOutputSurface() must only be used by
// embedders that supply their own compositor loop via

Powered by Google App Engine
This is Rietveld 408576698