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

Unified Diff: ui/wm/core/window_animations.cc

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Make all LayerAnimationElement::Create*Element return unique_ptr 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 side-by-side diff with in-line comments
Download patch
Index: ui/wm/core/window_animations.cc
diff --git a/ui/wm/core/window_animations.cc b/ui/wm/core/window_animations.cc
index c32da2952fd77c9e4761381eb64b9cce11f6baf7..432c054d35fc82937415d409b838e2d64645bd10 100644
--- a/ui/wm/core/window_animations.cc
+++ b/ui/wm/core/window_animations.cc
@@ -351,8 +351,9 @@ void AnimateHideWindow_Fade(aura::Window* window) {
AnimateHideWindowCommon(window, gfx::Transform());
}
-ui::LayerAnimationElement* CreateGrowShrinkElement(
- aura::Window* window, bool grow) {
+std::unique_ptr<ui::LayerAnimationElement> CreateGrowShrinkElement(
+ aura::Window* window,
+ bool grow) {
std::unique_ptr<ui::InterpolatedTransform> scale(
new ui::InterpolatedScale(gfx::Point3F(kWindowAnimation_Bounce_Scale,
kWindowAnimation_Bounce_Scale, 1),
@@ -363,14 +364,14 @@ ui::LayerAnimationElement* CreateGrowShrinkElement(
window->bounds().height() * 0.5),
scale.release()));
scale_about_pivot->SetReversed(grow);
- std::unique_ptr<ui::LayerAnimationElement> transition(
+ std::unique_ptr<ui::LayerAnimationElement> transition =
ui::LayerAnimationElement::CreateInterpolatedTransformElement(
scale_about_pivot.release(),
base::TimeDelta::FromMilliseconds(
kWindowAnimation_Bounce_DurationMS *
- kWindowAnimation_Bounce_GrowShrinkDurationPercent / 100)));
+ kWindowAnimation_Bounce_GrowShrinkDurationPercent / 100));
transition->set_tween_type(grow ? gfx::Tween::EASE_OUT : gfx::Tween::EASE_IN);
- return transition.release();
+ return transition;
}
void AnimateBounce(aura::Window* window) {
@@ -436,10 +437,10 @@ void AddLayerAnimationsForRotate(aura::Window* window, bool show) {
duration * (100 - kWindowAnimation_Rotate_OpacityDurationPercent) / 100,
ui::LayerAnimationElement::OPACITY);
}
- std::unique_ptr<ui::LayerAnimationElement> opacity(
+ std::unique_ptr<ui::LayerAnimationElement> opacity =
ui::LayerAnimationElement::CreateOpacityElement(
show ? kWindowAnimation_ShowOpacity : kWindowAnimation_HideOpacity,
- duration * kWindowAnimation_Rotate_OpacityDurationPercent / 100));
+ duration * kWindowAnimation_Rotate_OpacityDurationPercent / 100);
opacity->set_tween_type(gfx::Tween::EASE_IN_OUT);
window->layer()->GetAnimator()->ScheduleAnimation(
new ui::LayerAnimationSequence(opacity.release()));
@@ -473,11 +474,11 @@ void AddLayerAnimationsForRotate(aura::Window* window, bool show) {
rotation->SetChild(translation.release());
rotation->SetReversed(show);
- std::unique_ptr<ui::LayerAnimationElement> transition(
+ std::unique_ptr<ui::LayerAnimationElement> transition =
ui::LayerAnimationElement::CreateInterpolatedTransformElement(
- rotation.release(), duration));
+ rotation.release(), duration);
loyso (OOO) 2016/12/08 00:05:21 std::move ?
ui::LayerAnimationSequence* last_sequence =
- new ui::LayerAnimationSequence(transition.release());
+ new ui::LayerAnimationSequence(std::move(transition));
window->layer()->GetAnimator()->ScheduleAnimation(last_sequence);
if (observer) {
« ash/wm/window_animations.cc ('K') | « ui/views/animation/square_ink_drop_ripple.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698