Title: [104362] trunk/Source/WebCore
- Revision
- 104362
- Author
- [email protected]
- Date
- 2012-01-06 17:23:41 -0800 (Fri, 06 Jan 2012)
Log Message
Use HashMap<OwnPtr> in SVGAttributeToPropertyMap
https://bugs.webkit.org/show_bug.cgi?id=75734
Reviewed by Daniel Bates.
* svg/properties/SVGAttributeToPropertyMap.cpp:
(WebCore::SVGAttributeToPropertyMap::addProperties):
(WebCore::SVGAttributeToPropertyMap::addProperty): use HashMap::add() to avoid an
extra hash lookup to set a new PropertiesVector.
(WebCore::SVGAttributeToPropertyMap::synchronizeProperties):
* svg/properties/SVGAttributeToPropertyMap.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104361 => 104362)
--- trunk/Source/WebCore/ChangeLog 2012-01-07 01:22:47 UTC (rev 104361)
+++ trunk/Source/WebCore/ChangeLog 2012-01-07 01:23:41 UTC (rev 104362)
@@ -1,3 +1,17 @@
+2012-01-06 Caio Marcelo de Oliveira Filho <[email protected]>
+
+ Use HashMap<OwnPtr> in SVGAttributeToPropertyMap
+ https://bugs.webkit.org/show_bug.cgi?id=75734
+
+ Reviewed by Daniel Bates.
+
+ * svg/properties/SVGAttributeToPropertyMap.cpp:
+ (WebCore::SVGAttributeToPropertyMap::addProperties):
+ (WebCore::SVGAttributeToPropertyMap::addProperty): use HashMap::add() to avoid an
+ extra hash lookup to set a new PropertiesVector.
+ (WebCore::SVGAttributeToPropertyMap::synchronizeProperties):
+ * svg/properties/SVGAttributeToPropertyMap.h:
+
2012-01-06 Greg Billock <[email protected]>
WebCore implementation of the Intent object
Modified: trunk/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp (104361 => 104362)
--- trunk/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp 2012-01-07 01:22:47 UTC (rev 104361)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp 2012-01-07 01:23:41 UTC (rev 104362)
@@ -31,7 +31,7 @@
{
AttributeToPropertiesMap::iterator end = map.m_map.end();
for (AttributeToPropertiesMap::iterator it = map.m_map.begin(); it != end; ++it) {
- PropertiesVector* vector = it->second;
+ PropertiesVector* vector = it->second.get();
ASSERT(vector);
PropertiesVector::iterator vectorEnd = vector->end();
@@ -44,13 +44,10 @@
{
ASSERT(info);
ASSERT(info->attributeName != anyQName());
- if (PropertiesVector* vector = m_map.get(info->attributeName)) {
- vector->append(info);
- return;
- }
- PropertiesVector* vector = new PropertiesVector;
+ OwnPtr<PropertiesVector>& vector = m_map.add(info->attributeName, nullptr).first->second;
+ if (!vector)
+ vector = adoptPtr(new PropertiesVector);
vector->append(info);
- m_map.set(info->attributeName, vector);
}
void SVGAttributeToPropertyMap::animatedPropertiesForAttribute(SVGElement* ownerType, const QualifiedName& attributeName, Vector<RefPtr<SVGAnimatedProperty> >& properties)
@@ -81,7 +78,7 @@
ASSERT(contextElement);
AttributeToPropertiesMap::iterator end = m_map.end();
for (AttributeToPropertiesMap::iterator it = m_map.begin(); it != end; ++it) {
- PropertiesVector* vector = it->second;
+ PropertiesVector* vector = it->second.get();
ASSERT(vector);
PropertiesVector::iterator vectorEnd = vector->end();
Modified: trunk/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h (104361 => 104362)
--- trunk/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h 2012-01-07 01:22:47 UTC (rev 104361)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h 2012-01-07 01:23:41 UTC (rev 104362)
@@ -33,9 +33,6 @@
class SVGAttributeToPropertyMap {
public:
- SVGAttributeToPropertyMap() { }
- ~SVGAttributeToPropertyMap() { deleteAllValues(m_map); }
-
bool isEmpty() const { return m_map.isEmpty(); }
void addProperties(SVGAttributeToPropertyMap&);
@@ -52,7 +49,7 @@
PassRefPtr<SVGAnimatedProperty> animatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, const SVGPropertyInfo*);
typedef Vector<const SVGPropertyInfo*> PropertiesVector;
- typedef HashMap<QualifiedName, PropertiesVector*> AttributeToPropertiesMap;
+ typedef HashMap<QualifiedName, OwnPtr<PropertiesVector> > AttributeToPropertiesMap;
AttributeToPropertiesMap m_map;
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes