[WK2] API::UserContentURLPattern creation functions should return Ref<>
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 08:09:22 +0000 (08:09 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 08:09:22 +0000 (08:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144225

Reviewed by Darin Adler.

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

* Shared/API/APIUserContentURLPattern.h:
(API::UserContentURLPattern::create):
* Shared/API/c/WKUserContentURLPattern.cpp:
(WKUserContentURLPatternCreate):

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/APIUserContentURLPattern.h
Source/WebKit2/Shared/API/c/WKUserContentURLPattern.cpp

index a3fc052..0036a27 100644 (file)
@@ -1,5 +1,21 @@
 2015-04-28  Zan Dobersek  <zdobersek@igalia.com>
 
+        [WK2] API::UserContentURLPattern creation functions should return Ref<>
+        https://bugs.webkit.org/show_bug.cgi?id=144225
+
+        Reviewed by Darin Adler.
+
+        Have API::UserContentURLPattern creation functions return Ref<>.
+        Call-sites are also updated, using and operating on the returned Ref<>
+        object where possible.
+
+        * Shared/API/APIUserContentURLPattern.h:
+        (API::UserContentURLPattern::create):
+        * Shared/API/c/WKUserContentURLPattern.cpp:
+        (WKUserContentURLPatternCreate):
+
+2015-04-28  Zan Dobersek  <zdobersek@igalia.com>
+
         [WK2] API::URLRequest, API::URLResponse creation functions should return Ref<>
         https://bugs.webkit.org/show_bug.cgi?id=144224
 
index 10a6a50..aff4613 100644 (file)
 
 #include <WebCore/URL.h>
 #include <WebCore/UserContentURLPattern.h>
-#include <wtf/RefPtr.h>
 
 namespace API {
 
 class UserContentURLPattern : public API::ObjectImpl<API::Object::Type::UserContentURLPattern> {
 public:
-    static PassRefPtr<UserContentURLPattern> create(const WTF::String& pattern)
+    static Ref<UserContentURLPattern> create(const WTF::String& pattern)
     {
-        return adoptRef(new UserContentURLPattern(pattern));
+        return adoptRef(*new UserContentURLPattern(pattern));
     }
 
     const WTF::String& host() const { return m_pattern.host(); }
index 9f9b836..ceedc76 100644 (file)
@@ -39,8 +39,7 @@ WKTypeID WKUserContentURLPatternGetTypeID()
 
 WKUserContentURLPatternRef WKUserContentURLPatternCreate(WKStringRef patternRef)
 {
-    RefPtr<API::UserContentURLPattern> userContentURLPattern = API::UserContentURLPattern::create(toImpl(patternRef)->string());
-    return toAPI(userContentURLPattern.release().leakRef());
+    return toAPI(&API::UserContentURLPattern::create(toImpl(patternRef)->string()).leakRef());
 }
 
 WKStringRef WKUserContentURLPatternCopyHost(WKUserContentURLPatternRef urlPatternRef)