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

Unified Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 1120003002: [Oilpan] Migrate most classes under core/animations to Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
Index: Source/core/animation/css/CSSAnimations.cpp
diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp
index cd0af54af26edab4b73203b9cb4e0023057417a1..7108a26b085cbc83d46026ba938d44b92321b713 100644
--- a/Source/core/animation/css/CSSAnimations.cpp
+++ b/Source/core/animation/css/CSSAnimations.cpp
@@ -66,7 +66,7 @@ using PropertySet = HashSet<CSSPropertyID>;
namespace {
-static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffect(StyleResolver* resolver, const Element* animatingElement, Element& element, const ComputedStyle* style, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction)
+static StringKeyframeEffectModel* createKeyframeEffect(StyleResolver* resolver, const Element* animatingElement, Element& element, const ComputedStyle* style, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction)
{
// When the animating element is null, use its parent for scoping purposes.
const Element* elementForScoping = animatingElement ? animatingElement : &element;
@@ -80,7 +80,7 @@ static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffect(St
PropertySet specifiedPropertiesForUseCounter;
for (size_t i = 0; i < styleKeyframes.size(); ++i) {
const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get();
- RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create();
+ StringKeyframe* keyframe = StringKeyframe::create();
const Vector<double>& offsets = styleKeyframe->keys();
ASSERT(!offsets.isEmpty());
keyframe->setOffset(offsets[0]);
@@ -108,7 +108,7 @@ static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffect(St
keyframes.append(keyframe);
// The last keyframe specified at a given offset is used.
for (size_t j = 1; j < offsets.size(); ++j) {
- keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get()));
+ keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[j])));
}
}
@@ -133,14 +133,14 @@ static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffect(St
keyframes.shrink(targetIndex + 1);
// Add 0% and 100% keyframes if absent.
- RefPtrWillBeRawPtr<StringKeyframe> startKeyframe = keyframes.isEmpty() ? nullptr : keyframes[0];
+ StringKeyframe* startKeyframe = keyframes.isEmpty() ? nullptr : keyframes[0];
if (!startKeyframe || keyframes[0]->offset() != 0) {
startKeyframe = StringKeyframe::create();
startKeyframe->setOffset(0);
startKeyframe->setEasing(defaultTimingFunction);
keyframes.prepend(startKeyframe);
}
- RefPtrWillBeRawPtr<StringKeyframe> endKeyframe = keyframes[keyframes.size() - 1];
+ StringKeyframe* endKeyframe = keyframes[keyframes.size() - 1];
if (endKeyframe->offset() != 1) {
endKeyframe = StringKeyframe::create();
endKeyframe->setOffset(1);
@@ -172,7 +172,7 @@ static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffect(St
}
}
- RefPtrWillBeRawPtr<StringKeyframeEffectModel> effect = StringKeyframeEffectModel::create(keyframes, &keyframes[0]->easing());
+ StringKeyframeEffectModel* effect = StringKeyframeEffectModel::create(keyframes, &keyframes[0]->easing());
effect->forceConversionsToAnimatableValues(element, style);
return effect;
}
@@ -201,14 +201,14 @@ bool CSSAnimations::isTransitionAnimationForInspector(const AnimationPlayer& pla
return false;
}
-PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const Element* animatingElement, Element& element, const ComputedStyle& style, ComputedStyle* parentStyle, StyleResolver* resolver)
+CSSAnimationUpdate* CSSAnimations::calculateUpdate(const Element* animatingElement, Element& element, const ComputedStyle& style, ComputedStyle* parentStyle, StyleResolver* resolver)
{
- OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAnimationUpdate());
- calculateAnimationUpdate(update.get(), animatingElement, element, style, parentStyle, resolver);
- calculateAnimationActiveInterpolations(update.get(), animatingElement, element.document().timeline().currentTimeInternal());
- calculateTransitionUpdate(update.get(), animatingElement, style);
- calculateTransitionActiveInterpolations(update.get(), animatingElement, element.document().timeline().currentTimeInternal());
- return update->isEmpty() ? nullptr : update.release();
+ CSSAnimationUpdate* update = new CSSAnimationUpdate();
+ calculateAnimationUpdate(update, animatingElement, element, style, parentStyle, resolver);
+ calculateAnimationActiveInterpolations(update, animatingElement, element.document().timeline().currentTimeInternal());
+ calculateTransitionUpdate(update, animatingElement, style);
+ calculateTransitionActiveInterpolations(update, animatingElement, element.document().timeline().currentTimeInternal());
+ return update->isEmpty() ? nullptr : update;
}
void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, const Element* animatingElement, Element& element, const ComputedStyle& style, ComputedStyle* parentStyle, StyleResolver* resolver)
@@ -303,7 +303,7 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
return;
}
- OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = m_pendingUpdate.release();
+ CSSAnimationUpdate* update = m_pendingUpdate.release();
m_previousActiveInterpolationsForAnimations.swap(update->activeInterpolationsForAnimations());
@@ -358,15 +358,15 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
for (const auto& entry : update->newAnimations()) {
const InertAnimation* inertAnimation = entry.animation.get();
- OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillBeNoop(new AnimationEventDelegate(element, entry.name));
- RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, inertAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPriority, eventDelegate.release());
+ AnimationEventDelegate* eventDelegate = new AnimationEventDelegate(element, entry.name);
+ Animation* animation = Animation::create(element, inertAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPriority, eventDelegate);
animation->setName(inertAnimation->name());
- RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timeline().play(animation.get());
+ RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timeline().play(animation);
if (inertAnimation->paused())
player->pause();
player->update(TimingUpdateOnDemand);
- m_animations.set(entry.name, adoptRefWillBeNoop(new RunningAnimation(player, entry)));
+ m_animations.set(entry.name, new RunningAnimation(player, entry));
}
// Transitions that are run on the compositor only update main-thread state
@@ -374,14 +374,14 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
// be when transitions are retargeted. Instead of triggering complete style
// recalculation, we find these cases by searching for new transitions that
// have matching cancelled animation property IDs on the compositor.
- WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<Animation>, double>> retargetedCompositorTransitions;
+ WillBeHeapHashMap<CSSPropertyID, std::pair<Member<Animation>, double>> retargetedCompositorTransitions;
for (CSSPropertyID id : update->cancelledTransitions()) {
ASSERT(m_transitions.contains(id));
RefPtrWillBeRawPtr<AnimationPlayer> player = m_transitions.take(id).player;
Animation* animation = toAnimation(player->source());
if (animation->hasActiveAnimationsOnCompositor(id) && update->newTransitions().find(id) != update->newTransitions().end() && !player->limited())
- retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember<Animation>, double>(animation, player->startTimeInternal()));
+ retargetedCompositorTransitions.add(id, std::pair<Member<Animation>, double>(animation, player->startTimeInternal()));
player->cancel();
// after cancelation, transitions must be downgraded or they'll fail
// to be considered when retriggering themselves. This can happen if
@@ -410,13 +410,13 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
CSSPropertyID id = newTransition.id;
InertAnimation* inertAnimation = newTransition.animation.get();
- OwnPtrWillBeRawPtr<TransitionEventDelegate> eventDelegate = adoptPtrWillBeNoop(new TransitionEventDelegate(element, newTransition.eventId));
+ TransitionEventDelegate* eventDelegate = new TransitionEventDelegate(element, newTransition.eventId);
- RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect();
+ AnimationEffect* effect = inertAnimation->effect();
if (retargetedCompositorTransitions.contains(id)) {
- const std::pair<RefPtrWillBeMember<Animation>, double>& oldTransition = retargetedCompositorTransitions.get(id);
- RefPtrWillBeRawPtr<Animation> oldAnimation = oldTransition.first;
+ const std::pair<Member<Animation>, double>& oldTransition = retargetedCompositorTransitions.get(id);
+ Animation* oldAnimation = oldTransition.first;
double oldStartTime = oldTransition.second;
double inheritedTime = isNull(oldStartTime) ? 0 : element->document().timeline().currentTimeInternal() - oldStartTime;
@@ -424,14 +424,14 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
const KeyframeVector& frames = oldEffect->getFrames();
AnimatableValueKeyframeVector newFrames;
- newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get()));
- newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get()));
- newFrames.append(toAnimatableValueKeyframe(frames[2]->clone().get()));
+ newFrames.append(toAnimatableValueKeyframe(frames[0]->clone()));
+ newFrames.append(toAnimatableValueKeyframe(frames[1]->clone()));
+ newFrames.append(toAnimatableValueKeyframe(frames[2]->clone()));
newFrames[0]->clearPropertyValue(id);
newFrames[1]->clearPropertyValue(id);
- RefPtrWillBeRawPtr<InertAnimation> inertAnimationForSampling = InertAnimation::create(oldAnimation->effect(), oldAnimation->specifiedTiming(), false, inheritedTime);
- OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> sample = nullptr;
+ InertAnimation* inertAnimationForSampling = InertAnimation::create(oldAnimation->effect(), oldAnimation->specifiedTiming(), false, inheritedTime);
+ HeapVector<Member<Interpolation>>* sample = nullptr;
inertAnimationForSampling->sample(sample);
if (sample && sample->size() == 1) {
newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sample->at(0).get())->currentValue());
@@ -440,9 +440,9 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
}
}
- RefPtrWillBeRawPtr<Animation> transition = Animation::create(element, effect, inertAnimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate.release());
+ Animation* transition = Animation::create(element, effect, inertAnimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate);
transition->setName(inertAnimation->name());
- RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timeline().play(transition.get());
+ RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timeline().play(transition);
player->update(TimingUpdateOnDemand);
runningTransition.player = player;
m_transitions.set(id, runningTransition);
@@ -453,7 +453,7 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, CSSPropertyID eventId, const CSSTransitionData& transitionData, size_t transitionIndex, const ComputedStyle& oldStyle, const ComputedStyle& style, const TransitionMap* activeTransitions, CSSAnimationUpdate* update, const Element* element)
{
- RefPtrWillBeRawPtr<AnimatableValue> to = nullptr;
+ AnimatableValue* to = nullptr;
if (activeTransitions) {
TransitionMap::const_iterator activeTransitionIter = activeTransitions->find(id);
if (activeTransitionIter != activeTransitions->end()) {
@@ -471,10 +471,10 @@ void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, CSSPr
if (!to)
to = CSSAnimatableValueFactory::create(id, style);
- RefPtrWillBeRawPtr<AnimatableValue> from = CSSAnimatableValueFactory::create(id, oldStyle);
+ AnimatableValue* from = CSSAnimatableValueFactory::create(id, oldStyle);
// If we have multiple transitions on the same property, we will use the
// last one since we iterate over them in order.
- if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get()))
+ if (AnimatableValue::usesDefaultInterpolation(to, from))
return;
Timing timing = transitionData.convertToTiming(transitionIndex);
@@ -490,25 +490,25 @@ void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, CSSPr
timing.startDelay = 0;
}
- RefPtrWillBeRawPtr<AnimatableValueKeyframe> delayKeyframe = AnimatableValueKeyframe::create();
- delayKeyframe->setPropertyValue(id, from.get());
+ AnimatableValueKeyframe* delayKeyframe = AnimatableValueKeyframe::create();
+ delayKeyframe->setPropertyValue(id, from);
delayKeyframe->setOffset(0);
keyframes.append(delayKeyframe);
- RefPtrWillBeRawPtr<AnimatableValueKeyframe> startKeyframe = AnimatableValueKeyframe::create();
- startKeyframe->setPropertyValue(id, from.get());
+ AnimatableValueKeyframe* startKeyframe = AnimatableValueKeyframe::create();
+ startKeyframe->setPropertyValue(id, from);
startKeyframe->setOffset(startKeyframeOffset);
startKeyframe->setEasing(timing.timingFunction.release());
timing.timingFunction = LinearTimingFunction::shared();
keyframes.append(startKeyframe);
- RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = AnimatableValueKeyframe::create();
- endKeyframe->setPropertyValue(id, to.get());
+ AnimatableValueKeyframe* endKeyframe = AnimatableValueKeyframe::create();
+ endKeyframe->setPropertyValue(id, to);
endKeyframe->setOffset(1);
keyframes.append(endKeyframe);
- RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableValueKeyframeEffectModel::create(keyframes);
- update->startTransition(id, eventId, from.get(), to.get(), InertAnimation::create(effect, timing, false, 0));
+ AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectModel::create(keyframes);
+ update->startTransition(id, eventId, from, to, InertAnimation::create(effect, timing, false, 0));
ASSERT(!element->elementAnimations() || !element->elementAnimations()->isAnimationStyleChange());
}
@@ -612,7 +612,7 @@ void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u
return;
}
- WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newAnimations;
+ HeapVector<Member<InertAnimation>> newAnimations;
for (const auto& newAnimation : update->newAnimations())
newAnimations.append(newAnimation.animation.get());
for (const auto& updatedAnimation : update->animationsWithUpdates())
@@ -631,7 +631,7 @@ void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate*
if (update->newTransitions().isEmpty() && update->cancelledTransitions().isEmpty()) {
activeInterpolationsForTransitions = AnimationStack::activeInterpolations(animationStack, 0, 0, Animation::TransitionPriority, timelineCurrentTime);
} else {
- WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newTransitions;
+ HeapVector<Member<InertAnimation>> newTransitions;
for (const auto& entry : update->newTransitions())
newTransitions.append(entry.value.animation.get());
@@ -789,24 +789,22 @@ bool CSSAnimations::isAllowedAnimation(CSSPropertyID property)
DEFINE_TRACE(CSSAnimations)
{
-#if ENABLE(OILPAN)
visitor->trace(m_transitions);
visitor->trace(m_pendingUpdate);
visitor->trace(m_animations);
visitor->trace(m_previousActiveInterpolationsForAnimations);
-#endif
}
DEFINE_TRACE(CSSAnimationUpdate)
{
-#if ENABLE(OILPAN)
visitor->trace(m_newTransitions);
visitor->trace(m_activeInterpolationsForAnimations);
visitor->trace(m_activeInterpolationsForTransitions);
visitor->trace(m_newAnimations);
- visitor->trace(m_suppressedAnimationPlayers);
visitor->trace(m_animationsWithUpdates);
visitor->trace(m_animationsWithStyleUpdates);
+#if ENABLE(OILPAN)
+ visitor->trace(m_suppressedAnimationPlayers);
#endif
}

Powered by Google App Engine
This is Rietveld 408576698