Title: [131608] trunk/Source/WebKit2
Revision
131608
Author
[email protected]
Date
2012-10-17 09:00:27 -0700 (Wed, 17 Oct 2012)

Log Message

[GTK] Don't use the C API internally in WebKitDownload
https://bugs.webkit.org/show_bug.cgi?id=96773

Reviewed by Gustavo Noronha Silva.

Using the C++ classes directly instead of the C API wrappers we
avoid a lot of toImpl/toAPI casts, string conversions and
allocations. The code is also a lot simpler and easier to read.

* UIProcess/API/gtk/WebKitDownload.cpp:
(_WebKitDownloadPrivate):
(webkitDownloadCreate):
(webkit_download_get_request):
(webkit_download_cancel):
* UIProcess/API/gtk/WebKitDownloadPrivate.h:
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkit_web_context_download_uri):
(webkitWebContextGetOrCreateDownload):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (131607 => 131608)


--- trunk/Source/WebKit2/ChangeLog	2012-10-17 15:56:29 UTC (rev 131607)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-17 16:00:27 UTC (rev 131608)
@@ -1,5 +1,26 @@
 2012-10-17  Carlos Garcia Campos  <[email protected]>
 
+        [GTK] Don't use the C API internally in WebKitDownload
+        https://bugs.webkit.org/show_bug.cgi?id=96773
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Using the C++ classes directly instead of the C API wrappers we
+        avoid a lot of toImpl/toAPI casts, string conversions and
+        allocations. The code is also a lot simpler and easier to read.
+
+        * UIProcess/API/gtk/WebKitDownload.cpp:
+        (_WebKitDownloadPrivate):
+        (webkitDownloadCreate):
+        (webkit_download_get_request):
+        (webkit_download_cancel):
+        * UIProcess/API/gtk/WebKitDownloadPrivate.h:
+        * UIProcess/API/gtk/WebKitWebContext.cpp:
+        (webkit_web_context_download_uri):
+        (webkitWebContextGetOrCreateDownload):
+
+2012-10-17  Carlos Garcia Campos  <[email protected]>
+
         [GTK] Don't use the C API internally in WebKitCookieManager
         https://bugs.webkit.org/show_bug.cgi?id=96772
 

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp (131607 => 131608)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp	2012-10-17 15:56:29 UTC (rev 131607)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp	2012-10-17 16:00:27 UTC (rev 131608)
@@ -31,7 +31,6 @@
 #include <wtf/gobject/GOwnPtr.h>
 #include <wtf/gobject/GRefPtr.h>
 
-using namespace WebKit;
 using namespace WebCore;
 
 enum {
@@ -53,7 +52,7 @@
 };
 
 struct _WebKitDownloadPrivate {
-    WKRetainPtr<WKDownloadRef> wkDownload;
+    RefPtr<DownloadProxy> download;
 
     GRefPtr<WebKitURIRequest> request;
     GRefPtr<WebKitURIResponse> response;
@@ -264,11 +263,11 @@
     g_type_class_add_private(downloadClass, sizeof(WebKitDownloadPrivate));
 }
 
-WebKitDownload* webkitDownloadCreate(WKDownloadRef wkDownload)
+WebKitDownload* webkitDownloadCreate(DownloadProxy* downloadProxy)
 {
-    ASSERT(wkDownload);
+    ASSERT(downloadProxy);
     WebKitDownload* download = WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, NULL));
-    download->priv->wkDownload = wkDownload;
+    download->priv->download = downloadProxy;
     return download;
 }
 
@@ -379,8 +378,8 @@
 
     WebKitDownloadPrivate* priv = download->priv;
     if (!priv->request)
-        priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(priv->wkDownload.get())->request()));
-    return download->priv->request.get();
+        priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(priv->download->request()));
+    return priv->request.get();
 }
 
 /**
@@ -465,7 +464,7 @@
     g_return_if_fail(WEBKIT_IS_DOWNLOAD(download));
 
     download->priv->isCancelled = true;
-    WKDownloadCancel(download->priv->wkDownload.get());
+    download->priv->download->cancel();
 }
 
 /**

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h (131607 => 131608)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h	2012-10-17 15:56:29 UTC (rev 131607)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h	2012-10-17 16:00:27 UTC (rev 131608)
@@ -25,7 +25,9 @@
 #include <WebCore/ResourceError.h>
 #include <wtf/text/CString.h>
 
-WebKitDownload* webkitDownloadCreate(WKDownloadRef);
+using namespace WebKit;
+
+WebKitDownload* webkitDownloadCreate(DownloadProxy*);
 bool webkitDownloadIsCancelled(WebKitDownload*);
 void webkitDownloadSetResponse(WebKitDownload*, WebKitURIResponse*);
 void webkitDownloadNotifyProgress(WebKitDownload*, guint64 bytesReceived);

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (131607 => 131608)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp	2012-10-17 15:56:29 UTC (rev 131607)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp	2012-10-17 16:00:27 UTC (rev 131608)
@@ -299,7 +299,7 @@
     g_return_val_if_fail(uri, 0);
 
     DownloadProxy* downloadProxy = context->priv->context->download(0, WebCore::ResourceRequest(String::fromUTF8(uri)));
-    WebKitDownload* download = webkitDownloadCreate(toAPI(downloadProxy));
+    WebKitDownload* download = webkitDownloadCreate(downloadProxy);
     downloadsMap().set(downloadProxy, download);
     return download;
 }
@@ -688,7 +688,7 @@
     if (download)
         return download.get();
 
-    download = adoptGRef(webkitDownloadCreate(toAPI(downloadProxy)));
+    download = adoptGRef(webkitDownloadCreate(downloadProxy));
     downloadsMap().set(downloadProxy, download.get());
     return download.get();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to