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

Unified Diff: ash/wm/session_state_animator_impl.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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/session_state_animator_impl.cc
diff --git a/ash/wm/session_state_animator_impl.cc b/ash/wm/session_state_animator_impl.cc
index 783a2ba8c2f168c8a3b9879268042483943b2477..c0be9304de9af6708192d7de89739c5b675bd339 100644
--- a/ash/wm/session_state_animator_impl.cc
+++ b/ash/wm/session_state_animator_impl.cc
@@ -9,6 +9,7 @@
#include "ash/common/wm/wm_window_animations.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
+#include "base/memory/ptr_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/layer_animation_observer.h"
@@ -254,20 +255,20 @@ void StartGrayscaleBrightnessAnimationForWindow(
ui::LayerAnimationObserver* observer) {
ui::LayerAnimator* animator = window->layer()->GetAnimator();
- std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence(
- new ui::LayerAnimationSequence());
- std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence(
- new ui::LayerAnimationSequence());
+ std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence =
+ base::MakeUnique<ui::LayerAnimationSequence>();
+ std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence =
+ base::MakeUnique<ui::LayerAnimationSequence>();
- std::unique_ptr<ui::LayerAnimationElement> brightness_element(
- ui::LayerAnimationElement::CreateBrightnessElement(target, duration));
+ std::unique_ptr<ui::LayerAnimationElement> brightness_element =
+ ui::LayerAnimationElement::CreateBrightnessElement(target, duration);
brightness_element->set_tween_type(tween_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, duration));
+ std::unique_ptr<ui::LayerAnimationElement> grayscale_element =
+ ui::LayerAnimationElement::CreateGrayscaleElement(target, duration);
grayscale_element->set_tween_type(tween_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