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

Side by Side Diff: Source/core/animation/AnimationNodeTest.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/AnimationNode.cpp ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 void updateInheritedTime(double time, TimingUpdateReason reason) 69 void updateInheritedTime(double time, TimingUpdateReason reason)
70 { 70 {
71 m_eventDelegate->reset(); 71 m_eventDelegate->reset();
72 AnimationNode::updateInheritedTime(time, reason); 72 AnimationNode::updateInheritedTime(time, reason);
73 } 73 }
74 74
75 virtual void updateChildrenAndEffects() const OVERRIDE { } 75 virtual void updateChildrenAndEffects() const OVERRIDE { }
76 void willDetach() { } 76 void willDetach() { }
77 TestAnimationNodeEventDelegate* eventDelegate() { return m_eventDelegate; } 77 TestAnimationNodeEventDelegate* eventDelegate() { return m_eventDelegate.get (); }
78 virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const OVERRIDE 78 virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const OVERRIDE
79 { 79 {
80 m_localTime = localTime; 80 m_localTime = localTime;
81 m_timeToNextIteration = timeToNextIteration; 81 m_timeToNextIteration = timeToNextIteration;
82 return -1; 82 return -1;
83 } 83 }
84 double takeLocalTime() 84 double takeLocalTime()
85 { 85 {
86 const double result = m_localTime; 86 const double result = m_localTime;
87 m_localTime = nullValue(); 87 m_localTime = nullValue();
88 return result; 88 return result;
89 } 89 }
90 90
91 double takeTimeToNextIteration() 91 double takeTimeToNextIteration()
92 { 92 {
93 const double result = m_timeToNextIteration; 93 const double result = m_timeToNextIteration;
94 m_timeToNextIteration = nullValue(); 94 m_timeToNextIteration = nullValue();
95 return result; 95 return result;
96 } 96 }
97 97
98 virtual void trace(Visitor* visitor) OVERRIDE
99 {
100 visitor->trace(m_eventDelegate);
101 AnimationNode::trace(visitor);
102 }
103
98 private: 104 private:
99 TestAnimationNode(const Timing& specified, TestAnimationNodeEventDelegate* e ventDelegate) 105 TestAnimationNode(const Timing& specified, TestAnimationNodeEventDelegate* e ventDelegate)
100 : AnimationNode(specified, adoptPtr(eventDelegate)) 106 : AnimationNode(specified, adoptPtrWillBeNoop(eventDelegate))
101 , m_eventDelegate(eventDelegate) 107 , m_eventDelegate(eventDelegate)
102 { 108 {
103 } 109 }
104 110
105 TestAnimationNodeEventDelegate* m_eventDelegate; 111 RawPtrWillBeMember<TestAnimationNodeEventDelegate> m_eventDelegate;
106 mutable double m_localTime; 112 mutable double m_localTime;
107 mutable double m_timeToNextIteration; 113 mutable double m_timeToNextIteration;
108 }; 114 };
109 115
110 TEST(AnimationAnimationNodeTest, Sanity) 116 TEST(AnimationAnimationNodeTest, Sanity)
111 { 117 {
112 Timing timing; 118 Timing timing;
113 timing.iterationDuration = 2; 119 timing.iterationDuration = 2;
114 RefPtrWillBeRawPtr<TestAnimationNode> animationNode = TestAnimationNode::cre ate(timing); 120 RefPtrWillBeRawPtr<TestAnimationNode> animationNode = TestAnimationNode::cre ate(timing);
115 121
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration())); 772 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration()));
767 773
768 // Item has finished. 774 // Item has finished.
769 animationNode->updateInheritedTime(3.5); 775 animationNode->updateInheritedTime(3.5);
770 EXPECT_EQ(AnimationNode::PhaseAfter, animationNode->phase()); 776 EXPECT_EQ(AnimationNode::PhaseAfter, animationNode->phase());
771 EXPECT_EQ(3.5, animationNode->takeLocalTime()); 777 EXPECT_EQ(3.5, animationNode->takeLocalTime());
772 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration())); 778 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration()));
773 } 779 }
774 780
775 } 781 }
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationNode.cpp ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698