Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 SVGSMILElement::~SVGSMILElement() | 198 SVGSMILElement::~SVGSMILElement() |
| 199 { | 199 { |
| 200 #if !ENABLE(OILPAN) | 200 #if !ENABLE(OILPAN) |
| 201 clearResourceAndEventBaseReferences(); | 201 clearResourceAndEventBaseReferences(); |
| 202 #endif | 202 #endif |
| 203 smilEndEventSender().cancelEvent(this); | 203 smilEndEventSender().cancelEvent(this); |
| 204 smilBeginEventSender().cancelEvent(this); | 204 smilBeginEventSender().cancelEvent(this); |
| 205 smilRepeatEventSender().cancelEvent(this); | 205 smilRepeatEventSender().cancelEvent(this); |
| 206 smilRepeatNEventSender().cancelEvent(this); | 206 smilRepeatNEventSender().cancelEvent(this); |
| 207 #if !ENABLE(OILPAN) | 207 #if !ENABLE(OILPAN) |
| 208 // FIXME: Oilpan: Clear |m_syncBaseDependents| using weak processing. | |
| 209 clearConditions(); | 208 clearConditions(); |
| 210 | 209 |
| 211 if (m_timeContainer && m_targetElement && hasValidAttributeName()) | 210 if (m_timeContainer && m_targetElement && hasValidAttributeName()) |
| 212 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); | 211 m_timeContainer->unschedule(this, m_targetElement, m_attributeName); |
| 213 #endif | 212 #endif |
| 214 } | 213 } |
| 215 | 214 |
| 216 void SVGSMILElement::clearResourceAndEventBaseReferences() | 215 void SVGSMILElement::clearResourceAndEventBaseReferences() |
| 217 { | 216 { |
| 218 document().accessSVGExtensions().removeAllTargetReferencesForElement(this); | 217 document().accessSVGExtensions().removeAllTargetReferencesForElement(this); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 | 594 |
| 596 void SVGSMILElement::connectSyncBaseConditions() | 595 void SVGSMILElement::connectSyncBaseConditions() |
| 597 { | 596 { |
| 598 if (m_syncBaseConditionsConnected) | 597 if (m_syncBaseConditionsConnected) |
| 599 disconnectSyncBaseConditions(); | 598 disconnectSyncBaseConditions(); |
| 600 m_syncBaseConditionsConnected = true; | 599 m_syncBaseConditionsConnected = true; |
| 601 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 600 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 602 Condition* condition = m_conditions[n].get(); | 601 Condition* condition = m_conditions[n].get(); |
| 603 if (condition->type() == Condition::Syncbase) { | 602 if (condition->type() == Condition::Syncbase) { |
| 604 ASSERT(!condition->baseID().isEmpty()); | 603 ASSERT(!condition->baseID().isEmpty()); |
| 605 condition->setSyncBase(treeScope().getElementById(AtomicString(condi tion->baseID()))); | 604 Element* element = treeScope().getElementById(AtomicString(condition ->baseID())); |
| 606 if (!condition->syncBase() || !isSVGSMILElement(*condition->syncBase ())) { | 605 if (!element || !isSVGSMILElement(*element)) { |
| 607 condition->setSyncBase(0); | 606 condition->setSyncBase(0); |
| 608 continue; | 607 continue; |
| 609 } | 608 } |
| 610 toSVGSMILElement(condition->syncBase())->addSyncBaseDependent(this); | 609 SVGSMILElement* svgSMILElement = toSVGSMILElement(element); |
| 610 condition->setSyncBase(svgSMILElement); | |
| 611 svgSMILElement->addSyncBaseDependent(this); | |
| 611 } | 612 } |
| 612 } | 613 } |
| 613 } | 614 } |
| 614 | 615 |
| 615 void SVGSMILElement::disconnectSyncBaseConditions() | 616 void SVGSMILElement::disconnectSyncBaseConditions() |
| 616 { | 617 { |
| 617 if (!m_syncBaseConditionsConnected) | 618 if (!m_syncBaseConditionsConnected) |
| 618 return; | 619 return; |
| 619 m_syncBaseConditionsConnected = false; | 620 m_syncBaseConditionsConnected = false; |
| 620 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 621 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 621 Condition* condition = m_conditions[n].get(); | 622 Condition* condition = m_conditions[n].get(); |
| 622 if (condition->type() == Condition::Syncbase) { | 623 if (condition->type() == Condition::Syncbase) { |
| 623 if (condition->syncBase()) | 624 if (condition->syncBase()) |
| 624 toSVGSMILElement(condition->syncBase())->removeSyncBaseDependent (this); | 625 condition->syncBase()->removeSyncBaseDependent(this); |
| 625 condition->setSyncBase(0); | 626 condition->setSyncBase(0); |
| 626 } | 627 } |
| 627 } | 628 } |
| 628 } | 629 } |
| 629 | 630 |
| 630 void SVGSMILElement::connectEventBaseConditions() | 631 void SVGSMILElement::connectEventBaseConditions() |
| 631 { | 632 { |
| 632 disconnectEventBaseConditions(); | 633 disconnectEventBaseConditions(); |
| 633 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 634 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 634 Condition* condition = m_conditions[n].get(); | 635 Condition* condition = m_conditions[n].get(); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1239 smilEndEventSender().dispatchEventSoon(this); | 1240 smilEndEventSender().dispatchEventSoon(this); |
| 1240 } | 1241 } |
| 1241 | 1242 |
| 1242 m_nextProgressTime = calculateNextProgressTime(elapsed); | 1243 m_nextProgressTime = calculateNextProgressTime(elapsed); |
| 1243 return animationIsContributing; | 1244 return animationIsContributing; |
| 1244 } | 1245 } |
| 1245 | 1246 |
| 1246 void SVGSMILElement::notifyDependentsIntervalChanged() | 1247 void SVGSMILElement::notifyDependentsIntervalChanged() |
| 1247 { | 1248 { |
| 1248 ASSERT(m_intervalBegin.isFinite()); | 1249 ASSERT(m_intervalBegin.isFinite()); |
| 1249 DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ()); | 1250 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapHashSet<RawPtrWillBeMem ber<SVGSMILElement> > >, loopBreaker, (adoptPtrWillBeNoop(new WillBeHeapHashSet< RawPtrWillBeMember<SVGSMILElement> >()))); |
|
haraken
2014/05/29 08:11:52
Discussed offline. I wonder if this Persistent<Mem
| |
| 1250 if (!loopBreaker.add(this).isNewEntry) | 1251 if (!loopBreaker->add(this).isNewEntry) |
| 1251 return; | 1252 return; |
| 1252 | 1253 |
| 1253 TimeDependentSet::iterator end = m_syncBaseDependents.end(); | 1254 TimeDependentSet::iterator end = m_syncBaseDependents.end(); |
| 1254 for (TimeDependentSet::iterator it = m_syncBaseDependents.begin(); it != end ; ++it) { | 1255 for (TimeDependentSet::iterator it = m_syncBaseDependents.begin(); it != end ; ++it) { |
| 1255 SVGSMILElement* dependent = *it; | 1256 SVGSMILElement* dependent = *it; |
| 1256 dependent->createInstanceTimesFromSyncbase(this); | 1257 dependent->createInstanceTimesFromSyncbase(this); |
| 1257 } | 1258 } |
| 1258 | 1259 |
| 1259 loopBreaker.remove(this); | 1260 loopBreaker->remove(this); |
| 1260 } | 1261 } |
| 1261 | 1262 |
| 1262 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) | 1263 void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncBase) |
| 1263 { | 1264 { |
| 1264 // FIXME: To be really correct, this should handle updating exising interval by changing | 1265 // FIXME: To be really correct, this should handle updating exising interval by changing |
| 1265 // the associated times instead of creating new ones. | 1266 // the associated times instead of creating new ones. |
| 1266 for (unsigned n = 0; n < m_conditions.size(); ++n) { | 1267 for (unsigned n = 0; n < m_conditions.size(); ++n) { |
| 1267 Condition* condition = m_conditions[n].get(); | 1268 Condition* condition = m_conditions[n].get(); |
| 1268 if (condition->type() == Condition::Syncbase && condition->syncBase() == syncBase) { | 1269 if (condition->type() == Condition::Syncbase && condition->syncBase() == syncBase) { |
| 1269 ASSERT(condition->name() == "begin" || condition->name() == "end"); | 1270 ASSERT(condition->name() == "begin" || condition->name() == "end"); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1351 void SVGSMILElement::trace(Visitor* visitor) | 1352 void SVGSMILElement::trace(Visitor* visitor) |
| 1352 { | 1353 { |
| 1353 visitor->trace(m_targetElement); | 1354 visitor->trace(m_targetElement); |
| 1354 visitor->trace(m_timeContainer); | 1355 visitor->trace(m_timeContainer); |
| 1355 visitor->trace(m_conditions); | 1356 visitor->trace(m_conditions); |
| 1356 visitor->trace(m_syncBaseDependents); | 1357 visitor->trace(m_syncBaseDependents); |
| 1357 SVGElement::trace(visitor); | 1358 SVGElement::trace(visitor); |
| 1358 } | 1359 } |
| 1359 | 1360 |
| 1360 } | 1361 } |
| OLD | NEW |