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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGElement.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 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) { 525 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) {
526 if (!currentNode.isSVGElement()) 526 if (!currentNode.isSVGElement())
527 break; 527 break;
528 SVGElement& currentElement = toSVGElement(currentNode); 528 SVGElement& currentElement = toSVGElement(currentNode);
529 ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation); 529 ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation);
530 530
531 bool hadRelativeLengths = currentElement.hasRelativeLengths(); 531 bool hadRelativeLengths = currentElement.hasRelativeLengths();
532 if (clientHasRelativeLengths) 532 if (clientHasRelativeLengths)
533 currentElement.m_elementsWithRelativeLengths.insert(clientElement); 533 currentElement.m_elementsWithRelativeLengths.insert(clientElement);
534 else 534 else
535 currentElement.m_elementsWithRelativeLengths.remove(clientElement); 535 currentElement.m_elementsWithRelativeLengths.erase(clientElement);
536 536
537 // If the relative length state hasn't changed, we can stop propagating the 537 // If the relative length state hasn't changed, we can stop propagating the
538 // notification. 538 // notification.
539 if (hadRelativeLengths == currentElement.hasRelativeLengths()) 539 if (hadRelativeLengths == currentElement.hasRelativeLengths())
540 return; 540 return;
541 541
542 clientElement = &currentElement; 542 clientElement = &currentElement;
543 clientHasRelativeLengths = clientElement->hasRelativeLengths(); 543 clientHasRelativeLengths = clientElement->hasRelativeLengths();
544 } 544 }
545 545
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 void SVGElement::removeInstanceMapping(SVGElement* instance) { 622 void SVGElement::removeInstanceMapping(SVGElement* instance) {
623 ASSERT(instance); 623 ASSERT(instance);
624 ASSERT(instance->inUseShadowTree()); 624 ASSERT(instance->inUseShadowTree());
625 625
626 if (!hasSVGRareData()) 626 if (!hasSVGRareData())
627 return; 627 return;
628 628
629 HeapHashSet<WeakMember<SVGElement>>& instances = 629 HeapHashSet<WeakMember<SVGElement>>& instances =
630 svgRareData()->elementInstances(); 630 svgRareData()->elementInstances();
631 631
632 instances.remove(instance); 632 instances.erase(instance);
633 } 633 }
634 634
635 static HeapHashSet<WeakMember<SVGElement>>& emptyInstances() { 635 static HeapHashSet<WeakMember<SVGElement>>& emptyInstances() {
636 DEFINE_STATIC_LOCAL(HeapHashSet<WeakMember<SVGElement>>, emptyInstances, 636 DEFINE_STATIC_LOCAL(HeapHashSet<WeakMember<SVGElement>>, emptyInstances,
637 (new HeapHashSet<WeakMember<SVGElement>>)); 637 (new HeapHashSet<WeakMember<SVGElement>>));
638 return emptyInstances; 638 return emptyInstances;
639 } 639 }
640 640
641 const HeapHashSet<WeakMember<SVGElement>>& SVGElement::instancesForElement() 641 const HeapHashSet<WeakMember<SVGElement>>& SVGElement::instancesForElement()
642 const { 642 const {
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 } 1271 }
1272 } 1272 }
1273 1273
1274 void SVGElement::removeAllIncomingReferences() { 1274 void SVGElement::removeAllIncomingReferences() {
1275 if (!hasSVGRareData()) 1275 if (!hasSVGRareData())
1276 return; 1276 return;
1277 1277
1278 SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); 1278 SVGElementSet& incomingReferences = svgRareData()->incomingReferences();
1279 for (SVGElement* sourceElement : incomingReferences) { 1279 for (SVGElement* sourceElement : incomingReferences) {
1280 ASSERT(sourceElement->hasSVGRareData()); 1280 ASSERT(sourceElement->hasSVGRareData());
1281 sourceElement->ensureSVGRareData()->outgoingReferences().remove(this); 1281 sourceElement->ensureSVGRareData()->outgoingReferences().erase(this);
1282 } 1282 }
1283 incomingReferences.clear(); 1283 incomingReferences.clear();
1284 } 1284 }
1285 1285
1286 void SVGElement::removeAllOutgoingReferences() { 1286 void SVGElement::removeAllOutgoingReferences() {
1287 if (!hasSVGRareData()) 1287 if (!hasSVGRareData())
1288 return; 1288 return;
1289 1289
1290 SVGElementSet& outgoingReferences = svgRareData()->outgoingReferences(); 1290 SVGElementSet& outgoingReferences = svgRareData()->outgoingReferences();
1291 for (SVGElement* targetElement : outgoingReferences) { 1291 for (SVGElement* targetElement : outgoingReferences) {
1292 ASSERT(targetElement->hasSVGRareData()); 1292 ASSERT(targetElement->hasSVGRareData());
1293 targetElement->ensureSVGRareData()->incomingReferences().remove(this); 1293 targetElement->ensureSVGRareData()->incomingReferences().erase(this);
1294 } 1294 }
1295 outgoingReferences.clear(); 1295 outgoingReferences.clear();
1296 } 1296 }
1297 1297
1298 DEFINE_TRACE(SVGElement) { 1298 DEFINE_TRACE(SVGElement) {
1299 visitor->trace(m_elementsWithRelativeLengths); 1299 visitor->trace(m_elementsWithRelativeLengths);
1300 visitor->trace(m_attributeToPropertyMap); 1300 visitor->trace(m_attributeToPropertyMap);
1301 visitor->trace(m_SVGRareData); 1301 visitor->trace(m_SVGRareData);
1302 visitor->trace(m_className); 1302 visitor->trace(m_className);
1303 Element::trace(visitor); 1303 Element::trace(visitor);
1304 } 1304 }
1305 1305
1306 const AtomicString& SVGElement::eventParameterName() { 1306 const AtomicString& SVGElement::eventParameterName() {
1307 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1307 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1308 return evtString; 1308 return evtString;
1309 } 1309 }
1310 1310
1311 } // namespace blink 1311 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698