Move PropertySetCSSStyleDeclaration, WebKitCSSKeyframesRule to std::unique_ptr
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Jan 2014 18:52:42 +0000 (18:52 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Jan 2014 18:52:42 +0000 (18:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127572

Reviewed by Andreas Kling.

Switch the PropertySetCSSStyleDeclaration and WebKitCSSKeyframesRule classes from using
OwnPtr and adoptPtr to using std::unique_ptr and std::make_unique.

* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM):
(WebCore::StyleRuleCSSStyleDeclaration::didMutate):
(WebCore::InlineCSSStyleDeclaration::didMutate):
* css/PropertySetCSSStyleDeclaration.h:
* css/WebKitCSSKeyframesRule.cpp:
(WebCore::WebKitCSSKeyframesRule::cssRules):
* css/WebKitCSSKeyframesRule.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162771 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
Source/WebCore/css/PropertySetCSSStyleDeclaration.h
Source/WebCore/css/WebKitCSSKeyframesRule.cpp
Source/WebCore/css/WebKitCSSKeyframesRule.h

index dff5008..08b00a6 100644 (file)
@@ -1,5 +1,24 @@
 2014-01-25  Zan Dobersek  <zdobersek@igalia.com>
 
+        Move PropertySetCSSStyleDeclaration, WebKitCSSKeyframesRule to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=127572
+
+        Reviewed by Andreas Kling.
+
+        Switch the PropertySetCSSStyleDeclaration and WebKitCSSKeyframesRule classes from using
+        OwnPtr and adoptPtr to using std::unique_ptr and std::make_unique.
+
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        (WebCore::PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM):
+        (WebCore::StyleRuleCSSStyleDeclaration::didMutate):
+        (WebCore::InlineCSSStyleDeclaration::didMutate):
+        * css/PropertySetCSSStyleDeclaration.h:
+        * css/WebKitCSSKeyframesRule.cpp:
+        (WebCore::WebKitCSSKeyframesRule::cssRules):
+        * css/WebKitCSSKeyframesRule.h:
+
+2014-01-25  Zan Dobersek  <zdobersek@igalia.com>
+
         Move StyleProperties, StyleResolver to std::unique_ptr
         https://bugs.webkit.org/show_bug.cgi?id=127570
 
index c32e74d..5be9c97 100644 (file)
@@ -274,7 +274,7 @@ CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* intern
     // The map is here to maintain the object identity of the CSSValues over multiple invocations.
     // FIXME: It is likely that the identity is not important for web compatibility and this code should be removed.
     if (!m_cssomCSSValueClones)
-        m_cssomCSSValueClones = adoptPtr(new HashMap<CSSValue*, RefPtr<CSSValue>>);
+        m_cssomCSSValueClones = std::make_unique<HashMap<CSSValue*, RefPtr<CSSValue>>>();
     
     RefPtr<CSSValue>& clonedValue = m_cssomCSSValueClones->add(internalValue, RefPtr<CSSValue>()).iterator->value;
     if (!clonedValue)
@@ -327,7 +327,7 @@ void StyleRuleCSSStyleDeclaration::willMutate()
 void StyleRuleCSSStyleDeclaration::didMutate(MutationType type)
 {
     if (type == PropertyChanged)
-        m_cssomCSSValueClones.clear();
+        m_cssomCSSValueClones = nullptr;
 
     // Style sheet mutation needs to be signaled even if the change failed. willMutate*/didMutate* must pair.
     if (m_parentRule && m_parentRule->parentStyleSheet())
@@ -351,7 +351,7 @@ void InlineCSSStyleDeclaration::didMutate(MutationType type)
     if (type == NoChanges)
         return;
 
-    m_cssomCSSValueClones.clear();
+    m_cssomCSSValueClones = nullptr;
 
     if (!m_parentElement)
         return;
index 1933a73..42d873f 100644 (file)
@@ -27,8 +27,8 @@
 #define PropertySetCSSStyleDeclaration_h
 
 #include "CSSStyleDeclaration.h"
+#include <memory>
 #include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -78,7 +78,7 @@ protected:
     virtual void didMutate(MutationType) { }
 
     MutableStyleProperties* m_propertySet;
-    OwnPtr<HashMap<CSSValue*, RefPtr<CSSValue>>> m_cssomCSSValueClones;
+    std::unique_ptr<HashMap<CSSValue*, RefPtr<CSSValue>>> m_cssomCSSValueClones;
 };
 
 class StyleRuleCSSStyleDeclaration : public PropertySetCSSStyleDeclaration
index d7c9fca..87908ba 100644 (file)
@@ -188,7 +188,7 @@ WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::item(unsigned index) const
 CSSRuleList* WebKitCSSKeyframesRule::cssRules()
 {
     if (!m_ruleListCSSOMWrapper)
-        m_ruleListCSSOMWrapper = adoptPtr(new LiveCSSRuleList<WebKitCSSKeyframesRule>(this));
+        m_ruleListCSSOMWrapper = std::make_unique<LiveCSSRuleList<WebKitCSSKeyframesRule>>(this);
     return m_ruleListCSSOMWrapper.get();
 }
 
index 9899ad5..2c9cad2 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CSSRule.h"
 #include "StyleRule.h"
+#include <memory>
 #include <wtf/Forward.h>
 #include <wtf/text/AtomicString.h>
 
@@ -92,7 +93,7 @@ private:
 
     RefPtr<StyleRuleKeyframes> m_keyframesRule;
     mutable Vector<RefPtr<WebKitCSSKeyframeRule>> m_childRuleCSSOMWrappers;
-    mutable OwnPtr<CSSRuleList> m_ruleListCSSOMWrapper;
+    mutable std::unique_ptr<CSSRuleList> m_ruleListCSSOMWrapper;
 };
 
 } // namespace WebCore