diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-03 01:24:46 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-03 01:24:46 +0000 |
commit | 3c90fbf66e5a61be5a02be8b4fe8bbf3bff32c75 (patch) | |
tree | faf60cab7cab4304c995aa718e179ea5b9c988ef /ash | |
parent | db683c912eaf6b81ba64d49d4b3d796450609c90 (diff) | |
download | chromium_src-3c90fbf66e5a61be5a02be8b4fe8bbf3bff32c75.zip chromium_src-3c90fbf66e5a61be5a02be8b4fe8bbf3bff32c75.tar.gz chromium_src-3c90fbf66e5a61be5a02be8b4fe8bbf3bff32c75.tar.bz2 |
compositor: Tick the UI animations from cc, instead of from timer callbacks.
Update the animations in the UI in response to the animation step in the compositor,
instead of from a timer callback. This should make it more difficult for rogue UI
animations to negatively impact the system too much.
BUG=371071
R=ajuma@chromium.org, piman@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/291843012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/desktop_background/desktop_background_controller_unittest.cc | 4 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager_unittest.cc | 7 | ||||
-rw-r--r-- | ash/wm/window_animations_unittest.cc | 24 | ||||
-rw-r--r-- | ash/wm/workspace_controller_unittest.cc | 7 |
4 files changed, 21 insertions, 21 deletions
diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc index 4e87be6..609ea14 100644 --- a/ash/desktop_background/desktop_background_controller_unittest.cc +++ b/ash/desktop_background/desktop_background_controller_unittest.cc @@ -53,13 +53,13 @@ void RunAnimationForWidget(views::Widget* widget) { ui::Layer* layer = widget->GetNativeView()->layer(); ui::LayerAnimatorTestController controller(layer->GetAnimator()); - gfx::AnimationContainerElement* element = layer->GetAnimator(); // Multiple steps are required to complete complex animations. // TODO(vollick): This should not be necessary. crbug.com/154017 while (controller.animator()->is_animating()) { controller.StartThreadedAnimationsIfNeeded(); base::TimeTicks step_time = controller.animator()->last_step_time(); - element->Step(step_time + base::TimeDelta::FromMilliseconds(1000)); + layer->GetAnimator()->Step(step_time + + base::TimeDelta::FromMilliseconds(1000)); } } diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 3a38fc0..dd5a35d 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -34,7 +34,6 @@ #include "ui/compositor/layer_animator.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/events/gestures/gesture_configuration.h" -#include "ui/gfx/animation/animation_container_element.h" #include "ui/gfx/display.h" #include "ui/gfx/screen.h" #include "ui/views/controls/label.h" @@ -50,10 +49,8 @@ namespace ash { namespace { void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { - gfx::AnimationContainerElement* element = - static_cast<gfx::AnimationContainerElement*>( - widget->GetNativeView()->layer()->GetAnimator()); - element->Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); + widget->GetNativeView()->layer()->GetAnimator()->Step( + base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); } ShelfWidget* GetShelfWidget() { diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc index 7df1c49..0e1a4d8 100644 --- a/ash/wm/window_animations_unittest.cc +++ b/ash/wm/window_animations_unittest.cc @@ -16,7 +16,6 @@ #include "ui/compositor/layer_animator.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/compositor/scoped_layer_animation_settings.h" -#include "ui/gfx/animation/animation_container_element.h" using aura::Window; using ui::Layer; @@ -89,11 +88,8 @@ TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) { EXPECT_TRUE(window->layer()->visible()); // Stays shown. - gfx::AnimationContainerElement* element = - static_cast<gfx::AnimationContainerElement*>( - window->layer()->GetAnimator()); - element->Step(base::TimeTicks::Now() + - base::TimeDelta::FromSeconds(5)); + window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + + base::TimeDelta::FromSeconds(5)); EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness()); EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale()); EXPECT_TRUE(window->layer()->visible()); @@ -141,10 +137,10 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) { EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform()); // Run the animations to completion. - static_cast<gfx::AnimationContainerElement*>(old_layer->GetAnimator())->Step( - base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); - static_cast<gfx::AnimationContainerElement*>(window->layer()->GetAnimator())-> - Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); + old_layer->GetAnimator()->Step(base::TimeTicks::Now() + + base::TimeDelta::FromSeconds(1)); + window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + + base::TimeDelta::FromSeconds(1)); // Cross fade to a smaller size, as in a restore animation. old_layer = window->layer(); @@ -163,10 +159,10 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) { EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); EXPECT_EQ(gfx::Transform(), window->layer()->GetTargetTransform()); - static_cast<gfx::AnimationContainerElement*>(old_layer->GetAnimator())->Step( - base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); - static_cast<gfx::AnimationContainerElement*>(window->layer()->GetAnimator())-> - Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); + old_layer->GetAnimator()->Step(base::TimeTicks::Now() + + base::TimeDelta::FromSeconds(1)); + window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + + base::TimeDelta::FromSeconds(1)); } } // namespace wm diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index fcfa414..0504a4b 100644 --- a/ash/wm/workspace_controller_unittest.cc +++ b/ash/wm/workspace_controller_unittest.cc @@ -31,6 +31,7 @@ #include "ui/base/ui_base_types.h" #include "ui/compositor/layer.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" +#include "ui/compositor/test/draw_waiter_for_test.h" #include "ui/events/event_utils.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" @@ -1236,6 +1237,12 @@ TEST_F(WorkspaceControllerTest, AnimatedNormToMaxToNormRepositionsRemaining) { desktop_area.width() - window1->bounds().width()) + ",32 640x320", window1->bounds().ToString()); EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); + + // Wait for the compositor to draw, which would terminate the pending + // animations. + ui::Compositor* compositor = window2->layer()->GetCompositor(); + while (compositor->layer_animator_collection()->HasActiveAnimators()) + ui::DrawWaiterForTest::Wait(compositor); } // This tests simulates a browser and an app and verifies the ordering of the |