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

Unified Diff: ui/compositor/layer_animator.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator.cc
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index 265a568ef45d24d7f4c1e08418b47bc95eec1094..386c8fcba46c29b2c1e82ccf57425813d4f2a393 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -6,8 +6,9 @@
#include <stddef.h>
+#include <memory>
+
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/trace_event/trace_event.h"
#include "cc/animation/animation_events.h"
#include "cc/animation/animation_host.h"
@@ -87,26 +88,26 @@ LayerAnimator* LayerAnimator::CreateImplicitAnimator() {
// It is worth noting that SetFoo avoids invoking the usual animation machinery
// if the transition duration is zero -- in this case we just set the property
// on the layer animation delegate immediately.
-#define ANIMATED_PROPERTY(type, property, name, member_type, member) \
-void LayerAnimator::Set##name(type value) { \
- base::TimeDelta duration = GetTransitionDuration(); \
- if (duration == base::TimeDelta() && delegate() && \
- (preemption_strategy_ != ENQUEUE_NEW_ANIMATION)) { \
- StopAnimatingProperty(LayerAnimationElement::property); \
- delegate()->Set##name##FromAnimation(value); \
- return; \
- } \
- scoped_ptr<LayerAnimationElement> element( \
- LayerAnimationElement::Create##name##Element(value, duration)); \
- element->set_tween_type(tween_type_); \
- StartAnimation(new LayerAnimationSequence(element.release())); \
-} \
- \
-member_type LayerAnimator::GetTarget##name() const { \
- LayerAnimationElement::TargetValue target(delegate()); \
- GetTargetValue(&target); \
- return target.member; \
-}
+#define ANIMATED_PROPERTY(type, property, name, member_type, member) \
+ void LayerAnimator::Set##name(type value) { \
+ base::TimeDelta duration = GetTransitionDuration(); \
+ if (duration == base::TimeDelta() && delegate() && \
+ (preemption_strategy_ != ENQUEUE_NEW_ANIMATION)) { \
+ StopAnimatingProperty(LayerAnimationElement::property); \
+ delegate()->Set##name##FromAnimation(value); \
+ return; \
+ } \
+ std::unique_ptr<LayerAnimationElement> element( \
+ LayerAnimationElement::Create##name##Element(value, duration)); \
+ element->set_tween_type(tween_type_); \
+ StartAnimation(new LayerAnimationSequence(element.release())); \
+ } \
+ \
+ member_type LayerAnimator::GetTarget##name() const { \
+ LayerAnimationElement::TargetValue target(delegate()); \
+ GetTargetValue(&target); \
+ return target.member; \
+ }
ANIMATED_PROPERTY(
const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform);
@@ -212,7 +213,8 @@ void LayerAnimator::DetachLayerFromAnimationPlayer() {
animation_player_->DetachLayer();
}
-void LayerAnimator::AddThreadedAnimation(scoped_ptr<cc::Animation> animation) {
+void LayerAnimator::AddThreadedAnimation(
+ std::unique_ptr<cc::Animation> animation) {
animation_player_->AddAnimation(std::move(animation));
}
@@ -616,7 +618,7 @@ LayerAnimationSequence* LayerAnimator::RemoveAnimation(
void LayerAnimator::FinishAnimation(
LayerAnimationSequence* sequence, bool abort) {
scoped_refptr<LayerAnimator> retain(this);
- scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence));
+ std::unique_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence));
if (abort)
sequence->Abort(delegate());
else
@@ -640,7 +642,7 @@ void LayerAnimator::FinishAnyAnimationWithZeroDuration() {
if (running_animations_copy[i].sequence()->IsFinished(
running_animations_copy[i].sequence()->start_time())) {
SAFE_INVOKE_VOID(ProgressAnimationToEnd, running_animations_copy[i]);
- scoped_ptr<LayerAnimationSequence> removed(
+ std::unique_ptr<LayerAnimationSequence> removed(
SAFE_INVOKE_PTR(RemoveAnimation, running_animations_copy[i]));
}
}
@@ -692,7 +694,7 @@ void LayerAnimator::RemoveAllAnimationsWithACommonProperty(
if (running_animations_copy[i].sequence()->HasConflictingProperty(
sequence->properties())) {
- scoped_ptr<LayerAnimationSequence> removed(
+ std::unique_ptr<LayerAnimationSequence> removed(
SAFE_INVOKE_PTR(RemoveAnimation, running_animations_copy[i]));
if (abort)
running_animations_copy[i].sequence()->Abort(delegate());
@@ -713,7 +715,7 @@ void LayerAnimator::RemoveAllAnimationsWithACommonProperty(
continue;
if (sequences[i]->HasConflictingProperty(sequence->properties())) {
- scoped_ptr<LayerAnimationSequence> removed(
+ std::unique_ptr<LayerAnimationSequence> removed(
RemoveAnimation(sequences[i].get()));
if (abort)
sequences[i]->Abort(delegate());
@@ -930,7 +932,7 @@ void LayerAnimator::ClearAnimationsInternal() {
if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i]))
continue;
- scoped_ptr<LayerAnimationSequence> removed(
+ std::unique_ptr<LayerAnimationSequence> removed(
RemoveAnimation(running_animations_copy[i].sequence()));
if (removed.get())
removed->Abort(delegate());
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698