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

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

Issue 16430005: Call OnSwapBuffersComplete at the end of each frame (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d5876e41a3ef8d7ab4a7002a001daff9553cd45a..6a4f7cfe2a470c1ce79ccc7a7864f01316cc91aa 100644
--- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc
+++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc
@@ -62,12 +62,16 @@ class SynchronousCompositorOutputSurface::SoftwareDevice
}
virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE {
DCHECK(surface_->current_sw_canvas_);
- if (surface_->current_sw_canvas_)
- return surface_->current_sw_canvas_;
- return &null_canvas_;
+ if (!surface_->current_sw_canvas_) {
+ LOG(WARNING) << "BeginPaint with no canvas set";
+ return &null_canvas_;
+ }
+ LOG_IF(WARNING, surface_->did_swap_buffer_)
+ << "Mutliple calls to BeginPaint per frame";
+ return surface_->current_sw_canvas_;
}
virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE {
- surface_->current_sw_canvas_ = NULL;
+ surface_->did_swap_buffer_ = true;
}
virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output) OVERRIDE {
NOTIMPLEMENTED();
@@ -173,9 +177,8 @@ bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
InvokeComposite(transform, damage_area);
- bool finished_draw = current_sw_canvas_ == NULL;
current_sw_canvas_ = NULL;
- return finished_draw;
+ return did_swap_buffer_;
}
bool SynchronousCompositorOutputSurface::DemandDrawHw(
@@ -194,7 +197,6 @@ bool SynchronousCompositorOutputSurface::DemandDrawHw(
if (current_context)
current_context->ReleaseCurrent(NULL);
- did_swap_buffer_ = false;
InvokeComposite(transform, damage_area);
@@ -204,11 +206,15 @@ bool SynchronousCompositorOutputSurface::DemandDrawHw(
void SynchronousCompositorOutputSurface::InvokeComposite(
const gfx::Transform& transform,
gfx::Rect damage_area) {
+ did_swap_buffer_ = false;
// TODO(boliu): This assumes |transform| is identity and |damage_area| is the
// whole view. Tracking bug to implement this: crbug.com/230463.
client_->SetNeedsRedrawRect(damage_area);
if (needs_begin_frame_)
client_->BeginFrame(base::TimeTicks::Now());
+
+ if (did_swap_buffer_)
+ client_->OnSwapBuffersComplete();
no sievers 2013/06/05 21:08:05 Is it even more straightforward to call this from
joth 2013/06/05 21:26:40 SwapBuffers() isn't called in the SW draw case.
}
// Not using base::NonThreadSafe as we want to enforce a more exacting threading
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698