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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 void SVGSMILElement::parseBeginOrEnd(const String& parseString, 424 void SVGSMILElement::parseBeginOrEnd(const String& parseString,
425 BeginOrEnd beginOrEnd) { 425 BeginOrEnd beginOrEnd) {
426 Vector<SMILTimeWithOrigin>& timeList = 426 Vector<SMILTimeWithOrigin>& timeList =
427 beginOrEnd == Begin ? m_beginTimes : m_endTimes; 427 beginOrEnd == Begin ? m_beginTimes : m_endTimes;
428 if (beginOrEnd == End) 428 if (beginOrEnd == End)
429 m_hasEndEventConditions = false; 429 m_hasEndEventConditions = false;
430 HashSet<SMILTime> existing; 430 HashSet<SMILTime> existing;
431 for (unsigned n = 0; n < timeList.size(); ++n) { 431 for (unsigned n = 0; n < timeList.size(); ++n) {
432 if (!timeList[n].time().isUnresolved()) 432 if (!timeList[n].time().isUnresolved())
433 existing.add(timeList[n].time().value()); 433 existing.insert(timeList[n].time().value());
434 } 434 }
435 Vector<String> splitString; 435 Vector<String> splitString;
436 parseString.split(';', splitString); 436 parseString.split(';', splitString);
437 for (unsigned n = 0; n < splitString.size(); ++n) { 437 for (unsigned n = 0; n < splitString.size(); ++n) {
438 SMILTime value = parseClockValue(splitString[n]); 438 SMILTime value = parseClockValue(splitString[n]);
439 if (value.isUnresolved()) 439 if (value.isUnresolved())
440 parseCondition(splitString[n], beginOrEnd); 440 parseCondition(splitString[n], beginOrEnd);
441 else if (!existing.contains(value.value())) 441 else if (!existing.contains(value.value()))
442 timeList.push_back( 442 timeList.push_back(
443 SMILTimeWithOrigin(value, SMILTimeWithOrigin::ParserOrigin)); 443 SMILTimeWithOrigin(value, SMILTimeWithOrigin::ParserOrigin));
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 ASSERT(m_interval.begin.isFinite()); 1171 ASSERT(m_interval.begin.isFinite());
1172 // |loopBreaker| is used to avoid infinite recursions which may be caused by: 1172 // |loopBreaker| is used to avoid infinite recursions which may be caused by:
1173 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| -> 1173 // |notifyDependentsIntervalChanged| -> |createInstanceTimesFromSyncbase| ->
1174 // |add{Begin,End}Time| -> |{begin,end}TimeChanged| -> 1174 // |add{Begin,End}Time| -> |{begin,end}TimeChanged| ->
1175 // |notifyDependentsIntervalChanged| 1175 // |notifyDependentsIntervalChanged|
1176 // 1176 //
1177 // As the set here records SVGSMILElements on the stack, it is acceptable to 1177 // As the set here records SVGSMILElements on the stack, it is acceptable to
1178 // use a HashSet of untraced heap references -- any conservative GC which 1178 // use a HashSet of untraced heap references -- any conservative GC which
1179 // strikes before unwinding will find these elements on the stack. 1179 // strikes before unwinding will find these elements on the stack.
1180 DEFINE_STATIC_LOCAL(HashSet<UntracedMember<SVGSMILElement>>, loopBreaker, ()); 1180 DEFINE_STATIC_LOCAL(HashSet<UntracedMember<SVGSMILElement>>, loopBreaker, ());
1181 if (!loopBreaker.add(this).isNewEntry) 1181 if (!loopBreaker.insert(this).isNewEntry)
1182 return; 1182 return;
1183 1183
1184 for (SVGSMILElement* element : m_syncBaseDependents) 1184 for (SVGSMILElement* element : m_syncBaseDependents)
1185 element->createInstanceTimesFromSyncbase(this); 1185 element->createInstanceTimesFromSyncbase(this);
1186 1186
1187 loopBreaker.remove(this); 1187 loopBreaker.remove(this);
1188 } 1188 }
1189 1189
1190 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) { 1190 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) {
1191 // FIXME: To be really correct, this should handle updating exising interval 1191 // FIXME: To be really correct, this should handle updating exising interval
(...skipping 17 matching lines...) Expand all
1209 continue; 1209 continue;
1210 if (condition->getBeginOrEnd() == Begin) 1210 if (condition->getBeginOrEnd() == Begin)
1211 addBeginTime(elapsed, time); 1211 addBeginTime(elapsed, time);
1212 else 1212 else
1213 addEndTime(elapsed, time); 1213 addEndTime(elapsed, time);
1214 } 1214 }
1215 } 1215 }
1216 } 1216 }
1217 1217
1218 void SVGSMILElement::addSyncBaseDependent(SVGSMILElement* animation) { 1218 void SVGSMILElement::addSyncBaseDependent(SVGSMILElement* animation) {
1219 m_syncBaseDependents.add(animation); 1219 m_syncBaseDependents.insert(animation);
1220 if (m_interval.begin.isFinite()) 1220 if (m_interval.begin.isFinite())
1221 animation->createInstanceTimesFromSyncbase(this); 1221 animation->createInstanceTimesFromSyncbase(this);
1222 } 1222 }
1223 1223
1224 void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement* animation) { 1224 void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement* animation) {
1225 m_syncBaseDependents.remove(animation); 1225 m_syncBaseDependents.remove(animation);
1226 } 1226 }
1227 1227
1228 void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) { 1228 void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) {
1229 if (event->type() == "repeatn" && 1229 if (event->type() == "repeatn" &&
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 DEFINE_TRACE(SVGSMILElement) { 1311 DEFINE_TRACE(SVGSMILElement) {
1312 visitor->trace(m_targetElement); 1312 visitor->trace(m_targetElement);
1313 visitor->trace(m_timeContainer); 1313 visitor->trace(m_timeContainer);
1314 visitor->trace(m_conditions); 1314 visitor->trace(m_conditions);
1315 visitor->trace(m_syncBaseDependents); 1315 visitor->trace(m_syncBaseDependents);
1316 SVGElement::trace(visitor); 1316 SVGElement::trace(visitor);
1317 SVGTests::trace(visitor); 1317 SVGTests::trace(visitor);
1318 } 1318 }
1319 1319
1320 } // namespace blink 1320 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698