Title: [149677] trunk/Source/WebCore
Revision
149677
Author
[email protected]
Date
2013-05-07 09:54:52 -0700 (Tue, 07 May 2013)

Log Message

Use OwnPtr instead of deleteAllValues in SMILTimeContainer
https://bugs.webkit.org/show_bug.cgi?id=115730

Reviewed by Geoffrey Garen.

* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::~SMILTimeContainer): Removed call to deleteAllValues.
(WebCore::SMILTimeContainer::schedule): Use add instead of get/set to put a new
AnimationsVector into the map as needed.
(WebCore::SMILTimeContainer::setElapsed): Added get since values are OwnPtr now.
(WebCore::SMILTimeContainer::updateAnimations): Ditto.

* svg/animation/SMILTimeContainer.h: Changed value type of GroupedAnimationsMap
to OwnPtr instead of raw pointer.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149676 => 149677)


--- trunk/Source/WebCore/ChangeLog	2013-05-07 16:53:23 UTC (rev 149676)
+++ trunk/Source/WebCore/ChangeLog	2013-05-07 16:54:52 UTC (rev 149677)
@@ -1,3 +1,20 @@
+2013-05-07  Darin Adler  <[email protected]>
+
+        Use OwnPtr instead of deleteAllValues in SMILTimeContainer
+        https://bugs.webkit.org/show_bug.cgi?id=115730
+
+        Reviewed by Geoffrey Garen.
+
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::~SMILTimeContainer): Removed call to deleteAllValues.
+        (WebCore::SMILTimeContainer::schedule): Use add instead of get/set to put a new
+        AnimationsVector into the map as needed.
+        (WebCore::SMILTimeContainer::setElapsed): Added get since values are OwnPtr now.
+        (WebCore::SMILTimeContainer::updateAnimations): Ditto.
+
+        * svg/animation/SMILTimeContainer.h: Changed value type of GroupedAnimationsMap
+        to OwnPtr instead of raw pointer.
+
 2013-05-07  Anders Carlsson  <[email protected]>
 
         Remove AlwaysInline.h from WTF

Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (149676 => 149677)


--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2013-05-07 16:53:23 UTC (rev 149676)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp	2013-05-07 16:54:52 UTC (rev 149677)
@@ -59,7 +59,6 @@
 #ifndef NDEBUG
     ASSERT(!m_preventScheduledAnimationsChanges);
 #endif
-    deleteAllValues(m_scheduledAnimations);
 }
 
 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target, const QualifiedName& attributeName)
@@ -73,11 +72,9 @@
 #endif
 
     ElementAttributePair key(target, attributeName);
-    AnimationsVector* scheduled = m_scheduledAnimations.get(key);
-    if (!scheduled) {
-        scheduled = new AnimationsVector();
-        m_scheduledAnimations.set(key, scheduled);
-    }
+    OwnPtr<AnimationsVector>& scheduled = m_scheduledAnimations.add(key, nullptr).iterator->value;
+    if (!scheduled)
+        scheduled = adoptPtr(new AnimationsVector);
     ASSERT(!scheduled->contains(animation));
     scheduled->append(animation);
 
@@ -191,7 +188,7 @@
 #endif
     GroupedAnimationsMap::iterator end = m_scheduledAnimations.end();
     for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it != end; ++it) {
-        AnimationsVector* scheduled = it->value;
+        AnimationsVector* scheduled = it->value.get();
         unsigned size = scheduled->size();
         for (unsigned n = 0; n < size; n++)
             scheduled->at(n)->reset();
@@ -269,7 +266,7 @@
     AnimationsVector animationsToApply;
     GroupedAnimationsMap::iterator end = m_scheduledAnimations.end();
     for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it != end; ++it) {
-        AnimationsVector* scheduled = it->value;
+        AnimationsVector* scheduled = it->value.get();
 
         // Sort according to priority. Elements with later begin time have higher priority.
         // In case of a tie, document order decides. 

Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.h (149676 => 149677)


--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.h	2013-05-07 16:53:23 UTC (rev 149676)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.h	2013-05-07 16:54:52 UTC (rev 149677)
@@ -87,7 +87,7 @@
 
     typedef pair<SVGElement*, QualifiedName> ElementAttributePair;
     typedef Vector<SVGSMILElement*> AnimationsVector;
-    typedef HashMap<ElementAttributePair, AnimationsVector* > GroupedAnimationsMap;
+    typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnimationsMap;
     GroupedAnimationsMap m_scheduledAnimations;
 
     SVGSVGElement* m_ownerSVGElement;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to