Skip to content
Permalink
Browse files
[GTK] Remove virtual methods of WebKitDownload signals in WebKit2 GTK…
…+ API

https://bugs.webkit.org/show_bug.cgi?id=79804

Reviewed by Martin Robinson.

That comes from the first patch that followed the approach of the
first LoaderClient implementation. With current implementation
download signals, except decide-destination, don't need to be
true_handled, and they won't have a default handler
implementation. Also the download object is not supposed to be
inheritable, since instances are created privately by the
WebContext, so it's not possible to override the virtual methods
in derived classes.

* UIProcess/API/gtk/WebKitDownload.cpp:
(webkit_download_class_init):
(webkitDownloadNotifyProgress):
(webkitDownloadFailed):
(webkitDownloadFinished):
* UIProcess/API/gtk/WebKitDownload.h:
(_WebKitDownloadClass):
* UIProcess/API/gtk/webkit2marshal.list:

Canonical link: https://commits.webkit.org/96878@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Feb 28, 2012
1 parent d10f2eb commit f069d6fbdc451d3f68d8abca26053bf0fd203212
@@ -1,3 +1,28 @@
2012-02-28 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Remove virtual methods of WebKitDownload signals in WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=79804

Reviewed by Martin Robinson.

That comes from the first patch that followed the approach of the
first LoaderClient implementation. With current implementation
download signals, except decide-destination, don't need to be
true_handled, and they won't have a default handler
implementation. Also the download object is not supposed to be
inheritable, since instances are created privately by the
WebContext, so it's not possible to override the virtual methods
in derived classes.

* UIProcess/API/gtk/WebKitDownload.cpp:
(webkit_download_class_init):
(webkitDownloadNotifyProgress):
(webkitDownloadFailed):
(webkitDownloadFinished):
* UIProcess/API/gtk/WebKitDownload.h:
(_WebKitDownloadClass):
* UIProcess/API/gtk/webkit2marshal.list:

2012-02-28 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>

[Qt] Fix build for WK2, do not use enum type if values can be outside the enum
@@ -169,18 +169,14 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
* This signal is emitted after response is received,
* every time new data has been written to the destination. It's
* useful to know the progress of the download operation.
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*/
signals[RECEIVED_DATA] =
g_signal_new("received-data",
G_TYPE_FROM_CLASS(objectClass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(WebKitDownloadClass, received_data),
g_signal_accumulator_true_handled, NULL,
webkit_marshal_BOOLEAN__UINT64,
G_TYPE_BOOLEAN, 1,
0, 0, 0,
webkit_marshal_VOID__UINT64,
G_TYPE_NONE, 1,
G_TYPE_UINT64);

/**
@@ -189,18 +185,14 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
*
* This signal is emitted when download finishes successfully or due to an error.
* In case of errors #WebKitDownload::failed signal is emitted before this one.
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*/
signals[FINISHED] =
g_signal_new("finished",
G_TYPE_FROM_CLASS(objectClass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(WebKitDownloadClass, finished),
g_signal_accumulator_true_handled, NULL,
webkit_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
0, 0, 0,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);

/**
* WebKitDownload::failed:
@@ -213,18 +205,14 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
* with webkit_download_cancel(), this signal is emitted with error
* %WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER. The download operation finishes
* after an error and #WebKitDownload::finished signal is emitted after this one.
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*/
signals[FAILED] =
g_signal_new("failed",
G_TYPE_FROM_CLASS(objectClass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(WebKitDownloadClass, failed),
g_signal_accumulator_true_handled, NULL,
webkit_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN, 1,
0, 0, 0,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);

/**
@@ -258,17 +246,13 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass)
* This signal is emitted after #WebKitDownload::decide-destination and before
* #WebKitDownload::received-data to notify that destination file has been
* created successfully at @destination.
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
*/
signals[CREATED_DESTINATION] =
g_signal_new("created-destination",
G_TYPE_FROM_CLASS(objectClass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(WebKitDownloadClass, created_destination),
g_signal_accumulator_true_handled, NULL,
webkit_marshal_BOOLEAN__STRING,
0, 0, 0,
g_cclosure_marshal_VOID__STRING,
G_TYPE_BOOLEAN, 1,
G_TYPE_STRING);

@@ -304,8 +288,7 @@ void webkitDownloadNotifyProgress(WebKitDownload* download, guint64 bytesReceive
download->priv->timer.set(g_timer_new());

priv->currentSize += bytesReceived;
gboolean returnValue;
g_signal_emit(download, signals[RECEIVED_DATA], 0, bytesReceived, &returnValue);
g_signal_emit(download, signals[RECEIVED_DATA], 0, bytesReceived);

// Throttle progress notification to not consume high amounts of
// CPU on fast links, except when the last notification occured
@@ -333,9 +316,9 @@ void webkitDownloadFailed(WebKitDownload* download, const ResourceError& resourc
resourceError.localizedDescription().utf8().data()));
if (download->priv->timer)
g_timer_stop(download->priv->timer.get());
gboolean returnValue;
g_signal_emit(download, signals[FAILED], 0, webError.get(), &returnValue);
g_signal_emit(download, signals[FINISHED], 0, &returnValue);

g_signal_emit(download, signals[FAILED], 0, webError.get());
g_signal_emit(download, signals[FINISHED], 0, NULL);
}

void webkitDownloadCancelled(WebKitDownload* download)
@@ -356,8 +339,7 @@ void webkitDownloadFinished(WebKitDownload* download)
}
if (download->priv->timer)
g_timer_stop(download->priv->timer.get());
gboolean returnValue;
g_signal_emit(download, signals[FINISHED], 0, &returnValue);
g_signal_emit(download, signals[FINISHED], 0, NULL);
}

CString webkitDownloadDecideDestinationWithSuggestedFilename(WebKitDownload* download, const CString& suggestedFilename)
@@ -50,15 +50,8 @@ struct _WebKitDownload {
struct _WebKitDownloadClass {
GObjectClass parent_class;

gboolean (* received_data) (WebKitDownload *download,
guint64 data_length);
gboolean (* finished) (WebKitDownload *download);
gboolean (* failed) (WebKitDownload *download,
GError *error);
gboolean (* decide_destination) (WebKitDownload *download,
const gchar *suggested_filename);
gboolean (* created_destination) (WebKitDownload *download,
const gchar *destination);
};

WEBKIT_API GType
@@ -1,15 +1,11 @@
BOOLEAN:ENUM,STRING,POINTER
BOOLEAN:OBJECT
BOOLEAN:OBJECT,ENUM
BOOLEAN:OBJECT,STRING,POINTER
BOOLEAN:POINTER
BOOLEAN:STRING
BOOLEAN:STRING,POINTER
BOOLEAN:STRING,STRING,POINTER
BOOLEAN:UINT64
BOOLEAN:VOID
OBJECT:VOID
VOID:ENUM
VOID:OBJECT,UINT
VOID:OBJECT,POINTER
VOID:UINT64

0 comments on commit f069d6f

Please sign in to comment.