Chromium Code Reviews| 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 38bf88b3283a41b11aa573dd5a8a3bc8608de40f..a9fcfb9aded0697ad3be40288326cd2f51e4f8ae 100644 |
| --- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
| +++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc |
| @@ -88,6 +88,7 @@ SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( |
| scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), |
| routing_id_(routing_id), |
| needs_begin_frame_(false), |
| + invoking_composite_(false), |
| did_swap_buffer_(false), |
| current_sw_canvas_(NULL) { |
| capabilities_.deferred_gl_initialization = true; |
| @@ -104,7 +105,11 @@ SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() { |
| } |
| bool SynchronousCompositorOutputSurface::ForcedDrawToSoftwareDevice() const { |
| - return current_sw_canvas_ != NULL; |
| + // |current_sw_canvas_| indicates we're in a DemandDrawSw call. In addition |
| + // |invoking_composite_| == false indicates an attempt to draw outside of |
| + // the synchronous compositor's control: force it into SW path and hence to |
| + // the null canvas (and will log a warning there). |
| + return current_sw_canvas_ != NULL || !invoking_composite_; |
| } |
| bool SynchronousCompositorOutputSurface::BindToClient( |
| @@ -218,6 +223,7 @@ bool SynchronousCompositorOutputSurface::DemandDrawSw(SkCanvas* canvas) { |
| void SynchronousCompositorOutputSurface::InvokeComposite( |
| gfx::Size damage_size) { |
| + invoking_composite_ = true; |
|
boliu
2013/06/21 22:40:14
Use base::AutoReset?
joth
2013/06/21 23:02:14
Done.
Nice! Thought that existed, but I was searc
|
| did_swap_buffer_ = false; |
| SetNeedsRedrawRect(gfx::Rect(damage_size)); |
| if (needs_begin_frame_) |
| @@ -225,6 +231,7 @@ void SynchronousCompositorOutputSurface::InvokeComposite( |
| if (did_swap_buffer_) |
| OnSwapBuffersComplete(NULL); |
| + invoking_composite_ = false; |
| } |
| void SynchronousCompositorOutputSurface::PostCheckForRetroactiveBeginFrame() { |