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

Side by Side Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 427673004: Oilpan: Move AnimationNode::EventDelegate to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/css/CSSAnimations.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 if (player->paused()) 318 if (player->paused())
319 player->unpause(); 319 player->unpause();
320 else 320 else
321 player->pause(); 321 player->pause();
322 if (player->outdated()) 322 if (player->outdated())
323 player->update(TimingUpdateOnDemand); 323 player->update(TimingUpdateOnDemand);
324 } 324 }
325 325
326 for (WillBeHeapVector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update->newAnimations().begin(); iter != update->newAnimations().end(); ++ite r) { 326 for (WillBeHeapVector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update->newAnimations().begin(); iter != update->newAnimations().end(); ++ite r) {
327 const InertAnimation* inertAnimation = iter->animation.get(); 327 const InertAnimation* inertAnimation = iter->animation.get();
328 OwnPtr<AnimationEventDelegate> eventDelegate = adoptPtr(new AnimationEve ntDelegate(element, iter->name)); 328 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB eNoop(new AnimationEventDelegate(element, iter->name));
329 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio rity, eventDelegate.release()); 329 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio rity, eventDelegate.release());
330 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin e().createAnimationPlayer(animation.get()); 330 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin e().createAnimationPlayer(animation.get());
331 element->document().compositorPendingAnimations().add(player.get()); 331 element->document().compositorPendingAnimations().add(player.get());
332 if (inertAnimation->paused()) 332 if (inertAnimation->paused())
333 player->pause(); 333 player->pause();
334 player->update(TimingUpdateOnDemand); 334 player->update(TimingUpdateOnDemand);
335 m_animations.set(iter->name, player.get()); 335 m_animations.set(iter->name, player.get());
336 } 336 }
337 337
338 // Transitions that are run on the compositor only update main-thread state 338 // Transitions that are run on the compositor only update main-thread state
(...skipping 16 matching lines...) Expand all
355 355
356 for (CSSAnimationUpdate::NewTransitionMap::const_iterator iter = update->new Transitions().begin(); iter != update->newTransitions().end(); ++iter) { 356 for (CSSAnimationUpdate::NewTransitionMap::const_iterator iter = update->new Transitions().begin(); iter != update->newTransitions().end(); ++iter) {
357 const CSSAnimationUpdate::NewTransition& newTransition = iter->value; 357 const CSSAnimationUpdate::NewTransition& newTransition = iter->value;
358 358
359 RunningTransition runningTransition; 359 RunningTransition runningTransition;
360 runningTransition.from = newTransition.from; 360 runningTransition.from = newTransition.from;
361 runningTransition.to = newTransition.to; 361 runningTransition.to = newTransition.to;
362 362
363 CSSPropertyID id = newTransition.id; 363 CSSPropertyID id = newTransition.id;
364 InertAnimation* inertAnimation = newTransition.animation.get(); 364 InertAnimation* inertAnimation = newTransition.animation.get();
365 OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionE ventDelegate(element, newTransition.eventId)); 365 OwnPtrWillBeRawPtr<TransitionEventDelegate> eventDelegate = adoptPtrWill BeNoop(new TransitionEventDelegate(element, newTransition.eventId));
366 366
367 RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect(); 367 RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect();
368 368
369 if (retargetedCompositorTransitions.contains(id)) { 369 if (retargetedCompositorTransitions.contains(id)) {
370 const std::pair<RefPtrWillBeMember<Animation>, double>& oldTransitio n = retargetedCompositorTransitions.get(id); 370 const std::pair<RefPtrWillBeMember<Animation>, double>& oldTransitio n = retargetedCompositorTransitions.get(id);
371 RefPtrWillBeRawPtr<Animation> oldAnimation = oldTransition.first; 371 RefPtrWillBeRawPtr<Animation> oldAnimation = oldTransition.first;
372 double oldStartTime = oldTransition.second; 372 double oldStartTime = oldTransition.second;
373 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime; 373 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime;
374 374
375 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->effect()); 375 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->effect());
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime); 622 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime);
623 } 623 }
624 624
625 if (currentPhase == AnimationNode::PhaseAfter && m_previousPhase != Animatio nNode::PhaseAfter) 625 if (currentPhase == AnimationNode::PhaseAfter && m_previousPhase != Animatio nNode::PhaseAfter)
626 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationNode->activeDurationInternal()); 626 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationNode->activeDurationInternal());
627 627
628 m_previousPhase = currentPhase; 628 m_previousPhase = currentPhase;
629 m_previousIteration = currentIteration; 629 m_previousIteration = currentIteration;
630 } 630 }
631 631
632 void CSSAnimations::AnimationEventDelegate::trace(Visitor* visitor)
633 {
634 visitor->trace(m_target);
635 AnimationNode::EventDelegate::trace(visitor);
636 }
637
632 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationNod e* animationNode) 638 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationNod e* animationNode)
633 { 639 {
634 const AnimationNode::Phase currentPhase = animationNode->phase(); 640 const AnimationNode::Phase currentPhase = animationNode->phase();
635 if (currentPhase == AnimationNode::PhaseAfter && currentPhase != m_previousP hase && m_target->document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { 641 if (currentPhase == AnimationNode::PhaseAfter && currentPhase != m_previousP hase && m_target->document().hasListenerType(Document::TRANSITIONEND_LISTENER)) {
636 String propertyName = getPropertyNameString(m_property); 642 String propertyName = getPropertyNameString(m_property);
637 const Timing& timing = animationNode->specifiedTiming(); 643 const Timing& timing = animationNode->specifiedTiming();
638 double elapsedTime = timing.iterationDuration; 644 double elapsedTime = timing.iterationDuration;
639 const AtomicString& eventType = EventTypeNames::transitionend; 645 const AtomicString& eventType = EventTypeNames::transitionend;
640 String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_targe t->pseudoId()); 646 String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_targe t->pseudoId());
641 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even tType, propertyName, elapsedTime, pseudoElement); 647 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even tType, propertyName, elapsedTime, pseudoElement);
642 event->setTarget(m_target); 648 event->setTarget(m_target);
643 m_target->document().enqueueAnimationFrameEvent(event); 649 m_target->document().enqueueAnimationFrameEvent(event);
644 } 650 }
645 651
646 m_previousPhase = currentPhase; 652 m_previousPhase = currentPhase;
647 } 653 }
648 654
655 void CSSAnimations::TransitionEventDelegate::trace(Visitor* visitor)
656 {
657 visitor->trace(m_target);
658 AnimationNode::EventDelegate::trace(visitor);
659 }
660
649 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) 661 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property)
650 { 662 {
651 switch (property) { 663 switch (property) {
652 case CSSPropertyBackgroundColor: 664 case CSSPropertyBackgroundColor:
653 case CSSPropertyBackgroundImage: 665 case CSSPropertyBackgroundImage:
654 case CSSPropertyBackgroundPositionX: 666 case CSSPropertyBackgroundPositionX:
655 case CSSPropertyBackgroundPositionY: 667 case CSSPropertyBackgroundPositionY:
656 case CSSPropertyBackgroundSize: 668 case CSSPropertyBackgroundSize:
657 case CSSPropertyBaselineShift: 669 case CSSPropertyBaselineShift:
658 case CSSPropertyBorderBottomColor: 670 case CSSPropertyBorderBottomColor:
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 #if ENABLE(OILPAN) 843 #if ENABLE(OILPAN)
832 visitor->trace(m_newTransitions); 844 visitor->trace(m_newTransitions);
833 visitor->trace(m_activeInterpolationsForAnimations); 845 visitor->trace(m_activeInterpolationsForAnimations);
834 visitor->trace(m_activeInterpolationsForTransitions); 846 visitor->trace(m_activeInterpolationsForTransitions);
835 visitor->trace(m_newAnimations); 847 visitor->trace(m_newAnimations);
836 visitor->trace(m_cancelledAnimationPlayers); 848 visitor->trace(m_cancelledAnimationPlayers);
837 #endif 849 #endif
838 } 850 }
839 851
840 } // namespace blink 852 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/css/CSSAnimations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698