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

Side by Side Diff: third_party/WebKit/Source/core/animation/CustomCompositorAnimations.cpp

Issue 2286233002: Replaced PassRefPtr copies with moves in Source/core/animation. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "CustomCompositorAnimations.h" 5 #include "CustomCompositorAnimations.h"
6 6
7 #include "core/animation/Animation.h" 7 #include "core/animation/Animation.h"
8 #include "core/animation/DocumentTimeline.h" 8 #include "core/animation/DocumentTimeline.h"
9 #include "core/animation/KeyframeEffect.h" 9 #include "core/animation/KeyframeEffect.h"
10 #include "core/animation/KeyframeEffectModel.h" 10 #include "core/animation/KeyframeEffectModel.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 keyframes[0]->setPropertyValue(propertyId, value.get()); 52 keyframes[0]->setPropertyValue(propertyId, value.get());
53 keyframes[1]->setPropertyValue(propertyId, value.get()); 53 keyframes[1]->setPropertyValue(propertyId, value.get());
54 54
55 AnimatableValueKeyframeEffectModel* effectModel = AnimatableValueKeyframeEff ectModel::create(keyframes); 55 AnimatableValueKeyframeEffectModel* effectModel = AnimatableValueKeyframeEff ectModel::create(keyframes);
56 return KeyframeEffect::create(keyframeEffect.target(), effectModel, keyframe Effect.specifiedTiming()); 56 return KeyframeEffect::create(keyframeEffect.target(), effectModel, keyframe Effect.specifiedTiming());
57 } 57 }
58 58
59 static Animation* createOrUpdateAnimation(Animation* animation, Element& element , CSSPropertyID propertyId, PassRefPtr<AnimatableValue> newValue) 59 static Animation* createOrUpdateAnimation(Animation* animation, Element& element , CSSPropertyID propertyId, PassRefPtr<AnimatableValue> newValue)
60 { 60 {
61 if (!animation) { 61 if (!animation) {
62 KeyframeEffect* keyframeEffect = createInfiniteKeyFrameEffect(element, p ropertyId, newValue); 62 KeyframeEffect* keyframeEffect = createInfiniteKeyFrameEffect(element, p ropertyId, std::move(newValue));
63 return element.document().timeline().play(keyframeEffect); 63 return element.document().timeline().play(keyframeEffect);
64 } 64 }
65 KeyframeEffect* keyframeEffect = updateInfiniteKeyframeEffect(*toKeyframeEff ect(animation->effect()), propertyId, newValue); 65 KeyframeEffect* keyframeEffect = updateInfiniteKeyframeEffect(*toKeyframeEff ect(animation->effect()), propertyId, std::move(newValue));
66 animation->setEffect(keyframeEffect); 66 animation->setEffect(keyframeEffect);
67 return animation; 67 return animation;
68 } 68 }
69 69
70 } // namespace 70 } // namespace
71 71
72 void CustomCompositorAnimations::applyUpdate(Element& element, const CompositorM utation& mutation) 72 void CustomCompositorAnimations::applyUpdate(Element& element, const CompositorM utation& mutation)
73 { 73 {
74 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CustomComposit orAnimations::applyUpdate"); 74 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CustomComposit orAnimations::applyUpdate");
75 75
76 if (mutation.isOpacityMutated()) { 76 if (mutation.isOpacityMutated()) {
77 RefPtr<AnimatableValue> animatableValue = AnimatableDouble::create(mutat ion.opacity()); 77 RefPtr<AnimatableValue> animatableValue = AnimatableDouble::create(mutat ion.opacity());
78 m_animation = createOrUpdateAnimation(m_animation, element, CSSPropertyO pacity, animatableValue.release()); 78 m_animation = createOrUpdateAnimation(m_animation, element, CSSPropertyO pacity, animatableValue.release());
79 } 79 }
80 if (mutation.isTransformMutated()) { 80 if (mutation.isTransformMutated()) {
81 TransformOperations ops; 81 TransformOperations ops;
82 ops.operations().append(Matrix3DTransformOperation::create(Transformatio nMatrix(mutation.transform()))); 82 ops.operations().append(Matrix3DTransformOperation::create(Transformatio nMatrix(mutation.transform())));
83 RefPtr<AnimatableValue> animatableValue = AnimatableTransform::create(op s, 1); 83 RefPtr<AnimatableValue> animatableValue = AnimatableTransform::create(op s, 1);
84 m_animation = createOrUpdateAnimation(m_animation, element, CSSPropertyT ransform, animatableValue.release()); 84 m_animation = createOrUpdateAnimation(m_animation, element, CSSPropertyT ransform, animatableValue.release());
85 } 85 }
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698