Index: Source/core/svg/SVGElement.cpp |
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp |
index 254df4ec29e49a72ccb6c87193e4a04448401e6a..ca65b9030feea5cedc54dbe65d0b6b386d9af307 100644 |
--- a/Source/core/svg/SVGElement.cpp |
+++ b/Source/core/svg/SVGElement.cpp |
@@ -532,7 +532,7 @@ void SVGElement::mapInstanceToElement(SVGElementInstance* instance) |
{ |
ASSERT(instance); |
- HashSet<SVGElement*>& instances = ensureSVGRareData()->elementInstances(); |
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = ensureSVGRareData()->elementInstances(); |
ASSERT(!instances.contains(instance->shadowTreeElement())); |
instances.add(instance->shadowTreeElement()); |
@@ -546,18 +546,27 @@ void SVGElement::removeInstanceMapping(SVGElementInstance* instance) |
if (!instance->shadowTreeElement()) |
return; |
- HashSet<SVGElement*>& instances = svgRareData()->elementInstances(); |
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = svgRareData()->elementInstances(); |
haraken
2014/05/07 12:50:20
Shall we typedef this? We have a lot of WillBeHea
Mads Ager (chromium)
2014/05/08 09:08:59
The issue is that this type is used all over the p
haraken
2014/05/08 09:15:41
Probably you can define it in SVGElement.h, since
|
ASSERT(instances.contains(instance->shadowTreeElement())); |
instances.remove(instance->shadowTreeElement()); |
} |
-const HashSet<SVGElement*>& SVGElement::instancesForElement() const |
+static WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& emptyInstances() |
{ |
- if (!hasSVGRareData()) { |
- DEFINE_STATIC_LOCAL(HashSet<SVGElement*>, emptyInstances, ()); |
- return emptyInstances; |
- } |
+#if ENABLE(OILPAN) |
+ DEFINE_STATIC_LOCAL(Persistent<HeapHashSet<WeakMember<SVGElement> > >, emptyInstances, (new HeapHashSet<WeakMember<SVGElement> >)); |
+ return *emptyInstances; |
+#else |
+ DEFINE_STATIC_LOCAL(HashSet<RawPtr<SVGElement> >, emptyInstances, ()); |
+ return emptyInstances; |
+#endif |
+} |
+ |
+const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& SVGElement::instancesForElement() const |
+{ |
+ if (!hasSVGRareData()) |
+ return emptyInstances(); |
return svgRareData()->elementInstances(); |
haraken
2014/05/07 12:50:20
Probably not related to your CL, but I'm not quite
Mads Ager (chromium)
2014/05/08 09:08:59
Yeah, unrelated to my change. When you collect ele
|
} |
@@ -785,7 +794,7 @@ bool SVGElement::haveLoadedRequiredResources() |
return true; |
} |
-static inline void collectInstancesForSVGElement(SVGElement* element, HashSet<SVGElement*>& instances) |
+static inline void collectInstancesForSVGElement(SVGElement* element, WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances) |
{ |
ASSERT(element); |
if (element->containingShadowRoot()) |
@@ -805,10 +814,10 @@ bool SVGElement::addEventListener(const AtomicString& eventType, PassRefPtr<Even |
return false; |
// Add event listener to all shadow tree DOM element instances |
- HashSet<SVGElement*> instances; |
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> > instances; |
collectInstancesForSVGElement(this, instances); |
- const HashSet<SVGElement*>::const_iterator end = instances.end(); |
- for (HashSet<SVGElement*>::const_iterator it = instances.begin(); it != end; ++it) { |
+ const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = instances.end(); |
+ for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = instances.begin(); it != end; ++it) { |
bool result = (*it)->Node::addEventListener(eventType, listener, useCapture); |
ASSERT_UNUSED(result, result); |
} |
@@ -818,7 +827,7 @@ bool SVGElement::addEventListener(const AtomicString& eventType, PassRefPtr<Even |
bool SVGElement::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) |
{ |
- HashSet<SVGElement*> instances; |
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> > instances; |
collectInstancesForSVGElement(this, instances); |
if (instances.isEmpty()) |
return Node::removeEventListener(eventType, listener, useCapture); |
@@ -835,8 +844,8 @@ bool SVGElement::removeEventListener(const AtomicString& eventType, EventListene |
return false; |
// Remove event listener from all shadow tree DOM element instances |
- const HashSet<SVGElement*>::const_iterator end = instances.end(); |
- for (HashSet<SVGElement*>::const_iterator it = instances.begin(); it != end; ++it) { |
+ const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = instances.end(); |
+ for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = instances.begin(); it != end; ++it) { |
SVGElement* shadowTreeElement = *it; |
ASSERT(shadowTreeElement); |
@@ -1041,13 +1050,13 @@ void SVGElement::invalidateInstances() |
if (instanceUpdatesBlocked()) |
return; |
- const HashSet<SVGElement*>& set = instancesForElement(); |
+ const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& set = instancesForElement(); |
if (set.isEmpty()) |
return; |
// Mark all use elements referencing 'element' for rebuilding |
- const HashSet<SVGElement*>::const_iterator end = set.end(); |
- for (HashSet<SVGElement*>::const_iterator it = set.begin(); it != end; ++it) { |
+ const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end(); |
+ for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) { |
(*it)->setCorrespondingElement(0); |
if (SVGUseElement* element = (*it)->correspondingUseElement()) { |