RESOLVED FIXED 177779
[Curl] Reimplement CurlDownload with CurlRequest
https://bugs.webkit.org/show_bug.cgi?id=177779
Summary [Curl] Reimplement CurlDownload with CurlRequest
Basuke Suzuki
Reported 2017-10-02 14:39:12 PDT
Refactoring the implementation of CurlDownload by using recent CurlRequest class.
Attachments
patch (24.93 KB, patch)
2017-10-02 16:35 PDT, Basuke Suzuki
achristensen: review-
achristensen: commit-queue-
fix (27.86 KB, patch)
2017-10-03 12:54 PDT, Basuke Suzuki
no flags
fix (27.83 KB, patch)
2017-10-03 13:04 PDT, Basuke Suzuki
no flags
Archive of layout-test-results from ews114 for mac-elcapitan (1.94 MB, application/zip)
2017-10-03 19:00 PDT, Build Bot
no flags
Basuke Suzuki
Comment 1 2017-10-02 16:35:16 PDT
Alex Christensen
Comment 2 2017-10-02 21:23:32 PDT
Comment on attachment 322469 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=322469&action=review > Source/WebCore/platform/network/curl/CurlDownload.cpp:87 > + return CurlRequest::create(request, this); Can we pass *this instead? This is never null in this case, and in most cases. > Source/WebCore/platform/network/curl/CurlDownload.h:55 > void init(CurlDownloadListener*, const URL&); Could these take a CurlDownloadListener& ? Do we need both init functions? Could they be put into the constructor instead? > Source/WebCore/platform/network/curl/CurlDownload.h:69 > + RefPtr<CurlRequest> createCurlRequest(ResourceRequest&); Let's return a Ref here. > Source/WebCore/platform/network/curl/CurlDownload.h:85 > + int m_redirectCount { 0 }; Does this need to be signed? > Source/WebCore/platform/network/curl/CurlRequest.h:49 > + return adoptRef(new CurlRequest(request, delegate, shouldSuspend)); adoptRef(*new ...) and return a Ref to indicate that it can't be null. That's how we do things in WebKit.
Basuke Suzuki
Comment 3 2017-10-03 12:47:28 PDT
Comment on attachment 322469 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=322469&action=review >> Source/WebCore/platform/network/curl/CurlDownload.cpp:87 >> + return CurlRequest::create(request, this); > > Can we pass *this instead? This is never null in this case, and in most cases. delegate is optional and I believe it is good to use nullptr as non-valid delegate. When the client dies first, it set the delegate to nullptr. >> Source/WebCore/platform/network/curl/CurlDownload.h:55 >> void init(CurlDownloadListener*, const URL&); > > Could these take a CurlDownloadListener& ? Do we need both init functions? Could they be put into the constructor instead? The two version of init() signatures are shared with AppleWin's CFURLDownloadRef so that wider discussion is required before the change. Maybe another bug should be better place to discuss. >> Source/WebCore/platform/network/curl/CurlDownload.h:69 >> + RefPtr<CurlRequest> createCurlRequest(ResourceRequest&); > > Let's return a Ref here. Okay. >> Source/WebCore/platform/network/curl/CurlDownload.h:85 >> + int m_redirectCount { 0 }; > > Does this need to be signed? It should be unsigned. >> Source/WebCore/platform/network/curl/CurlRequest.h:49 >> + return adoptRef(new CurlRequest(request, delegate, shouldSuspend)); > > adoptRef(*new ...) and return a Ref to indicate that it can't be null. That's how we do things in WebKit. Got it.
Basuke Suzuki
Comment 4 2017-10-03 12:54:50 PDT
Build Bot
Comment 5 2017-10-03 12:57:27 PDT
Attachment 322567 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Basuke Suzuki
Comment 6 2017-10-03 13:04:55 PDT
Build Bot
Comment 7 2017-10-03 19:00:09 PDT
Comment on attachment 322570 [details] fix Attachment 322570 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/4747836 New failing tests: workers/wasm-long-compile.html
Build Bot
Comment 8 2017-10-03 19:00:11 PDT
Created attachment 322623 [details] Archive of layout-test-results from ews114 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Alex Christensen
Comment 9 2017-10-03 19:44:06 PDT
Comment on attachment 322570 [details] fix View in context: https://bugs.webkit.org/attachment.cgi?id=322570&action=review > Source/WebCore/platform/network/curl/CurlDownload.h:69 > + Ref<CurlRequest> createCurlRequest(ResourceRequest&); You might want to take a const ResourceRequest& if you're going to copy it or a ResourceRequest&& if you don't need to copy it. > Source/WebCore/platform/network/curl/CurlRequest.cpp:616 > + m_downloadFilePath = openTemporaryFile("download", m_downloadFileHandle); You might want to check if opening failed and not try to re-open it every time if it fails.
WebKit Commit Bot
Comment 10 2017-10-03 20:15:31 PDT
Comment on attachment 322570 [details] fix Clearing flags on attachment: 322570 Committed r222828: <http://trac.webkit.org/changeset/222828>
WebKit Commit Bot
Comment 11 2017-10-03 20:15:33 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12 2017-10-03 20:16:11 PDT
Note You need to log in before you can comment on or make changes to this bug.