Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1215)

Side by Side Diff: ui/compositor/test/layer_animator_test_controller.cc

Issue 11896017: Thread ui opacity animations (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix ash_unittests Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/compositor/test/layer_animator_test_controller.h"
6 #include "ui/compositor/layer_animation_sequence.h"
7
8 namespace ui {
9
10 LayerAnimatorTestController::LayerAnimatorTestController(
11 scoped_refptr<LayerAnimator> animator)
12 : animator_(animator) {
13 }
14
15 LayerAnimatorTestController::~LayerAnimatorTestController() {
16 }
17
18 LayerAnimationSequence* LayerAnimatorTestController::GetRunningSequence(
19 LayerAnimationElement::AnimatableProperty property) {
20 LayerAnimator::RunningAnimation* running_animation =
21 animator_->GetRunningAnimation(property);
22 if (running_animation)
23 return running_animation->sequence();
24 else
25 return NULL;
26 }
27
28 void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() {
29 LayerAnimationSequence* sequence =
30 GetRunningSequence(LayerAnimationElement::OPACITY);
31
32 if (!sequence)
33 return;
34
35 LayerAnimationElement* element = sequence->CurrentElement();
36 if (element->properties().find(LayerAnimationElement::OPACITY) ==
37 element->properties().end())
38 return;
39
40 if (!element->Started() ||
41 element->effective_start_time() != base::TimeTicks())
42 return;
43
44 animator_->OnThreadedAnimationStarted(cc::AnimationEvent(
45 cc::AnimationEvent::Started,
46 0,
47 element->animation_group_id(),
48 cc::Animation::Opacity,
49 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()));
50 }
51
52 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/layer_animator_test_controller.h ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698