| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
| 8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
| 9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
| 10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 561 } |
| 562 | 562 |
| 563 virtual void NotifyAnimationStarted( | 563 virtual void NotifyAnimationStarted( |
| 564 base::TimeTicks monotonic_time, | 564 base::TimeTicks monotonic_time, |
| 565 Animation::TargetProperty target_property) OVERRIDE { | 565 Animation::TargetProperty target_property) OVERRIDE { |
| 566 LayerAnimationController* controller = | 566 LayerAnimationController* controller = |
| 567 layer_tree_host()->root_layer()->children()[0]-> | 567 layer_tree_host()->root_layer()->children()[0]-> |
| 568 layer_animation_controller(); | 568 layer_animation_controller(); |
| 569 Animation* animation = | 569 Animation* animation = |
| 570 controller->GetAnimation(Animation::Opacity); | 570 controller->GetAnimation(Animation::Opacity); |
| 571 main_start_time_ = animation->start_time(); | 571 main_start_time_ = |
| 572 (animation->start_time() - base::TimeTicks()).InSecondsF(); |
| 572 controller->RemoveAnimation(animation->id()); | 573 controller->RemoveAnimation(animation->id()); |
| 573 | 574 |
| 574 if (impl_start_time_ > 0.0) | 575 if (impl_start_time_ > 0.0) |
| 575 EndTest(); | 576 EndTest(); |
| 576 } | 577 } |
| 577 | 578 |
| 578 virtual void UpdateAnimationState( | 579 virtual void UpdateAnimationState( |
| 579 LayerTreeHostImpl* impl_host, | 580 LayerTreeHostImpl* impl_host, |
| 580 bool has_unfinished_animation) OVERRIDE { | 581 bool has_unfinished_animation) OVERRIDE { |
| 581 LayerAnimationController* controller = | 582 LayerAnimationController* controller = |
| 582 impl_host->active_tree()->root_layer()->children()[0]-> | 583 impl_host->active_tree()->root_layer()->children()[0]-> |
| 583 layer_animation_controller(); | 584 layer_animation_controller(); |
| 584 Animation* animation = | 585 Animation* animation = |
| 585 controller->GetAnimation(Animation::Opacity); | 586 controller->GetAnimation(Animation::Opacity); |
| 586 if (!animation) | 587 if (!animation) |
| 587 return; | 588 return; |
| 588 | 589 |
| 589 impl_start_time_ = animation->start_time(); | 590 impl_start_time_ = |
| 591 (animation->start_time() - base::TimeTicks()).InSecondsF(); |
| 590 controller->RemoveAnimation(animation->id()); | 592 controller->RemoveAnimation(animation->id()); |
| 591 | 593 |
| 592 if (main_start_time_ > 0.0) | 594 if (main_start_time_ > 0.0) |
| 593 EndTest(); | 595 EndTest(); |
| 594 } | 596 } |
| 595 | 597 |
| 596 virtual void AfterTest() OVERRIDE { | 598 virtual void AfterTest() OVERRIDE { |
| 597 EXPECT_FLOAT_EQ(impl_start_time_, main_start_time_); | 599 EXPECT_FLOAT_EQ(impl_start_time_, main_start_time_); |
| 598 } | 600 } |
| 599 | 601 |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 int num_draw_attempts_; | 1241 int num_draw_attempts_; |
| 1240 base::TimeTicks last_main_thread_tick_time_; | 1242 base::TimeTicks last_main_thread_tick_time_; |
| 1241 base::TimeTicks expected_impl_tick_time_; | 1243 base::TimeTicks expected_impl_tick_time_; |
| 1242 }; | 1244 }; |
| 1243 | 1245 |
| 1244 // Only the non-impl-paint multi-threaded compositor freezes animations. | 1246 // Only the non-impl-paint multi-threaded compositor freezes animations. |
| 1245 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime); | 1247 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime); |
| 1246 | 1248 |
| 1247 } // namespace | 1249 } // namespace |
| 1248 } // namespace cc | 1250 } // namespace cc |
| OLD | NEW |