Bug 86843 - [GTK] Add GCancellable parameter to all methods using gio async pattern
Summary: [GTK] Add GCancellable parameter to all methods using gio async pattern
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2012-05-18 04:57 PDT by Carlos Garcia Campos
Modified: 2012-05-20 23:38 PDT (History)
3 users (show)

See Also:


Attachments
Patch (32.00 KB, patch)
2012-05-18 05:00 PDT, Carlos Garcia Campos
gns: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2012-05-18 04:57:30 PDT
For consistency and because it's something expected and useful.
Comment 1 Carlos Garcia Campos 2012-05-18 05:00:38 PDT
Created attachment 142688 [details]
Patch
Comment 2 WebKit Review Bot 2012-05-18 05:03:44 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Gustavo Noronha (kov) 2012-05-18 08:40:03 PDT
Comment on attachment 142688 [details]
Patch

The patch looks fine to me, but I am curious about the motivation. What does cancellation support really gain us in these cases? It looks like the only practical gain would be it would be possible to get a "cancelled" error after the async request is finished, since we are not checking for cancellation anywhere else that would avoid continued processing.
Comment 4 Carlos Garcia Campos 2012-05-18 08:53:08 PDT
(In reply to comment #3)
> (From update of attachment 142688 [details])
> The patch looks fine to me, but I am curious about the motivation.

Mainly consistency, cancellable is something expected in functions using the gio async model.

> What does cancellation support really gain us in these cases? It looks like the only practical gain would be it would be possible to get a "cancelled" error after the async request is finished, since we are not checking for cancellation anywhere else that would avoid continued processing.

Other methods follow the approach of async method + signals, for example, cancelling a download operation emits the error signal with cancelled error. And we have specific APIs for it webkit_download_cancel. Something similar happens when loadingf something in a web view (load error signal + stop_load method). 

For methods using the gio async model, we provide the standard way, a cancellable object that allow the user to cancel the operation (and from any thread). When the user finishes the operation CANCELLED error is returned.
Comment 5 Gustavo Noronha (kov) 2012-05-18 09:43:10 PDT
Comment on attachment 142688 [details]
Patch

OK, I guess we need cancellables anyway if we are to make the cancellation more useful in the future.
Comment 6 Carlos Garcia Campos 2012-05-20 23:38:41 PDT
Committed r117735: <http://trac.webkit.org/changeset/117735>