[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
eric at webkit.org
eric at webkit.org
Thu Dec 3 13:20:03 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b9d8723f370e2c3abdf2a0b8a92ef981ee119c2f
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 27 03:38:56 2009 +0000
2009-10-26 Matt Mueller <mattm at chromium.org>
Reviewed by Darin Adler.
Refactor synchronizable property handling to store one shouldSynchronize flag per set of properties rather than one per property.
Fixes reading uninitialized memory in SynchronizableProperty hash function as well as simplifying the code.
https://bugs.webkit.org/show_bug.cgi?id=30658
Covered by running various svg tests under valgrind, ex:
LayoutTests/svg/custom/js-late-mask-and-object-creation.svg
* svg/SynchronizablePropertyController.cpp:
(WebCore::SynchronizableProperties::addProperty):
(WebCore::SynchronizableProperties::synchronize):
(WebCore::SynchronizableProperties::startAnimation):
(WebCore::SynchronizableProperties::stopAnimation):
(WebCore::SynchronizablePropertyController::registerProperty):
(WebCore::SynchronizablePropertyController::setPropertyNeedsSynchronization):
(WebCore::SynchronizablePropertyController::synchronizeProperty):
(WebCore::SynchronizablePropertyController::synchronizeAllProperties):
(WebCore::SynchronizablePropertyController::startAnimation):
(WebCore::SynchronizablePropertyController::stopAnimation):
* svg/SynchronizablePropertyController.h:
(WebCore::SynchronizableProperties::SynchronizableProperties):
(WebCore::SynchronizableProperties::setNeedsSynchronization):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50126 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bc65512..ea93f62 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2009-10-26 Matt Mueller <mattm at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Refactor synchronizable property handling to store one shouldSynchronize flag per set of properties rather than one per property.
+
+ Fixes reading uninitialized memory in SynchronizableProperty hash function as well as simplifying the code.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30658
+
+ Covered by running various svg tests under valgrind, ex:
+ LayoutTests/svg/custom/js-late-mask-and-object-creation.svg
+
+ * svg/SynchronizablePropertyController.cpp:
+ (WebCore::SynchronizableProperties::addProperty):
+ (WebCore::SynchronizableProperties::synchronize):
+ (WebCore::SynchronizableProperties::startAnimation):
+ (WebCore::SynchronizableProperties::stopAnimation):
+ (WebCore::SynchronizablePropertyController::registerProperty):
+ (WebCore::SynchronizablePropertyController::setPropertyNeedsSynchronization):
+ (WebCore::SynchronizablePropertyController::synchronizeProperty):
+ (WebCore::SynchronizablePropertyController::synchronizeAllProperties):
+ (WebCore::SynchronizablePropertyController::startAnimation):
+ (WebCore::SynchronizablePropertyController::stopAnimation):
+ * svg/SynchronizablePropertyController.h:
+ (WebCore::SynchronizableProperties::SynchronizableProperties):
+ (WebCore::SynchronizableProperties::setNeedsSynchronization):
+
2009-10-26 Kelly Norton <knorton at google.com>
Reviewed by Timothy Hatcher.
diff --git a/WebCore/svg/SynchronizablePropertyController.cpp b/WebCore/svg/SynchronizablePropertyController.cpp
index e969514..be8ab78 100644
--- a/WebCore/svg/SynchronizablePropertyController.cpp
+++ b/WebCore/svg/SynchronizablePropertyController.cpp
@@ -28,6 +28,52 @@
namespace WebCore {
+void SynchronizableProperties::addProperty(SVGAnimatedPropertyBase* base)
+{
+ m_bases.add(base);
+}
+
+void SynchronizableProperties::synchronize()
+{
+ ASSERT(!m_bases.isEmpty());
+ if (m_shouldSynchronize) {
+ BaseSet::iterator it = m_bases.begin();
+ BaseSet::iterator end = m_bases.end();
+
+ for (; it != end; ++it) {
+ SVGAnimatedPropertyBase* base = *it;
+ ASSERT(base);
+ base->synchronize();
+ }
+ }
+}
+
+void SynchronizableProperties::startAnimation()
+{
+ ASSERT(!m_bases.isEmpty());
+ BaseSet::iterator it = m_bases.begin();
+ BaseSet::iterator end = m_bases.end();
+
+ for (; it != end; ++it) {
+ SVGAnimatedPropertyBase* base = *it;
+ ASSERT(base);
+ base->startAnimation();
+ }
+}
+
+void SynchronizableProperties::stopAnimation()
+{
+ ASSERT(!m_bases.isEmpty());
+ BaseSet::iterator it = m_bases.begin();
+ BaseSet::iterator end = m_bases.end();
+
+ for (; it != end; ++it) {
+ SVGAnimatedPropertyBase* base = *it;
+ ASSERT(base);
+ base->stopAnimation();
+ }
+}
+
SynchronizablePropertyController::SynchronizablePropertyController()
{
}
@@ -36,20 +82,15 @@ void SynchronizablePropertyController::registerProperty(const QualifiedName& att
{
// 'attrName' is ambigious. For instance in SVGMarkerElement both 'orientType' / 'orientAngle'
// SVG DOM objects are synchronized with the 'orient' attribute. This why we need a HashSet.
- SynchronizableProperty property(base);
-
PropertyMap::iterator it = m_map.find(attrName.localName());
if (it == m_map.end()) {
- Properties properties;
- properties.add(property);
+ SynchronizableProperties properties;
+ properties.addProperty(base);
m_map.set(attrName.localName(), properties);
return;
}
- Properties& properties = it->second;
- ASSERT(!properties.isEmpty());
-
- properties.add(property);
+ it->second.addProperty(base);
}
void SynchronizablePropertyController::setPropertyNeedsSynchronization(const QualifiedName& attrName)
@@ -57,17 +98,7 @@ void SynchronizablePropertyController::setPropertyNeedsSynchronization(const Qua
PropertyMap::iterator itProp = m_map.find(attrName.localName());
ASSERT(itProp != m_map.end());
- Properties& properties = itProp->second;
- ASSERT(!properties.isEmpty());
-
- Properties::iterator it = properties.begin();
- Properties::iterator end = properties.end();
-
- for (; it != end; ++it) {
- SynchronizableProperty& property = *it;
- ASSERT(property.base);
- property.shouldSynchronize = true;
- }
+ itProp->second.setNeedsSynchronization();
}
void SynchronizablePropertyController::synchronizeProperty(const String& name)
@@ -76,21 +107,7 @@ void SynchronizablePropertyController::synchronizeProperty(const String& name)
if (itProp == m_map.end())
return;
- Properties& properties = itProp->second;
- ASSERT(!properties.isEmpty());
-
- Properties::iterator it = properties.begin();
- Properties::iterator end = properties.end();
-
- for (; it != end; ++it) {
- SynchronizableProperty& property = *it;
- ASSERT(property.base);
-
- if (!property.shouldSynchronize)
- continue;
-
- property.base->synchronize();
- }
+ itProp->second.synchronize();
}
void SynchronizablePropertyController::synchronizeAllProperties()
@@ -101,23 +118,8 @@ void SynchronizablePropertyController::synchronizeAllProperties()
PropertyMap::iterator itProp = m_map.begin();
PropertyMap::iterator endProp = m_map.end();
- for (; itProp != endProp; ++itProp) {
- Properties& properties = itProp->second;
- ASSERT(!properties.isEmpty());
-
- Properties::iterator it = properties.begin();
- Properties::iterator end = properties.end();
-
- for (; it != end; ++it) {
- SynchronizableProperty& property = *it;
- ASSERT(property.base);
-
- if (!property.shouldSynchronize)
- continue;
-
- property.base->synchronize();
- }
- }
+ for (; itProp != endProp; ++itProp)
+ itProp->second.synchronize();
}
void SynchronizablePropertyController::startAnimation(const String& name)
@@ -126,17 +128,7 @@ void SynchronizablePropertyController::startAnimation(const String& name)
if (itProp == m_map.end())
return;
- Properties& properties = itProp->second;
- ASSERT(!properties.isEmpty());
-
- Properties::iterator it = properties.begin();
- Properties::iterator end = properties.end();
-
- for (; it != end; ++it) {
- SynchronizableProperty& property = *it;
- ASSERT(property.base);
- property.base->startAnimation();
- }
+ itProp->second.startAnimation();
}
void SynchronizablePropertyController::stopAnimation(const String& name)
@@ -145,17 +137,7 @@ void SynchronizablePropertyController::stopAnimation(const String& name)
if (itProp == m_map.end())
return;
- Properties& properties = itProp->second;
- ASSERT(!properties.isEmpty());
-
- Properties::iterator it = properties.begin();
- Properties::iterator end = properties.end();
-
- for (; it != end; ++it) {
- SynchronizableProperty& property = *it;
- ASSERT(property.base);
- property.base->stopAnimation();
- }
+ itProp->second.stopAnimation();
}
}
diff --git a/WebCore/svg/SynchronizablePropertyController.h b/WebCore/svg/SynchronizablePropertyController.h
index b7f101b..1ec5026 100644
--- a/WebCore/svg/SynchronizablePropertyController.h
+++ b/WebCore/svg/SynchronizablePropertyController.h
@@ -31,65 +31,28 @@ namespace WebCore {
class QualifiedName;
class SVGAnimatedPropertyBase;
-struct SynchronizableProperty {
- SynchronizableProperty()
- : base(0)
- , shouldSynchronize(false)
- {
- }
-
- explicit SynchronizableProperty(SVGAnimatedPropertyBase* _base)
- : base(_base)
- , shouldSynchronize(false)
- {
- }
-
- explicit SynchronizableProperty(WTF::HashTableDeletedValueType)
- : base(reinterpret_cast<SVGAnimatedPropertyBase*>(-1))
- , shouldSynchronize(false)
- {
- }
-
- bool isHashTableDeletedValue() const
- {
- return base == reinterpret_cast<SVGAnimatedPropertyBase*>(-1);
- }
-
- bool operator==(const SynchronizableProperty& other) const
- {
- return base == other.base && shouldSynchronize == other.shouldSynchronize;
- }
-
- SVGAnimatedPropertyBase* base;
- bool shouldSynchronize;
-};
-
-struct SynchronizablePropertyHash {
- static unsigned hash(const SynchronizableProperty& key)
+class SynchronizableProperties {
+public:
+ SynchronizableProperties()
+ : m_shouldSynchronize(false)
{
- return StringImpl::computeHash(reinterpret_cast<const UChar*>(&key), sizeof(SynchronizableProperty) / sizeof(UChar));
}
- static bool equal(const SynchronizableProperty& a, const SynchronizableProperty& b)
+ void setNeedsSynchronization()
{
- return a == b;
+ m_shouldSynchronize = true;
}
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-struct SynchronizablePropertyHashTraits : WTF::GenericHashTraits<SynchronizableProperty> {
- static const bool emptyValueIsZero = true;
+ void addProperty(SVGAnimatedPropertyBase*);
+ void synchronize();
+ void startAnimation();
+ void stopAnimation();
- static void constructDeletedValue(SynchronizableProperty& slot)
- {
- new (&slot) SynchronizableProperty(WTF::HashTableDeletedValue);
- }
+private:
+ typedef HashSet<SVGAnimatedPropertyBase*> BaseSet;
- static bool isDeletedValue(const SynchronizableProperty& value)
- {
- return value.isHashTableDeletedValue();
- }
+ BaseSet m_bases;
+ bool m_shouldSynchronize;
};
// Helper class used exclusively by SVGElement to keep track of all animatable properties within a SVGElement,
@@ -110,8 +73,7 @@ private:
SynchronizablePropertyController();
private:
- typedef HashSet<SynchronizableProperty, SynchronizablePropertyHash, SynchronizablePropertyHashTraits> Properties;
- typedef HashMap<String, Properties> PropertyMap;
+ typedef HashMap<String, SynchronizableProperties> PropertyMap;
PropertyMap m_map;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list