diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
| commit | 8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch) | |
| tree | 17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebKit/gtk/webkit/webkitdownload.cpp | |
| parent | b9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff) | |
| download | qtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz | |
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well
as the previously cherry-picked changes
Diffstat (limited to 'Source/WebKit/gtk/webkit/webkitdownload.cpp')
| -rw-r--r-- | Source/WebKit/gtk/webkit/webkitdownload.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/Source/WebKit/gtk/webkit/webkitdownload.cpp b/Source/WebKit/gtk/webkit/webkitdownload.cpp index e698ed505..cfcd3357c 100644 --- a/Source/WebKit/gtk/webkit/webkitdownload.cpp +++ b/Source/WebKit/gtk/webkit/webkitdownload.cpp @@ -38,6 +38,7 @@ #include <glib/gi18n-lib.h> #include <glib/gstdio.h> #include <wtf/Noncopyable.h> +#include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> @@ -459,22 +460,23 @@ static gboolean webkit_download_open_stream_for_uri(WebKitDownload* download, co g_return_val_if_fail(uri, FALSE); WebKitDownloadPrivate* priv = download->priv; - GFile* file = g_file_new_for_uri(uri); - GError* error = NULL; + GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(uri)); + GOwnPtr<GError> error; if (append) - priv->outputStream = g_file_append_to(file, G_FILE_CREATE_NONE, NULL, &error); + priv->outputStream = g_file_append_to(file.get(), G_FILE_CREATE_NONE, NULL, &error.outPtr()); else - priv->outputStream = g_file_replace(file, NULL, TRUE, G_FILE_CREATE_NONE, NULL, &error); - - g_object_unref(file); + priv->outputStream = g_file_replace(file.get(), NULL, TRUE, G_FILE_CREATE_NONE, NULL, &error.outPtr()); if (error) { webkitDownloadEmitError(download, downloadDestinationError(core(priv->networkResponse), error->message)); - g_error_free(error); return FALSE; } + GRefPtr<GFileInfo> info = adoptGRef(g_file_info_new()); + g_file_info_set_attribute_string(info.get(), "metadata::download-uri", webkit_download_get_uri(download)); + g_file_set_attributes_async(file.get(), info.get(), G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, 0, 0, 0); + return TRUE; } @@ -696,21 +698,17 @@ void webkit_download_set_destination_uri(WebKitDownload* download, const gchar* if (downloading) webkit_download_close_stream(download); - GFile* src = g_file_new_for_uri(priv->destinationURI); - GFile* dest = g_file_new_for_uri(destination_uri); - GError* error = NULL; - - g_file_move(src, dest, G_FILE_COPY_BACKUP, NULL, NULL, NULL, &error); + GRefPtr<GFile> src = adoptGRef(g_file_new_for_uri(priv->destinationURI)); + GRefPtr<GFile> dest = adoptGRef(g_file_new_for_uri(destination_uri)); + GOwnPtr<GError> error; - g_object_unref(src); - g_object_unref(dest); + g_file_move(src.get(), dest.get(), G_FILE_COPY_BACKUP, 0, 0, 0, &error.outPtr()); g_free(priv->destinationURI); priv->destinationURI = g_strdup(destination_uri); if (error) { webkitDownloadEmitError(download, downloadDestinationError(core(priv->networkResponse), error->message)); - g_error_free(error); return; } @@ -862,14 +860,13 @@ static void webkit_download_received_data(WebKitDownload* download, const gchar* ASSERT(priv->outputStream); gsize bytes_written; - GError* error = NULL; + GOwnPtr<GError> error; g_output_stream_write_all(G_OUTPUT_STREAM(priv->outputStream), - data, length, &bytes_written, NULL, &error); + data, length, &bytes_written, NULL, &error.outPtr()); if (error) { webkitDownloadEmitError(download, downloadDestinationError(core(priv->networkResponse), error->message)); - g_error_free(error); return; } |
