[WK2] API::Point, API::Size, API::Rect creation functions should return Ref<>
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 06:35:38 +0000 (06:35 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 06:35:38 +0000 (06:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144223

Reviewed by Darin Adler.

Have API::Point, API::Size and API::Rect creation functions return Ref<>.
Call-sites are also updated, using and operating on the returned Ref<> object
where possible.

* Shared/API/APIGeometry.h:
(API::Size::create):
(API::Point::create):
(API::Rect::create):
* Shared/API/c/WKGeometry.cpp:
(WKPointCreate):
(WKSizeCreate):
(WKRectCreate):

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/APIGeometry.h
Source/WebKit2/Shared/API/c/WKGeometry.cpp

index 3e1d6a1..63ccdf7 100644 (file)
@@ -1,5 +1,25 @@
 2015-04-27  Zan Dobersek  <zdobersek@igalia.com>
 
+        [WK2] API::Point, API::Size, API::Rect creation functions should return Ref<>
+        https://bugs.webkit.org/show_bug.cgi?id=144223
+
+        Reviewed by Darin Adler.
+
+        Have API::Point, API::Size and API::Rect creation functions return Ref<>.
+        Call-sites are also updated, using and operating on the returned Ref<> object
+        where possible.
+
+        * Shared/API/APIGeometry.h:
+        (API::Size::create):
+        (API::Point::create):
+        (API::Rect::create):
+        * Shared/API/c/WKGeometry.cpp:
+        (WKPointCreate):
+        (WKSizeCreate):
+        (WKRectCreate):
+
+2015-04-27  Zan Dobersek  <zdobersek@igalia.com>
+
         [WK2] API::Error creation functions should return Ref<>
         https://bugs.webkit.org/show_bug.cgi?id=144222
 
index 2efcb47..1222198 100644 (file)
@@ -29,7 +29,6 @@
 #include "APIObject.h"
 #include "WKGeometry.h"
 #include <WebCore/FloatRect.h>
-#include <wtf/PassRefPtr.h>
 
 namespace IPC {
 class ArgumentDecoder;
@@ -40,9 +39,9 @@ namespace API {
 
 class Size : public API::ObjectImpl<API::Object::Type::Size> {
 public:
-    static PassRefPtr<Size> create(const WKSize& size)
+    static Ref<Size> create(const WKSize& size)
     {
-        return adoptRef(new Size(size));
+        return adoptRef(*new Size(size));
     }
 
     const WKSize& size() const { return m_size; }
@@ -61,9 +60,9 @@ private:
 
 class Point : public API::ObjectImpl<API::Object::Type::Point> {
 public:
-    static PassRefPtr<Point> create(const WKPoint& point)
+    static Ref<Point> create(const WKPoint& point)
     {
-        return adoptRef(new Point(point));
+        return adoptRef(*new Point(point));
     }
 
     const WKPoint& point() const { return m_point; }
@@ -81,9 +80,9 @@ private:
 
 class Rect : public API::ObjectImpl<API::Object::Type::Rect> {
 public:
-    static PassRefPtr<Rect> create(const WKRect& rect)
+    static Ref<Rect> create(const WKRect& rect)
     {
-        return adoptRef(new Rect(rect));
+        return adoptRef(*new Rect(rect));
     }
 
     const WKRect& rect() const { return m_rect; }
index 96c3f19..e1ea824 100644 (file)
@@ -48,17 +48,17 @@ WKTypeID WKRectGetTypeID()
 
 WKPointRef WKPointCreate(WKPoint point)
 {
-    return toAPI(API::Point::create(point).leakRef());
+    return toAPI(&API::Point::create(point).leakRef());
 }
 
 WKSizeRef WKSizeCreate(WKSize size)
 {
-    return toAPI(API::Size::create(size).leakRef());
+    return toAPI(&API::Size::create(size).leakRef());
 }
 
 WKRectRef WKRectCreate(WKRect rect)
 {
-    return toAPI(API::Rect::create(rect).leakRef());
+    return toAPI(&API::Rect::create(rect).leakRef());
 }
 
 WKSize WKSizeGetValue(WKSizeRef size)