Use std::unique_ptr instead of PassOwnPtr|OwnPtr for ScrollAnimator
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Mar 2015 01:48:54 +0000 (01:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Mar 2015 01:48:54 +0000 (01:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142143

Patch by Joonghun Park <jh718.park@samsung.com> on 2015-03-01
Reviewed by Darin Adler.

No new tests, no behavior changes.

* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::create):
* platform/ScrollAnimator.h:
* platform/ScrollAnimatorNone.cpp:
(WebCore::ScrollAnimator::create):
* platform/ScrollableArea.h:
* platform/ios/ScrollAnimatorIOS.mm:
(WebCore::ScrollAnimator::create):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimator::create):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ScrollAnimator.cpp
Source/WebCore/platform/ScrollAnimator.h
Source/WebCore/platform/ScrollAnimatorNone.cpp
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/ios/ScrollAnimatorIOS.mm
Source/WebCore/platform/mac/ScrollAnimatorMac.mm

index fd9b080..827aeb2 100644 (file)
@@ -1,3 +1,23 @@
+2015-03-01  Joonghun Park  <jh718.park@samsung.com>
+
+        Use std::unique_ptr instead of PassOwnPtr|OwnPtr for ScrollAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=142143
+
+        Reviewed by Darin Adler.
+
+        No new tests, no behavior changes.
+
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::create):
+        * platform/ScrollAnimator.h:
+        * platform/ScrollAnimatorNone.cpp:
+        (WebCore::ScrollAnimator::create):
+        * platform/ScrollableArea.h:
+        * platform/ios/ScrollAnimatorIOS.mm:
+        (WebCore::ScrollAnimator::create):
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimator::create):
+
 2015-02-26  Andy Estes  <aestes@apple.com>
 
         [Content Filtering] Move another declaration to WebFilterEvaluatorSPI.h
index 6b18893..aaf8050 100644 (file)
@@ -41,9 +41,9 @@
 namespace WebCore {
 
 #if !ENABLE(SMOOTH_SCROLLING) && !PLATFORM(IOS)
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
+std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
-    return adoptPtr(new ScrollAnimator(scrollableArea));
+    return std::make_unique<ScrollAnimator>(scrollableArea);
 }
 #endif
 
index 0e9c473..566085d 100644 (file)
@@ -57,8 +57,9 @@ class ScrollAnimator {
 #endif
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<ScrollAnimator> create(ScrollableArea&);
+    static std::unique_ptr<ScrollAnimator> create(ScrollableArea&);
 
+    explicit ScrollAnimator(ScrollableArea&);
     virtual ~ScrollAnimator();
 
     // Computes a scroll destination for the given parameters.  Returns false if
@@ -126,8 +127,6 @@ public:
 #endif
 
 protected:
-    explicit ScrollAnimator(ScrollableArea&);
-
     virtual void notifyPositionChanged(const FloatSize& delta);
 
 #if ENABLE(CSS_SCROLL_SNAP) && PLATFORM(MAC)
index 6791f11..d295d49 100644 (file)
@@ -52,11 +52,11 @@ const double kTickTime = 1 / kFrameRate;
 const double kMinimumTimerInterval = .001;
 const double kZoomTicks = 11;
 
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
+std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
     if (scrollableArea.scrollAnimatorEnabled())
-        return adoptPtr(new ScrollAnimatorNone(scrollableArea));
-    return adoptPtr(new ScrollAnimator(scrollableArea));
+        return std::make_unique<ScrollAnimatorNone>(scrollableArea);
+    return std::make_unique<ScrollAnimator>(scrollableArea);
 }
 
 ScrollAnimatorNone::Parameters::Parameters()
index 58fc6f8..24f38c0 100644 (file)
@@ -296,7 +296,7 @@ private:
     // scroll of the content.
     virtual void setScrollOffset(const IntPoint&) = 0;
 
-    mutable OwnPtr<ScrollAnimator> m_scrollAnimator;
+    mutable std::unique_ptr<ScrollAnimator> m_scrollAnimator;
 
 #if ENABLE(CSS_SCROLL_SNAP)
     std::unique_ptr<Vector<LayoutUnit>> m_horizontalSnapOffsets;
index 0e1a4cf..bace370 100644 (file)
@@ -40,9 +40,9 @@ using namespace WebCore;
 
 namespace WebCore {
 
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
+std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
-    return adoptPtr(new ScrollAnimatorIOS(scrollableArea));
+    return std::make_unique<ScrollAnimatorIOS>(scrollableArea);
 }
 
 ScrollAnimatorIOS::ScrollAnimatorIOS(ScrollableArea& scrollableArea)
index 2ba6b4f..aeda5d9 100644 (file)
@@ -634,9 +634,9 @@ enum FeatureToAnimate {
 
 namespace WebCore {
 
-PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
+std::unique_ptr<ScrollAnimator> ScrollAnimator::create(ScrollableArea& scrollableArea)
 {
-    return adoptPtr(new ScrollAnimatorMac(scrollableArea));
+    return std::make_unique<ScrollAnimatorMac>(scrollableArea);
 }
 
 ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea& scrollableArea)