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

Unified Diff: ash/wm/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: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index d10dca36819c4e45983b351395f0f5194a2f339f..9e7830755238159f9f8541ad3e6495ec8c752f16 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -112,15 +112,15 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
base::TimeDelta duration =
window->layer()->GetAnimator()->GetTransitionDuration();
- std::unique_ptr<ui::LayerAnimationElement> transition(
+ std::unique_ptr<ui::LayerAnimationElement> transition =
ui::LayerAnimationElement::CreateInterpolatedTransformElement(
- scale.release(), duration));
+ scale.release(), duration);
loyso (OOO) 2016/12/08 00:05:21 std::move(scale) ?
transition->set_tween_type(show ? gfx::Tween::EASE_IN
: gfx::Tween::EASE_IN_OUT);
window->layer()->GetAnimator()->ScheduleAnimation(
- new ui::LayerAnimationSequence(transition.release()));
+ new ui::LayerAnimationSequence(std::move(transition)));
// When hiding a window, turn off blending until the animation is 3 / 4 done
// to save bandwidth and reduce jank.
@@ -387,22 +387,19 @@ std::vector<ui::LayerAnimationSequence*>
CreateBrightnessGrayscaleAnimationSequence(float target_value,
base::TimeDelta duration) {
gfx::Tween::Type animation_type = gfx::Tween::EASE_OUT;
- std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence(
- new ui::LayerAnimationSequence());
- std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence(
- new ui::LayerAnimationSequence());
+ auto brightness_sequence = base::MakeUnique<ui::LayerAnimationSequence>();
+ auto grayscale_sequence = base::MakeUnique<ui::LayerAnimationSequence>();
- std::unique_ptr<ui::LayerAnimationElement> brightness_element(
+ std::unique_ptr<ui::LayerAnimationElement> brightness_element =
ui::LayerAnimationElement::CreateBrightnessElement(target_value,
- duration));
+ duration);
brightness_element->set_tween_type(animation_type);
- brightness_sequence->AddElement(brightness_element.release());
+ brightness_sequence->AddElement(std::move(brightness_element));
- std::unique_ptr<ui::LayerAnimationElement> grayscale_element(
- ui::LayerAnimationElement::CreateGrayscaleElement(target_value,
- duration));
+ std::unique_ptr<ui::LayerAnimationElement> grayscale_element =
+ ui::LayerAnimationElement::CreateGrayscaleElement(target_value, duration);
grayscale_element->set_tween_type(animation_type);
- grayscale_sequence->AddElement(grayscale_element.release());
+ grayscale_sequence->AddElement(std::move(grayscale_element));
std::vector<ui::LayerAnimationSequence*> animations;
animations.push_back(brightness_sequence.release());

Powered by Google App Engine
This is Rietveld 408576698