Bug 109562 - [Qt][WK2] Layer QtDownloadManager on the C API
Summary: [Qt][WK2] Layer QtDownloadManager on the C API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jocelyn Turcotte
URL:
Keywords:
Depends on: 109564
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-12 03:51 PST by Jocelyn Turcotte
Modified: 2013-03-12 04:20 PDT (History)
2 users (show)

See Also:


Attachments
Patch (11.45 KB, patch)
2013-02-12 03:52 PST, Jocelyn Turcotte
no flags Details | Formatted Diff | Diff
Patch (11.62 KB, patch)
2013-02-15 02:58 PST, Jocelyn Turcotte
no flags Details | Formatted Diff | Diff
Patch (14.02 KB, patch)
2013-03-11 06:54 PDT, Jocelyn Turcotte
hausmann: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jocelyn Turcotte 2013-02-12 03:51:14 PST
[Qt][WK2] Layer QtDownloadManager on the C API
Comment 1 Jocelyn Turcotte 2013-02-12 03:52:15 PST
Created attachment 187828 [details]
Patch
Comment 2 Kenneth Rohde Christiansen 2013-02-12 05:54:12 PST
Comment on attachment 187828 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=187828&action=review

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:65
> +    QtDownloadManager* q = toQtDownloadManager(clientInfo);

manager?

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:72
> +    downloadItem->d->sourceUrl = WKURLCopyQUrl(WKURLResponseCopyURL(response));
> +    downloadItem->d->mimeType = WKStringCopyQString(WKURLResponseCopyMIMEType(response));

I get confused when I see a Copy method and no adopt :-) but I get it, Qt types!

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:101
> +    QtDownloadManager* q = toQtDownloadManager(clientInfo);

s/q/self/ ? that is what we use for EFL
Comment 3 Jocelyn Turcotte 2013-02-12 06:00:50 PST
(In reply to comment #2)
> (From update of attachment 187828 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=187828&action=review
> 
> > Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:65
> > +    QtDownloadManager* q = toQtDownloadManager(clientInfo);
> 
> manager?
> 
> > Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:101
> > +    QtDownloadManager* q = toQtDownloadManager(clientInfo);
> 
> s/q/self/ ? that is what we use for EFL

The goal is to mimic the effect of the Q_Q and Q_D macros, q for a main class, d if clientInfo is a private class. This is the convention we agreed on ATM.
Comment 4 Jocelyn Turcotte 2013-02-15 02:58:28 PST
Created attachment 188523 [details]
Patch

Add some missing adoptWK(<WK*Copy*()>).get().
Also use the new WKURLCopyQString in QtWebError instead of doing WKStringCopyQString(WKURLCopyString(...)).
Comment 5 Kenneth Rohde Christiansen 2013-02-15 04:15:32 PST
Comment on attachment 188523 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=188523&action=review

LGTM

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:63
> +void QtDownloadManager::didReceiveResponse(WKContextRef, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo)

* alignment

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:79
> +void QtDownloadManager::didCreateDestination(WKContextRef, WKDownloadRef download, WKStringRef path, const void *clientInfo)

same
Comment 6 Simon Hausmann 2013-03-06 06:04:28 PST
Comment on attachment 188523 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=188523&action=review

LGTM, too

> Source/WebKit2/UIProcess/qt/QtWebError.cpp:60
> -    return WKStringCopyQString(WKURLCopyString(WKErrorCopyFailingURL(error.get())));
> +    return WKURLCopyQString(adoptWK(WKErrorCopyFailingURL(error.get())).get());

Nice catch :)
Comment 7 Benjamin Poulain 2013-03-07 13:48:25 PST
Comment on attachment 188523 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=188523&action=review

Good for WebKit2.

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:71
> +    downloadItem->d->sourceUrl = WKURLCopyQUrl(adoptWK(WKURLResponseCopyURL(response)).get());

a new adoptToQURL?

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:72
> +    downloadItem->d->mimeType = WKStringCopyQString(adoptWK(WKURLResponseCopyMIMEType(response)).get());

adoptToQString?

> Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp:74
> +    downloadItem->d->suggestedFilename = WKStringCopyQString(adoptWK(WKURLResponseCopySuggestedFilename(response)).get());

adoptToQString?

> Source/WebKit2/UIProcess/qt/QtWebError.cpp:65
> -    return WKStringCopyQString(WKErrorCopyLocalizedDescription(error.get()));
> +    return WKStringCopyQString(adoptWK(WKErrorCopyLocalizedDescription(error.get())).get());

adoptToQString instead of adoptWK().get()?
Comment 8 Jocelyn Turcotte 2013-03-11 06:54:45 PDT
Created attachment 192459 [details]
Patch

Added adoptToQURL(WKURLRef) and adoptToQString(WKURLRef).
Comment 9 Jocelyn Turcotte 2013-03-12 04:20:54 PDT
Committed r145519: <http://trac.webkit.org/changeset/145519>