| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/svg/SVGTreeScopeResources.h" | 5 #include "core/svg/SVGTreeScopeResources.h" |
| 6 | 6 |
| 7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
| 8 #include "core/dom/TreeScope.h" | 8 #include "core/dom/TreeScope.h" |
| 9 #include "core/layout/svg/LayoutSVGResourceContainer.h" | 9 #include "core/layout/svg/LayoutSVGResourceContainer.h" |
| 10 #include "wtf/text/AtomicString.h" | 10 #include "wtf/text/AtomicString.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 void SVGTreeScopeResources::addPendingResource(const AtomicString& id, | 46 void SVGTreeScopeResources::addPendingResource(const AtomicString& id, |
| 47 Element* element) { | 47 Element* element) { |
| 48 DCHECK(element); | 48 DCHECK(element); |
| 49 DCHECK(element->isConnected()); | 49 DCHECK(element->isConnected()); |
| 50 | 50 |
| 51 if (id.isEmpty()) | 51 if (id.isEmpty()) |
| 52 return; | 52 return; |
| 53 | 53 |
| 54 HeapHashMap<AtomicString, Member<SVGPendingElements>>::AddResult result = | 54 HeapHashMap<AtomicString, Member<SVGPendingElements>>::AddResult result = |
| 55 m_pendingResources.add(id, nullptr); | 55 m_pendingResources.insert(id, nullptr); |
| 56 if (result.isNewEntry) | 56 if (result.isNewEntry) |
| 57 result.storedValue->value = new SVGPendingElements; | 57 result.storedValue->value = new SVGPendingElements; |
| 58 result.storedValue->value->insert(element); | 58 result.storedValue->value->insert(element); |
| 59 | 59 |
| 60 element->setHasPendingResources(); | 60 element->setHasPendingResources(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool SVGTreeScopeResources::hasPendingResource(const AtomicString& id) const { | 63 bool SVGTreeScopeResources::hasPendingResource(const AtomicString& id) const { |
| 64 if (id.isEmpty()) | 64 if (id.isEmpty()) |
| 65 return false; | 65 return false; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 SVGTreeScopeResources::SVGPendingElements* | 126 SVGTreeScopeResources::SVGPendingElements* |
| 127 SVGTreeScopeResources::removePendingResource(const AtomicString& id) { | 127 SVGTreeScopeResources::removePendingResource(const AtomicString& id) { |
| 128 DCHECK(m_pendingResources.contains(id)); | 128 DCHECK(m_pendingResources.contains(id)); |
| 129 return m_pendingResources.take(id); | 129 return m_pendingResources.take(id); |
| 130 } | 130 } |
| 131 | 131 |
| 132 DEFINE_TRACE(SVGTreeScopeResources) { | 132 DEFINE_TRACE(SVGTreeScopeResources) { |
| 133 visitor->trace(m_pendingResources); | 133 visitor->trace(m_pendingResources); |
| 134 } | 134 } |
| 135 } | 135 } |
| OLD | NEW |