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

Side by Side Diff: ui/compositor/layer_animator.cc

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Complete inclusion Created 4 years 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // on the layer animation delegate immediately. 87 // on the layer animation delegate immediately.
88 #define ANIMATED_PROPERTY(type, property, name, member_type, member) \ 88 #define ANIMATED_PROPERTY(type, property, name, member_type, member) \
89 void LayerAnimator::Set##name(type value) { \ 89 void LayerAnimator::Set##name(type value) { \
90 base::TimeDelta duration = GetTransitionDuration(); \ 90 base::TimeDelta duration = GetTransitionDuration(); \
91 if (duration.is_zero() && delegate() && \ 91 if (duration.is_zero() && delegate() && \
92 (preemption_strategy_ != ENQUEUE_NEW_ANIMATION)) { \ 92 (preemption_strategy_ != ENQUEUE_NEW_ANIMATION)) { \
93 StopAnimatingProperty(LayerAnimationElement::property); \ 93 StopAnimatingProperty(LayerAnimationElement::property); \
94 delegate()->Set##name##FromAnimation(value); \ 94 delegate()->Set##name##FromAnimation(value); \
95 return; \ 95 return; \
96 } \ 96 } \
97 std::unique_ptr<LayerAnimationElement> element( \ 97 std::unique_ptr<LayerAnimationElement> element = \
98 LayerAnimationElement::Create##name##Element(value, duration)); \ 98 LayerAnimationElement::Create##name##Element(value, duration); \
99 element->set_tween_type(tween_type_); \ 99 element->set_tween_type(tween_type_); \
100 StartAnimation(new LayerAnimationSequence(element.release())); \ 100 StartAnimation(new LayerAnimationSequence(std::move(element))); \
101 } \ 101 } \
102 \ 102 \
103 member_type LayerAnimator::GetTarget##name() const { \ 103 member_type LayerAnimator::GetTarget##name() const { \
104 LayerAnimationElement::TargetValue target(delegate()); \ 104 LayerAnimationElement::TargetValue target(delegate()); \
105 GetTargetValue(&target); \ 105 GetTargetValue(&target); \
106 return target.member; \ 106 return target.member; \
107 } 107 }
108 108
109 ANIMATED_PROPERTY( 109 ANIMATED_PROPERTY(
110 const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform); 110 const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform);
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 const base::WeakPtr<LayerAnimationSequence>& sequence) 931 const base::WeakPtr<LayerAnimationSequence>& sequence)
932 : sequence_(sequence) { 932 : sequence_(sequence) {
933 } 933 }
934 934
935 LayerAnimator::RunningAnimation::RunningAnimation( 935 LayerAnimator::RunningAnimation::RunningAnimation(
936 const RunningAnimation& other) = default; 936 const RunningAnimation& other) = default;
937 937
938 LayerAnimator::RunningAnimation::~RunningAnimation() { } 938 LayerAnimator::RunningAnimation::~RunningAnimation() { }
939 939
940 } // namespace ui 940 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698