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

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

Issue 2696183002: Migrate WTF::HashSet::remove() to ::erase() [part 1] (Closed)
Patch Set: one more platform-specific reference 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 // 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DCHECK(element); 102 DCHECK(element);
103 103
104 // Remove the element from pending resources. 104 // Remove the element from pending resources.
105 if (!m_pendingResources.isEmpty() && element->hasPendingResources()) { 105 if (!m_pendingResources.isEmpty() && element->hasPendingResources()) {
106 Vector<AtomicString> toBeRemoved; 106 Vector<AtomicString> toBeRemoved;
107 for (const auto& entry : m_pendingResources) { 107 for (const auto& entry : m_pendingResources) {
108 SVGPendingElements* elements = entry.value.get(); 108 SVGPendingElements* elements = entry.value.get();
109 DCHECK(elements); 109 DCHECK(elements);
110 DCHECK(!elements->isEmpty()); 110 DCHECK(!elements->isEmpty());
111 111
112 elements->remove(element); 112 elements->erase(element);
113 if (elements->isEmpty()) 113 if (elements->isEmpty())
114 toBeRemoved.push_back(entry.key); 114 toBeRemoved.push_back(entry.key);
115 } 115 }
116 116
117 clearHasPendingResourcesIfPossible(element); 117 clearHasPendingResourcesIfPossible(element);
118 118
119 // We use the removePendingResource function here because it deals with set 119 // We use the removePendingResource function here because it deals with set
120 // lifetime correctly. 120 // lifetime correctly.
121 for (const AtomicString& id : toBeRemoved) 121 for (const AtomicString& id : toBeRemoved)
122 removePendingResource(id); 122 removePendingResource(id);
123 } 123 }
124 } 124 }
125 125
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 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.cpp ('k') | third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698