| Index: third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
|
| diff --git a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
|
| index 1e32b5af0aa4d5eee53792f1f7a28bcca7fcee17..a203587adde56fcd11134c6bcaf1d267011b7c93 100644
|
| --- a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
|
| +++ b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
|
| @@ -211,47 +211,26 @@ void SVGDocumentExtensions::clearHasPendingResourcesIfPossible(
|
|
|
| void SVGDocumentExtensions::removeElementFromPendingResources(
|
| Element* element) {
|
| - ASSERT(element);
|
| + DCHECK(element);
|
|
|
| // Remove the element from pending resources.
|
| - if (!m_pendingResources.isEmpty() && element->hasPendingResources()) {
|
| - Vector<AtomicString> toBeRemoved;
|
| - for (const auto& entry : m_pendingResources) {
|
| - SVGPendingElements* elements = entry.value.get();
|
| - ASSERT(elements);
|
| - ASSERT(!elements->isEmpty());
|
| -
|
| - elements->remove(element);
|
| - if (elements->isEmpty())
|
| - toBeRemoved.append(entry.key);
|
| - }
|
| -
|
| - clearHasPendingResourcesIfPossible(element);
|
| -
|
| - // We use the removePendingResource function here because it deals with set
|
| - // lifetime correctly.
|
| - for (const AtomicString& id : toBeRemoved)
|
| - removePendingResource(id);
|
| - }
|
| + if (m_pendingResources.isEmpty() || !element->hasPendingResources())
|
| + return;
|
|
|
| - // Remove the element from pending resources that were scheduled for removal.
|
| - if (!m_pendingResourcesForRemoval.isEmpty()) {
|
| - Vector<AtomicString> toBeRemoved;
|
| - for (const auto& entry : m_pendingResourcesForRemoval) {
|
| - SVGPendingElements* elements = entry.value.get();
|
| - ASSERT(elements);
|
| - ASSERT(!elements->isEmpty());
|
| -
|
| - elements->remove(element);
|
| - if (elements->isEmpty())
|
| - toBeRemoved.append(entry.key);
|
| - }
|
| -
|
| - // We use the removePendingResourceForRemoval function here because it deals
|
| - // with set lifetime correctly.
|
| - for (const AtomicString& id : toBeRemoved)
|
| - removePendingResourceForRemoval(id);
|
| + Vector<AtomicString> toBeRemoved;
|
| + for (const auto& entry : m_pendingResources) {
|
| + SVGPendingElements* elements = entry.value.get();
|
| + DCHECK(elements);
|
| + DCHECK(!elements->isEmpty());
|
| +
|
| + elements->remove(element);
|
| + if (elements->isEmpty())
|
| + toBeRemoved.append(entry.key);
|
| }
|
| +
|
| + clearHasPendingResourcesIfPossible(element);
|
| +
|
| + m_pendingResources.removeAll(toBeRemoved);
|
| }
|
|
|
| SVGDocumentExtensions::SVGPendingElements*
|
| @@ -260,44 +239,6 @@ SVGDocumentExtensions::removePendingResource(const AtomicString& id) {
|
| return m_pendingResources.take(id);
|
| }
|
|
|
| -SVGDocumentExtensions::SVGPendingElements*
|
| -SVGDocumentExtensions::removePendingResourceForRemoval(const AtomicString& id) {
|
| - ASSERT(m_pendingResourcesForRemoval.contains(id));
|
| - return m_pendingResourcesForRemoval.take(id);
|
| -}
|
| -
|
| -void SVGDocumentExtensions::markPendingResourcesForRemoval(
|
| - const AtomicString& id) {
|
| - if (id.isEmpty())
|
| - return;
|
| -
|
| - ASSERT(!m_pendingResourcesForRemoval.contains(id));
|
| -
|
| - Member<SVGPendingElements> existing = m_pendingResources.take(id);
|
| - if (existing && !existing->isEmpty())
|
| - m_pendingResourcesForRemoval.add(id, existing.release());
|
| -}
|
| -
|
| -Element* SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval(
|
| - const AtomicString& id) {
|
| - if (id.isEmpty())
|
| - return nullptr;
|
| -
|
| - SVGPendingElements* resourceSet = m_pendingResourcesForRemoval.get(id);
|
| - if (!resourceSet || resourceSet->isEmpty())
|
| - return nullptr;
|
| -
|
| - SVGPendingElements::iterator firstElement = resourceSet->begin();
|
| - Element* element = *firstElement;
|
| -
|
| - resourceSet->remove(firstElement);
|
| -
|
| - if (resourceSet->isEmpty())
|
| - removePendingResourceForRemoval(id);
|
| -
|
| - return element;
|
| -}
|
| -
|
| void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(
|
| SVGSVGElement* svgRoot) {
|
| ASSERT(!m_inRelativeLengthSVGRootsInvalidation);
|
| @@ -361,7 +302,6 @@ DEFINE_TRACE(SVGDocumentExtensions) {
|
| visitor->trace(m_webAnimationsPendingSVGElements);
|
| visitor->trace(m_relativeLengthSVGRoots);
|
| visitor->trace(m_pendingResources);
|
| - visitor->trace(m_pendingResourcesForRemoval);
|
| }
|
|
|
| } // namespace blink
|
|
|