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

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

Issue 2622043003: Replaced RefPtr::release with std::move in Source/core. (Closed)
Patch Set: Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/animation/InvalidatableInterpolation.h" 5 #include "core/animation/InvalidatableInterpolation.h"
6 6
7 #include "core/animation/InterpolationEnvironment.h" 7 #include "core/animation/InterpolationEnvironment.h"
8 #include "core/animation/StringKeyframe.h" 8 #include "core/animation/StringKeyframe.h"
9 #include "core/css/resolver/StyleResolverState.h" 9 #include "core/css/resolver/StyleResolverState.h"
10 #include <memory> 10 #include <memory>
(...skipping 28 matching lines...) Expand all
39 continue; 39 continue;
40 ConversionCheckers conversionCheckers; 40 ConversionCheckers conversionCheckers;
41 PairwiseInterpolationValue result = interpolationType->maybeConvertPairwise( 41 PairwiseInterpolationValue result = interpolationType->maybeConvertPairwise(
42 *m_startKeyframe, *m_endKeyframe, environment, 42 *m_startKeyframe, *m_endKeyframe, environment,
43 underlyingValueOwner.value(), conversionCheckers); 43 underlyingValueOwner.value(), conversionCheckers);
44 addConversionCheckers(*interpolationType, conversionCheckers); 44 addConversionCheckers(*interpolationType, conversionCheckers);
45 if (result) { 45 if (result) {
46 return PairwisePrimitiveInterpolation::create( 46 return PairwisePrimitiveInterpolation::create(
47 *interpolationType, std::move(result.startInterpolableValue), 47 *interpolationType, std::move(result.startInterpolableValue),
48 std::move(result.endInterpolableValue), 48 std::move(result.endInterpolableValue),
49 result.nonInterpolableValue.release()); 49 std::move(result.nonInterpolableValue));
50 } 50 }
51 } 51 }
52 return nullptr; 52 return nullptr;
53 } 53 }
54 54
55 std::unique_ptr<TypedInterpolationValue> 55 std::unique_ptr<TypedInterpolationValue>
56 InvalidatableInterpolation::convertSingleKeyframe( 56 InvalidatableInterpolation::convertSingleKeyframe(
57 const PropertySpecificKeyframe& keyframe, 57 const PropertySpecificKeyframe& keyframe,
58 const InterpolationEnvironment& environment, 58 const InterpolationEnvironment& environment,
59 const UnderlyingValueOwner& underlyingValueOwner) const { 59 const UnderlyingValueOwner& underlyingValueOwner) const {
60 if (keyframe.isNeutral() && !underlyingValueOwner) 60 if (keyframe.isNeutral() && !underlyingValueOwner)
61 return nullptr; 61 return nullptr;
62 for (const auto& interpolationType : *m_interpolationTypes) { 62 for (const auto& interpolationType : *m_interpolationTypes) {
63 if (keyframe.isNeutral() && 63 if (keyframe.isNeutral() &&
64 underlyingValueOwner.type() != *interpolationType) 64 underlyingValueOwner.type() != *interpolationType)
65 continue; 65 continue;
66 ConversionCheckers conversionCheckers; 66 ConversionCheckers conversionCheckers;
67 InterpolationValue result = interpolationType->maybeConvertSingle( 67 InterpolationValue result = interpolationType->maybeConvertSingle(
68 keyframe, environment, underlyingValueOwner.value(), 68 keyframe, environment, underlyingValueOwner.value(),
69 conversionCheckers); 69 conversionCheckers);
70 addConversionCheckers(*interpolationType, conversionCheckers); 70 addConversionCheckers(*interpolationType, conversionCheckers);
71 if (result) 71 if (result) {
72 return TypedInterpolationValue::create( 72 return TypedInterpolationValue::create(
73 *interpolationType, std::move(result.interpolableValue), 73 *interpolationType, std::move(result.interpolableValue),
74 result.nonInterpolableValue.release()); 74 std::move(result.nonInterpolableValue));
75 }
75 } 76 }
76 DCHECK(keyframe.isNeutral()); 77 DCHECK(keyframe.isNeutral());
77 return nullptr; 78 return nullptr;
78 } 79 }
79 80
80 void InvalidatableInterpolation::addConversionCheckers( 81 void InvalidatableInterpolation::addConversionCheckers(
81 const InterpolationType& type, 82 const InterpolationType& type,
82 ConversionCheckers& conversionCheckers) const { 83 ConversionCheckers& conversionCheckers) const {
83 for (size_t i = 0; i < conversionCheckers.size(); i++) { 84 for (size_t i = 0; i < conversionCheckers.size(); i++) {
84 conversionCheckers[i]->setType(type); 85 conversionCheckers[i]->setType(type);
85 m_conversionCheckers.push_back(std::move(conversionCheckers[i])); 86 m_conversionCheckers.push_back(std::move(conversionCheckers[i]));
86 } 87 }
87 } 88 }
88 89
89 std::unique_ptr<TypedInterpolationValue> 90 std::unique_ptr<TypedInterpolationValue>
90 InvalidatableInterpolation::maybeConvertUnderlyingValue( 91 InvalidatableInterpolation::maybeConvertUnderlyingValue(
91 const InterpolationEnvironment& environment) const { 92 const InterpolationEnvironment& environment) const {
92 for (const auto& interpolationType : *m_interpolationTypes) { 93 for (const auto& interpolationType : *m_interpolationTypes) {
93 InterpolationValue result = 94 InterpolationValue result =
94 interpolationType->maybeConvertUnderlyingValue(environment); 95 interpolationType->maybeConvertUnderlyingValue(environment);
95 if (result) 96 if (result) {
96 return TypedInterpolationValue::create( 97 return TypedInterpolationValue::create(
97 *interpolationType, std::move(result.interpolableValue), 98 *interpolationType, std::move(result.interpolableValue),
98 result.nonInterpolableValue.release()); 99 std::move(result.nonInterpolableValue));
100 }
99 } 101 }
100 return nullptr; 102 return nullptr;
101 } 103 }
102 104
103 bool InvalidatableInterpolation::dependsOnUnderlyingValue() const { 105 bool InvalidatableInterpolation::dependsOnUnderlyingValue() const {
104 return (m_startKeyframe->underlyingFraction() != 0 && 106 return (m_startKeyframe->underlyingFraction() != 0 &&
105 m_currentFraction != 1) || 107 m_currentFraction != 1) ||
106 (m_endKeyframe->underlyingFraction() != 0 && m_currentFraction != 0); 108 (m_endKeyframe->underlyingFraction() != 0 && m_currentFraction != 0);
107 } 109 }
108 110
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 currentInterpolation.m_currentFraction); 275 currentInterpolation.m_currentFraction);
274 } 276 }
275 277
276 if (shouldApply && underlyingValueOwner) 278 if (shouldApply && underlyingValueOwner)
277 underlyingValueOwner.type().apply( 279 underlyingValueOwner.type().apply(
278 *underlyingValueOwner.value().interpolableValue, 280 *underlyingValueOwner.value().interpolableValue,
279 underlyingValueOwner.value().nonInterpolableValue.get(), environment); 281 underlyingValueOwner.value().nonInterpolableValue.get(), environment);
280 } 282 }
281 283
282 } // namespace blink 284 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698