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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 #include "platform/heap/Handle.h" 41 #include "platform/heap/Handle.h"
42 #include "wtf/MathExtras.h" 42 #include "wtf/MathExtras.h"
43 #include "wtf/StdLibExtras.h" 43 #include "wtf/StdLibExtras.h"
44 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
45 #include <algorithm> 45 #include <algorithm>
46 46
47 namespace blink { 47 namespace blink {
48 48
49 class RepeatEvent final : public Event { 49 class RepeatEvent final : public Event {
50 public: 50 public:
51 static PassRefPtrWillBeRawPtr<RepeatEvent> create(const AtomicString& type, int repeat) 51 static RawPtr<RepeatEvent> create(const AtomicString& type, int repeat)
52 { 52 {
53 return adoptRefWillBeNoop(new RepeatEvent(type, false, false, repeat)); 53 return (new RepeatEvent(type, false, false, repeat));
54 } 54 }
55 55
56 ~RepeatEvent() override {} 56 ~RepeatEvent() override {}
57 57
58 int repeat() const { return m_repeat; } 58 int repeat() const { return m_repeat; }
59 59
60 DEFINE_INLINE_VIRTUAL_TRACE() 60 DEFINE_INLINE_VIRTUAL_TRACE()
61 { 61 {
62 Event::trace(visitor); 62 Event::trace(visitor);
63 } 63 }
(...skipping 10 matching lines...) Expand all
74 }; 74 };
75 75
76 inline RepeatEvent* toRepeatEvent(Event* event) 76 inline RepeatEvent* toRepeatEvent(Event* event)
77 { 77 {
78 ASSERT_WITH_SECURITY_IMPLICATION(!event || event->type() == "repeatn"); 78 ASSERT_WITH_SECURITY_IMPLICATION(!event || event->type() == "repeatn");
79 return static_cast<RepeatEvent*>(event); 79 return static_cast<RepeatEvent*>(event);
80 } 80 }
81 81
82 static SMILEventSender& smilEndEventSender() 82 static SMILEventSender& smilEndEventSender()
83 { 83 {
84 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv entSender::create(EventTypeNames::endEvent))); 84 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c reate(EventTypeNames::endEvent)));
85 return *sender; 85 return *sender;
86 } 86 }
87 87
88 static SMILEventSender& smilBeginEventSender() 88 static SMILEventSender& smilBeginEventSender()
89 { 89 {
90 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv entSender::create(EventTypeNames::beginEvent))); 90 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c reate(EventTypeNames::beginEvent)));
91 return *sender; 91 return *sender;
92 } 92 }
93 93
94 static SMILEventSender& smilRepeatEventSender() 94 static SMILEventSender& smilRepeatEventSender()
95 { 95 {
96 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv entSender::create(EventTypeNames::repeatEvent))); 96 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c reate(EventTypeNames::repeatEvent)));
97 return *sender; 97 return *sender;
98 } 98 }
99 99
100 static SMILEventSender& smilRepeatNEventSender() 100 static SMILEventSender& smilRepeatNEventSender()
101 { 101 {
102 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<SMILEventSender>, sender, (SMILEv entSender::create(AtomicString("repeatn", AtomicString::ConstructFromLiteral)))) ; 102 DEFINE_STATIC_LOCAL(Persistent<SMILEventSender>, sender, (SMILEventSender::c reate(AtomicString("repeatn", AtomicString::ConstructFromLiteral))));
103 return *sender; 103 return *sender;
104 } 104 }
105 105
106 // This is used for duration type time values that can't be negative. 106 // This is used for duration type time values that can't be negative.
107 static const double invalidCachedTime = -1.; 107 static const double invalidCachedTime = -1.;
108 108
109 class ConditionEventListener final : public EventListener { 109 class ConditionEventListener final : public EventListener {
110 public: 110 public:
111 static PassRefPtrWillBeRawPtr<ConditionEventListener> create(SVGSMILElement* animation, SVGSMILElement::Condition* condition) 111 static RawPtr<ConditionEventListener> create(SVGSMILElement* animation, SVGS MILElement::Condition* condition)
112 { 112 {
113 return adoptRefWillBeNoop(new ConditionEventListener(animation, conditio n)); 113 return (new ConditionEventListener(animation, condition));
114 } 114 }
115 115
116 static const ConditionEventListener* cast(const EventListener* listener) 116 static const ConditionEventListener* cast(const EventListener* listener)
117 { 117 {
118 return listener->type() == ConditionEventListenerType 118 return listener->type() == ConditionEventListenerType
119 ? static_cast<const ConditionEventListener*>(listener) 119 ? static_cast<const ConditionEventListener*>(listener)
120 : nullptr; 120 : nullptr;
121 } 121 }
122 122
123 bool operator==(const EventListener& other) const override; 123 bool operator==(const EventListener& other) const override;
(...skipping 13 matching lines...) Expand all
137 private: 137 private:
138 ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition* condition) 138 ConditionEventListener(SVGSMILElement* animation, SVGSMILElement::Condition* condition)
139 : EventListener(ConditionEventListenerType) 139 : EventListener(ConditionEventListenerType)
140 , m_animation(animation) 140 , m_animation(animation)
141 , m_condition(condition) 141 , m_condition(condition)
142 { 142 {
143 } 143 }
144 144
145 void handleEvent(ExecutionContext*, Event*) override; 145 void handleEvent(ExecutionContext*, Event*) override;
146 146
147 RawPtrWillBeMember<SVGSMILElement> m_animation; 147 Member<SVGSMILElement> m_animation;
148 RawPtrWillBeMember<SVGSMILElement::Condition> m_condition; 148 Member<SVGSMILElement::Condition> m_condition;
149 }; 149 };
150 150
151 bool ConditionEventListener::operator==(const EventListener& listener) const 151 bool ConditionEventListener::operator==(const EventListener& listener) const
152 { 152 {
153 if (const ConditionEventListener* conditionEventListener = ConditionEventLis tener::cast(&listener)) 153 if (const ConditionEventListener* conditionEventListener = ConditionEventLis tener::cast(&listener))
154 return m_animation == conditionEventListener->m_animation && m_condition == conditionEventListener->m_condition; 154 return m_animation == conditionEventListener->m_animation && m_condition == conditionEventListener->m_condition;
155 return false; 155 return false;
156 } 156 }
157 157
158 void ConditionEventListener::handleEvent(ExecutionContext*, Event* event) 158 void ConditionEventListener::handleEvent(ExecutionContext*, Event* event)
159 { 159 {
160 if (!m_animation) 160 if (!m_animation)
161 return; 161 return;
162 m_animation->handleConditionEvent(event, m_condition); 162 m_animation->handleConditionEvent(event, m_condition);
163 } 163 }
164 164
165 void SVGSMILElement::Condition::setEventListener(PassRefPtrWillBeRawPtr<Conditio nEventListener> eventListener) 165 void SVGSMILElement::Condition::setEventListener(RawPtr<ConditionEventListener> eventListener)
166 { 166 {
167 m_eventListener = eventListener; 167 m_eventListener = eventListener;
168 } 168 }
169 169
170 SVGSMILElement::Condition::Condition(Type type, BeginOrEnd beginOrEnd, const Str ing& baseID, const String& name, SMILTime offset, int repeat) 170 SVGSMILElement::Condition::Condition(Type type, BeginOrEnd beginOrEnd, const Str ing& baseID, const String& name, SMILTime offset, int repeat)
171 : m_type(type) 171 : m_type(type)
172 , m_beginOrEnd(beginOrEnd) 172 , m_beginOrEnd(beginOrEnd)
173 , m_baseID(baseID) 173 , m_baseID(baseID)
174 , m_name(name) 174 , m_name(name)
175 , m_offset(offset) 175 , m_offset(offset)
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 m_nextProgressTime = calculateNextProgressTime(elapsed); 1219 m_nextProgressTime = calculateNextProgressTime(elapsed);
1220 return animationIsContributing; 1220 return animationIsContributing;
1221 } 1221 }
1222 1222
1223 void SVGSMILElement::notifyDependentsIntervalChanged() 1223 void SVGSMILElement::notifyDependentsIntervalChanged()
1224 { 1224 {
1225 ASSERT(m_interval.begin.isFinite()); 1225 ASSERT(m_interval.begin.isFinite());
1226 // |loopBreaker| is used to avoid infinite recursions which may be caused fr om: 1226 // |loopBreaker| is used to avoid infinite recursions which may be caused fr om:
1227 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| -> |add{Begin,End}Time| -> |{begin,end}TimeChanged| -> |notifyDependentsIntervalCh anged| 1227 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| -> |add{Begin,End}Time| -> |{begin,end}TimeChanged| -> |notifyDependentsIntervalCh anged|
1228 // |loopBreaker| is defined as a Persistent<HeapHashSet<Member<SVGSMILElemen t>>>. This won't cause leaks because it is guaranteed to be empty after the root |notifyDependentsIntervalChanged| has exited. 1228 // |loopBreaker| is defined as a Persistent<HeapHashSet<Member<SVGSMILElemen t>>>. This won't cause leaks because it is guaranteed to be empty after the root |notifyDependentsIntervalChanged| has exited.
1229 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapHashSet<RawPtrWillBeMem ber<SVGSMILElement>>>, loopBreaker, (adoptPtrWillBeNoop(new WillBeHeapHashSet<Ra wPtrWillBeMember<SVGSMILElement>>()))); 1229 DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<Member<SVGSMILElement>>>, loopBre aker, ((new HeapHashSet<Member<SVGSMILElement>>())));
1230 if (!loopBreaker->add(this).isNewEntry) 1230 if (!loopBreaker->add(this).isNewEntry)
1231 return; 1231 return;
1232 1232
1233 for (SVGSMILElement* element : m_syncBaseDependents) 1233 for (SVGSMILElement* element : m_syncBaseDependents)
1234 element->createInstanceTimesFromSyncbase(this); 1234 element->createInstanceTimesFromSyncbase(this);
1235 1235
1236 loopBreaker->remove(this); 1236 loopBreaker->remove(this);
1237 } 1237 }
1238 1238
1239 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) 1239 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 visitor->trace(m_targetElement); 1361 visitor->trace(m_targetElement);
1362 visitor->trace(m_timeContainer); 1362 visitor->trace(m_timeContainer);
1363 visitor->trace(m_conditions); 1363 visitor->trace(m_conditions);
1364 visitor->trace(m_syncBaseDependents); 1364 visitor->trace(m_syncBaseDependents);
1365 #endif 1365 #endif
1366 SVGElement::trace(visitor); 1366 SVGElement::trace(visitor);
1367 SVGTests::trace(visitor); 1367 SVGTests::trace(visitor);
1368 } 1368 }
1369 1369
1370 } // namespace blink 1370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698