Title: [183410] trunk/Source/WebKit2
Revision
183410
Author
[email protected]
Date
2015-04-27 13:09:41 -0700 (Mon, 27 Apr 2015)

Log Message

[WK2] API::URL creation functions should return Ref<>
https://bugs.webkit.org/show_bug.cgi?id=144219

Reviewed by Darin Adler.

Have API::URL creation functions return Ref<>.
The call-sites are also updated, using and operating in the
returned Ref<> object, where possible.

* Shared/API/APIURL.h:
(API::URL::create):
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toCopiedURLAPI):
* Shared/API/c/WKURL.cpp:
(WKURLCreateWithUTF8CString):
(WKURLCreateWithBaseURL):
* UIProcess/API/gtk/WebKitWebResource.cpp:
(webkit_web_resource_get_data):
* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::didChangeIconForPageURL):
(WebKit::WebIconDatabase::notifyIconDataReadyForPageURL):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::userAgent):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (183409 => 183410)


--- trunk/Source/WebKit2/ChangeLog	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-27 20:09:41 UTC (rev 183410)
@@ -1,5 +1,31 @@
 2015-04-27  Zan Dobersek  <[email protected]>
 
+        [WK2] API::URL creation functions should return Ref<>
+        https://bugs.webkit.org/show_bug.cgi?id=144219
+
+        Reviewed by Darin Adler.
+
+        Have API::URL creation functions return Ref<>.
+        The call-sites are also updated, using and operating in the
+        returned Ref<> object, where possible.
+
+        * Shared/API/APIURL.h:
+        (API::URL::create):
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toCopiedURLAPI):
+        * Shared/API/c/WKURL.cpp:
+        (WKURLCreateWithUTF8CString):
+        (WKURLCreateWithBaseURL):
+        * UIProcess/API/gtk/WebKitWebResource.cpp:
+        (webkit_web_resource_get_data):
+        * UIProcess/WebIconDatabase.cpp:
+        (WebKit::WebIconDatabase::didChangeIconForPageURL):
+        (WebKit::WebIconDatabase::notifyIconDataReadyForPageURL):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::userAgent):
+
+2015-04-27  Zan Dobersek  <[email protected]>
+
         [WK2] API::String creation functions should return Ref<>
         https://bugs.webkit.org/show_bug.cgi?id=144218
 

Modified: trunk/Source/WebKit2/Shared/API/APIURL.h (183409 => 183410)


--- trunk/Source/WebKit2/Shared/API/APIURL.h	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/Shared/API/APIURL.h	2015-04-27 20:09:41 UTC (rev 183410)
@@ -29,26 +29,26 @@
 #include "APIObject.h"
 #include "WebCoreArgumentCoders.h"
 #include <WebCore/URL.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Forward.h>
 #include <wtf/text/WTFString.h>
 
 namespace API {
 
 class URL : public ObjectImpl<Object::Type::URL> {
 public:
-    static PassRefPtr<URL> create(const WTF::String& string)
+    static Ref<URL> create(const WTF::String& string)
     {
-        return adoptRef(new URL(string));
+        return adoptRef(*new URL(string));
     }
 
-    static PassRefPtr<URL> create(const URL* baseURL, const WTF::String& relativeURL)
+    static Ref<URL> create(const URL* baseURL, const WTF::String& relativeURL)
     {
         ASSERT(baseURL);
         baseURL->parseURLIfNecessary();
         auto absoluteURL = std::make_unique<WebCore::URL>(*baseURL->m_parsedURL.get(), relativeURL);
         const WTF::String& absoluteURLString = absoluteURL->string();
 
-        return adoptRef(new URL(WTF::move(absoluteURL), absoluteURLString));
+        return adoptRef(*new URL(WTF::move(absoluteURL), absoluteURLString));
     }
 
     bool isNull() const { return m_string.isNull(); }

Modified: trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h (183409 => 183410)


--- trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2015-04-27 20:09:41 UTC (rev 183410)
@@ -178,9 +178,8 @@
 inline WKURLRef toCopiedURLAPI(const String& string)
 {
     if (!string)
-        return 0;
-    RefPtr<API::URL> url = ""
-    return toAPI(url.release().leakRef());
+        return nullptr;
+    return toAPI(&API::URL::create(string).leakRef());
 }
 
 inline String toWTFString(WKStringRef stringRef)

Modified: trunk/Source/WebKit2/Shared/API/c/WKURL.cpp (183409 => 183410)


--- trunk/Source/WebKit2/Shared/API/c/WKURL.cpp	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/Shared/API/c/WKURL.cpp	2015-04-27 20:09:41 UTC (rev 183410)
@@ -37,12 +37,12 @@
 
 WKURLRef WKURLCreateWithUTF8CString(const char* string)
 {
-    return toAPI(API::URL::create(String::fromUTF8(string)).leakRef());
+    return toAPI(&API::URL::create(String::fromUTF8(string)).leakRef());
 }
 
 WKURLRef WKURLCreateWithBaseURL(WKURLRef baseURL, const char* relative)
 {
-    return toAPI(API::URL::create(toImpl(baseURL), String::fromUTF8(relative)).leakRef());
+    return toAPI(&API::URL::create(toImpl(baseURL), String::fromUTF8(relative)).leakRef());
 }
 
 WKStringRef WKURLCopyString(WKURLRef url)

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp (183409 => 183410)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebResource.cpp	2015-04-27 20:09:41 UTC (rev 183410)
@@ -372,7 +372,7 @@
         });
     else {
         String url = ""
-        resource->priv->frame->getResourceData(API::URL::create(url).get(), [task](API::Data* data, CallbackBase::Error) {
+        resource->priv->frame->getResourceData(API::URL::create(url).ptr(), [task](API::Data* data, CallbackBase::Error) {
             resourceDataCallback(data, adoptGRef(task).get());
         });
     }

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp (183409 => 183410)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2015-04-27 20:09:41 UTC (rev 183410)
@@ -252,7 +252,7 @@
 
 void WebIconDatabase::didChangeIconForPageURL(const String& pageURL)
 {
-    m_iconDatabaseClient.didChangeIconForPageURL(this, API::URL::create(pageURL).get());
+    m_iconDatabaseClient.didChangeIconForPageURL(this, API::URL::create(pageURL).ptr());
 }
 
 void WebIconDatabase::didRemoveAllIcons()
@@ -305,7 +305,7 @@
 
 void WebIconDatabase::notifyIconDataReadyForPageURL(const String& pageURL)
 {
-    m_iconDatabaseClient.iconDataReadyForPageURL(this, API::URL::create(pageURL).get());
+    m_iconDatabaseClient.iconDataReadyForPageURL(this, API::URL::create(pageURL).ptr());
     didChangeIconForPageURL(pageURL);
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (183409 => 183410)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-04-27 20:05:14 UTC (rev 183409)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-04-27 20:09:41 UTC (rev 183410)
@@ -2398,9 +2398,7 @@
 String WebPage::userAgent(WebFrame* frame, const URL& webcoreURL) const
 {
     if (frame && m_loaderClient.client().userAgentForURL) {
-        RefPtr<API::URL> url = ""
-
-        API::String* apiString = m_loaderClient.userAgentForURL(frame, url.get());
+        API::String* apiString = m_loaderClient.userAgentForURL(frame, API::URL::create(webcoreURL).ptr());
         if (apiString)
             return apiString->string();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to