Chromium Code Reviews| Index: content/browser/renderer_host/compositor_impl_android.h |
| diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h |
| index 969b1142285f53db11578d47793e0791ca92c900..cd10780b98752fa9d58b213a163aebbde2598130 100644 |
| --- a/content/browser/renderer_host/compositor_impl_android.h |
| +++ b/content/browser/renderer_host/compositor_impl_android.h |
| @@ -9,6 +9,7 @@ |
| #include "base/compiler_specific.h" |
| #include "base/containers/scoped_ptr_hash_map.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "cc/resources/ui_resource_client.h" |
| #include "cc/trees/layer_tree_host_client.h" |
| #include "cc/trees/layer_tree_host_single_thread_client.h" |
| @@ -63,7 +64,7 @@ class CONTENT_EXPORT CompositorImpl |
| virtual void SetHasTransparentBackground(bool flag) OVERRIDE; |
| virtual bool CompositeAndReadback( |
| void *pixels, const gfx::Rect& rect) OVERRIDE; |
| - virtual void Composite() OVERRIDE; |
| + virtual void SetNeedsComposite() OVERRIDE; |
| virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap, |
| bool is_transient) OVERRIDE; |
| virtual cc::UIResourceId GenerateCompressedUIResource(const gfx::Size& size, |
| @@ -76,7 +77,7 @@ class CONTENT_EXPORT CompositorImpl |
| virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} |
| virtual void DidBeginMainFrame() OVERRIDE {} |
| virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {} |
| - virtual void Layout() OVERRIDE {} |
| + virtual void Layout() OVERRIDE; |
| virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, |
| float page_scale) OVERRIDE {} |
| virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) |
| @@ -98,8 +99,12 @@ class CONTENT_EXPORT CompositorImpl |
| // WindowAndroidCompositor implementation. |
| virtual void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) OVERRIDE; |
| + virtual void OnVSync(base::TimeTicks frame_time, |
| + base::TimeDelta vsync_period) OVERRIDE; |
| private: |
| + void PostComposite(base::TimeDelta delay); |
| + void Composite(bool is_vsync); |
|
Sami
2014/05/09 13:21:14
Mind making this an enum -- CompositingTrigger or
no sievers
2014/05/09 22:53:44
Done.
|
| cc::UIResourceId GenerateUIResourceFromUIResourceBitmap( |
| const cc::UIResourceBitmap& bitmap, |
| bool is_transient); |
| @@ -122,6 +127,33 @@ class CONTENT_EXPORT CompositorImpl |
| gfx::NativeWindow root_window_; |
| + // Used locally to track whether a call to LTH::Composite() did result in |
| + // a posted SwapBuffers(). |
| + bool did_post_swapbuffers_; |
| + |
| + // Used locally to inhibit ScheduleComposite() during Layout(). |
| + bool ignore_schedule_composite_; |
| + |
| + // Whether we need to composite in general because of any invalidation or |
| + // explicit request. |
| + bool needs_composite_; |
| + |
| + // When SetNeedsComposite() is getting called, we will try to schedule |
|
Sami
2014/05/09 13:21:14
This explanation should probably go next to SetNee
no sievers
2014/05/09 22:53:44
ScheduleComposite is the LTHClient implementation.
|
| + // regularly during vsync. |
| + bool should_composite_on_vsync_; |
| + |
| + // Whether we composited immediately outside of a vsync callback since |
| + // the last tick. |
| + bool did_composite_outside_vsync_; |
|
Sami
2014/05/09 13:21:14
Would something did_composite_during_this_frame_ b
no sievers
2014/05/09 22:53:44
Done.
|
| + |
| + // The number of SwapBuffer calls that have not returned and ACK'd from |
| + // the GPU thread. |
| + unsigned int pending_swapbuffers_; |
| + |
| + base::TimeDelta vsync_period_; |
| + |
| + base::WeakPtrFactory<CompositorImpl> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
| }; |