diff options
Diffstat (limited to 'cc/trees')
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 5 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 41 | ||||
-rw-r--r-- | cc/trees/single_thread_proxy.h | 2 | ||||
-rw-r--r-- | cc/trees/thread_proxy.cc | 8 | ||||
-rw-r--r-- | cc/trees/thread_proxy.h | 2 |
7 files changed, 61 insertions, 2 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 657e72f..3bcf3ff 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -369,6 +369,11 @@ bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) { return false; } +void LayerTreeHostImpl::DidReceiveLastInputEventForVSync( + base::TimeTicks frame_time) { + client_->DidReceiveLastInputEventForVSync(frame_time); +} + void LayerTreeHostImpl::TrackDamageForAllSurfaces( LayerImpl* root_draw_layer, const LayerImplList& render_surface_layer_list) { diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index c31fba1..f8e5ac3 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -72,6 +72,7 @@ class LayerTreeHostImplClient { virtual bool IsInsideDraw() = 0; virtual void RenewTreePriority() = 0; virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; + virtual void DidReceiveLastInputEventForVSync(base::TimeTicks frame_time) = 0; protected: virtual ~LayerTreeHostImplClient() {} @@ -113,6 +114,8 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, base::TimeDelta duration) OVERRIDE; virtual void ScheduleAnimation() OVERRIDE; virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE; + virtual void DidReceiveLastInputEventForVSync( + base::TimeTicks frame_time) OVERRIDE; // TopControlsManagerClient implementation. virtual void DidChangeTopControlsPosition() OVERRIDE; diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index dae900b..9e9c80d 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -126,6 +126,8 @@ class LayerTreeHostImplTest : public testing::Test, virtual void RenewTreePriority() OVERRIDE {} virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) OVERRIDE {} + virtual void DidReceiveLastInputEventForVSync(base::TimeTicks frame_time) + OVERRIDE {} void set_reduce_memory_result(bool reduce_memory_result) { reduce_memory_result_ = reduce_memory_result; diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 3cf4939..046699e1 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -8,6 +8,7 @@ #include "base/synchronization/lock.h" #include "cc/animation/timing_function.h" +#include "cc/debug/frame_rate_counter.h" #include "cc/layers/content_layer.h" #include "cc/layers/content_layer_client.h" #include "cc/layers/io_surface_layer.h" @@ -2296,8 +2297,7 @@ class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest { return true; } - virtual void AfterTest() OVERRIDE { - } + virtual void AfterTest() OVERRIDE {} private: base::TimeTicks frame_time_; @@ -2305,6 +2305,43 @@ class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest { MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); +class LayerTreeHostTestInputDrivenRendering : public LayerTreeHostTest { + public: + virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { + settings->render_vsync_notification_enabled = true; + } + + virtual void BeginTest() OVERRIDE { + frame_time_ = base::TimeTicks::Now(); + PostSetNeedsCommitToMainThread(); + } + + virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { + // Post a task to send the final input event for the current vsync; it + // should trigger rendering. + ImplThread()->PostTask( + base::Bind(&LayerTreeHostTestInputDrivenRendering::SendFinalInputEvent, + base::Unretained(this), + base::Unretained(host_impl))); + } + + void SendFinalInputEvent(LayerTreeHostImpl* host_impl) { + host_impl->DidReceiveLastInputEventForVSync(frame_time_); + } + + virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { + EXPECT_EQ(frame_time_, **host_impl->fps_counter()->begin()); + EndTest(); + } + + virtual void AfterTest() OVERRIDE {} + + private: + base::TimeTicks frame_time_; +}; + +MULTI_THREAD_TEST_F(LayerTreeHostTestInputDrivenRendering); + class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation : public LayerTreeHostTest { protected: diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index cf29574..deb0cd9 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -71,6 +71,8 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { virtual void RenewTreePriority() OVERRIDE {} virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) OVERRIDE {} + virtual void DidReceiveLastInputEventForVSync(base::TimeTicks frame_time) + OVERRIDE {} // Called by the legacy path where RenderWidget does the scheduling. void CompositeImmediately(base::TimeTicks frame_begin_time); diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index 7f0f275..bd66d7c 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -1347,4 +1347,12 @@ void ThreadProxy::StartScrollbarAnimationOnImplThread() { layer_tree_host_impl_->CurrentFrameTimeTicks()); } +void ThreadProxy::DidReceiveLastInputEventForVSync( + base::TimeTicks frame_time) { + if (render_vsync_notification_enabled_) { + TRACE_EVENT0("cc", "ThreadProxy::DidReceiveLastInputEventForVSync"); + DidVSync(frame_time); + } +} + } // namespace cc diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h index fccde44..65439b7 100644 --- a/cc/trees/thread_proxy.h +++ b/cc/trees/thread_proxy.h @@ -86,6 +86,8 @@ class ThreadProxy : public Proxy, virtual void RenewTreePriority() OVERRIDE; virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) OVERRIDE; + virtual void DidReceiveLastInputEventForVSync( + base::TimeTicks frame_time) OVERRIDE; // SchedulerClient implementation virtual void ScheduledActionBeginFrame() OVERRIDE; |