| 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 91de0aee2a9b259b5d3acbad4988c8b3a202b93c..ee9eded467f5c9d1742542ed2f357971454c1fdc 100644
|
| --- a/content/browser/renderer_host/compositor_impl_android.h
|
| +++ b/content/browser/renderer_host/compositor_impl_android.h
|
| @@ -6,10 +6,10 @@
|
| #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/cancelable_callback.h"
|
| #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"
|
| @@ -104,13 +104,36 @@ class CONTENT_EXPORT CompositorImpl
|
| scoped_ptr<cc::CopyOutputRequest> request) OVERRIDE;
|
| virtual void OnVSync(base::TimeTicks frame_time,
|
| base::TimeDelta vsync_period) OVERRIDE;
|
| + virtual void SetNeedsAnimate() OVERRIDE;
|
|
|
| - void PostComposite(base::TimeDelta delay);
|
| enum CompositingTrigger {
|
| + DO_NOT_COMPOSITE,
|
| COMPOSITE_IMMEDIATELY,
|
| - COMPOSITE_ON_VSYNC
|
| + COMPOSITE_EVENTUALLY,
|
| };
|
| + void PostComposite(CompositingTrigger trigger);
|
| void Composite(CompositingTrigger trigger);
|
| +
|
| + bool WillCompositeThisFrame() {
|
| + return current_composite_task_ &&
|
| + !current_composite_task_->callback().is_null();
|
| + }
|
| + bool DidCompositeThisFrame() {
|
| + return current_composite_task_ &&
|
| + current_composite_task_->callback().is_null();
|
| + }
|
| + bool WillComposite() {
|
| + return WillCompositeThisFrame() ||
|
| + composite_on_vsync_trigger_ != DO_NOT_COMPOSITE;
|
| + }
|
| + void CancelComposite() {
|
| + DCHECK(WillComposite());
|
| + if (WillCompositeThisFrame())
|
| + current_composite_task_->Cancel();
|
| + current_composite_task_.reset();
|
| + composite_on_vsync_trigger_ = DO_NOT_COMPOSITE;
|
| + will_composite_immediately_ = false;
|
| + }
|
| cc::UIResourceId GenerateUIResourceFromUIResourceBitmap(
|
| const cc::UIResourceBitmap& bitmap,
|
| bool is_transient);
|
| @@ -144,20 +167,24 @@ class CONTENT_EXPORT CompositorImpl
|
| // explicit request.
|
| bool needs_composite_;
|
|
|
| - // When SetNeedsComposite() is getting called, we will try to schedule
|
| - // regularly during vsync.
|
| - bool should_composite_on_vsync_;
|
| + // Whether we need to update animations on the next composite.
|
| + bool needs_animate_;
|
| +
|
| + // Whether we posted a task and are about to composite.
|
| + bool will_composite_immediately_;
|
|
|
| - // Whether we composited already in the current vsync interval.
|
| - bool did_composite_this_frame_;
|
| + // How we should schedule Composite during the next vsync.
|
| + CompositingTrigger composite_on_vsync_trigger_;
|
| +
|
| + // The Composite operation scheduled for the current vsync interval.
|
| + scoped_ptr<base::CancelableClosure> current_composite_task_;
|
|
|
| // 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_;
|
| + base::TimeTicks last_vsync_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
|
| };
|
|
|