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

Side by Side Diff: Source/core/animation/Animation.cpp

Issue 1318543009: Oilpan: Partially ship Oilpan for core/animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 namespace { 51 namespace {
52 52
53 static unsigned nextSequenceNumber() 53 static unsigned nextSequenceNumber()
54 { 54 {
55 static unsigned next = 0; 55 static unsigned next = 0;
56 return ++next; 56 return ++next;
57 } 57 }
58 58
59 } 59 }
60 60
61 PassRefPtrWillBeRawPtr<Animation> Animation::create(AnimationEffect* effect, Ani mationTimeline* timeline) 61 Animation* Animation::create(AnimationEffect* effect, AnimationTimeline* timelin e)
62 { 62 {
63 if (!timeline) { 63 if (!timeline) {
64 // FIXME: Support creating animations without a timeline. 64 // FIXME: Support creating animations without a timeline.
65 return nullptr; 65 return nullptr;
66 } 66 }
67 67
68 RefPtrWillBeRawPtr<Animation> animation = adoptRefWillBeNoop(new Animation(t imeline->document()->contextDocument().get(), *timeline, effect)); 68 Animation* animation = new Animation(timeline->document()->contextDocument() .get(), *timeline, effect);
69 animation->suspendIfNeeded(); 69 animation->suspendIfNeeded();
70 70
71 if (timeline) { 71 if (timeline) {
72 timeline->animationAttached(*animation); 72 timeline->animationAttached(*animation);
73 animation->attachCompositorTimeline(); 73 animation->attachCompositorTimeline();
74 } 74 }
75 75
76 return animation.release(); 76 return animation;
77 } 77 }
78 78
79 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time line, AnimationEffect* content) 79 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time line, AnimationEffect* content)
80 : ActiveDOMObject(executionContext) 80 : ActiveDOMObject(executionContext)
81 , m_playState(Idle) 81 , m_playState(Idle)
82 , m_playbackRate(1) 82 , m_playbackRate(1)
83 , m_startTime(nullValue()) 83 , m_startTime(nullValue())
84 , m_holdTime(0) 84 , m_holdTime(0)
85 , m_startClip(-std::numeric_limits<double>::infinity()) 85 , m_startClip(-std::numeric_limits<double>::infinity())
86 , m_endClip(std::numeric_limits<double>::infinity()) 86 , m_endClip(std::numeric_limits<double>::infinity())
(...skipping 16 matching lines...) Expand all
103 if (m_content->animation()) { 103 if (m_content->animation()) {
104 m_content->animation()->cancel(); 104 m_content->animation()->cancel();
105 m_content->animation()->setEffect(0); 105 m_content->animation()->setEffect(0);
106 } 106 }
107 m_content->attach(this); 107 m_content->attach(this);
108 } 108 }
109 } 109 }
110 110
111 Animation::~Animation() 111 Animation::~Animation()
112 { 112 {
113 #if !ENABLE(OILPAN)
114 if (m_content)
115 m_content->detach();
116 if (m_timeline)
117 m_timeline->animationDestroyed(this);
118 #endif
119
120 destroyCompositorPlayer(); 113 destroyCompositorPlayer();
121 } 114 }
122 115
123 #if !ENABLE(OILPAN)
124 void Animation::detachFromTimeline()
125 {
126 m_timeline = nullptr;
127 ActiveDOMObject::clearContext();
128 }
129 #endif
130
131 double Animation::effectEnd() const 116 double Animation::effectEnd() const
132 { 117 {
133 return m_content ? m_content->endTimeInternal() : 0; 118 return m_content ? m_content->endTimeInternal() : 0;
134 } 119 }
135 120
136 bool Animation::limited(double currentTime) const 121 bool Animation::limited(double currentTime) const
137 { 122 {
138 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= effectEnd()); 123 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= effectEnd());
139 } 124 }
140 125
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 cancelAnimationOnCompositor(); 1079 cancelAnimationOnCompositor();
1095 } 1080 }
1096 1081
1097 DEFINE_TRACE(Animation) 1082 DEFINE_TRACE(Animation)
1098 { 1083 {
1099 visitor->trace(m_content); 1084 visitor->trace(m_content);
1100 visitor->trace(m_timeline); 1085 visitor->trace(m_timeline);
1101 visitor->trace(m_pendingFinishedEvent); 1086 visitor->trace(m_pendingFinishedEvent);
1102 visitor->trace(m_finishedPromise); 1087 visitor->trace(m_finishedPromise);
1103 visitor->trace(m_readyPromise); 1088 visitor->trace(m_readyPromise);
1104 EventTargetWithInlineData::trace(visitor); 1089 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito r);
1105 ActiveDOMObject::trace(visitor); 1090 ActiveDOMObject::trace(visitor);
1106 } 1091 }
1107 1092
1108 } // namespace 1093 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698