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

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

Issue 1968683003: Simplify SVGSMILElement::notifyDependentsIntervalChanged loop breaker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add explanatory comment re UntracedMember<> Created 4 years, 7 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
« no previous file with comments | « no previous file | 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) 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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 1215
1216 m_nextProgressTime = calculateNextProgressTime(elapsed); 1216 m_nextProgressTime = calculateNextProgressTime(elapsed);
1217 return animationIsContributing; 1217 return animationIsContributing;
1218 } 1218 }
1219 1219
1220 void SVGSMILElement::notifyDependentsIntervalChanged() 1220 void SVGSMILElement::notifyDependentsIntervalChanged()
1221 { 1221 {
1222 ASSERT(m_interval.begin.isFinite()); 1222 ASSERT(m_interval.begin.isFinite());
1223 // |loopBreaker| is used to avoid infinite recursions which may be caused fr om: 1223 // |loopBreaker| is used to avoid infinite recursions which may be caused fr om:
1224 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| -> |add{Begin,End}Time| -> |{begin,end}TimeChanged| -> |notifyDependentsIntervalCh anged| 1224 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| -> |add{Begin,End}Time| -> |{begin,end}TimeChanged| -> |notifyDependentsIntervalCh anged|
1225 // |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. 1225 //
1226 DEFINE_STATIC_LOCAL(HeapHashSet<Member<SVGSMILElement>>, loopBreaker, (new H eapHashSet<Member<SVGSMILElement>>)); 1226 // As the set here records SVGSMILElements on the stack, it is acceptable to
1227 // use a HashSet of untraced heap references -- any conservative GC which
1228 // strikes before unwinding will find these elements on the stack.
1229 DEFINE_STATIC_LOCAL(HashSet<UntracedMember<SVGSMILElement>>, loopBreaker, () );
1227 if (!loopBreaker.add(this).isNewEntry) 1230 if (!loopBreaker.add(this).isNewEntry)
1228 return; 1231 return;
1229 1232
1230 for (SVGSMILElement* element : m_syncBaseDependents) 1233 for (SVGSMILElement* element : m_syncBaseDependents)
1231 element->createInstanceTimesFromSyncbase(this); 1234 element->createInstanceTimesFromSyncbase(this);
1232 1235
1233 loopBreaker.remove(this); 1236 loopBreaker.remove(this);
1234 } 1237 }
1235 1238
1236 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) 1239 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 { 1359 {
1357 visitor->trace(m_targetElement); 1360 visitor->trace(m_targetElement);
1358 visitor->trace(m_timeContainer); 1361 visitor->trace(m_timeContainer);
1359 visitor->trace(m_conditions); 1362 visitor->trace(m_conditions);
1360 visitor->trace(m_syncBaseDependents); 1363 visitor->trace(m_syncBaseDependents);
1361 SVGElement::trace(visitor); 1364 SVGElement::trace(visitor);
1362 SVGTests::trace(visitor); 1365 SVGTests::trace(visitor);
1363 } 1366 }
1364 1367
1365 } // namespace blink 1368 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698