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

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: Fix SoftwareRenderer & tests to use OnSwapBufferComplete too 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 | « cc/test/fake_output_surface.cc ('k') | 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 b0e2d0e3a4918de3c5470bdce41541f0f433a657..8715628634c99082a974f250a45f485f55e316b3 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();
@@ -182,9 +186,8 @@ bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) {
InvokeComposite(clip.size());
- bool finished_draw = current_sw_canvas_ == NULL;
current_sw_canvas_ = NULL;
- return finished_draw;
+ return did_swap_buffer_;
}
bool SynchronousCompositorOutputSurface::DemandDrawHw(
@@ -203,22 +206,23 @@ bool SynchronousCompositorOutputSurface::DemandDrawHw(
if (current_context)
current_context->ReleaseCurrent(NULL);
- did_swap_buffer_ = false;
-
- gfx::Transform adjusted_transform = transform;
- AdjustTransformForClip(&adjusted_transform, clip);
- surface_size_ = surface_size;
- client_->SetExternalDrawConstraints(adjusted_transform, clip);
- InvokeComposite(clip.size());
+ InvokeComposite(transform, damage_area);
return did_swap_buffer_;
}
void SynchronousCompositorOutputSurface::InvokeComposite(
- gfx::Size damage_size) {
- client_->SetNeedsRedrawRect(gfx::Rect(damage_size));
+ 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.
joth 2013/06/07 04:02:51 BUG: rebase resolve error.
joth 2013/06/07 04:28:48 fixed in PS5
+ client_->SetNeedsRedrawRect(damage_area);
if (needs_begin_frame_)
client_->BeginFrame(base::TimeTicks::Now());
+
+ if (did_swap_buffer_)
+ client_->OnSwapBuffersComplete();
joth 2013/06/07 04:02:05 BUG: I need to call this back async, as per FakeOu
joth 2013/06/07 04:28:48 Actually, not a bug at all. By the point we get he
}
// Not using base::NonThreadSafe as we want to enforce a more exacting threading
« no previous file with comments | « cc/test/fake_output_surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698