Bug 176906 - [Curl] Replace the implementation with NetworkLoadMetrics
Summary: [Curl] Replace the implementation with NetworkLoadMetrics
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-14 08:33 PDT by Basuke Suzuki
Modified: 2017-09-27 12:27 PDT (History)
8 users (show)

See Also:


Attachments
patch (8.74 KB, patch)
2017-09-14 08:45 PDT, Basuke Suzuki
achristensen: review-
Details | Formatted Diff | Diff
Fixed (19.95 KB, patch)
2017-09-14 13:13 PDT, Basuke Suzuki
achristensen: review-
Details | Formatted Diff | Diff
patch (20.11 KB, patch)
2017-09-14 14:31 PDT, Basuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2017-09-14 08:33:41 PDT
Web timing related information gathering is redundant in Curl port. We replace them with NetworkLoadMetrics class and set the network load metrics correctly.
Comment 1 Basuke Suzuki 2017-09-14 08:45:05 PDT
Created attachment 320770 [details]
patch
Comment 2 Alex Christensen 2017-09-14 10:59:10 PDT
Comment on attachment 320770 [details]
patch

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

> Source/WebCore/platform/network/curl/CurlContext.h:294
> +    CURLcode getTimes(double&, double&, double&, double&, double&) const;

We're trying to move away from passing return value references in as parameters.  Let's make this be a function that takes no parameters and returns a std::optional<NetworkLoadMetrics> or if you actually need the code a WTF::Expected<NetworkLoadMetrics, CURLcode>.  The functions above it could use the same improvement.
Comment 3 Alex Christensen 2017-09-14 11:43:30 PDT
Other than that this looks good.
Comment 4 Basuke Suzuki 2017-09-14 13:13:55 PDT
Created attachment 320804 [details]
Fixed
Comment 5 Build Bot 2017-09-14 13:15:43 PDT
Attachment 320804 [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 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Alex Christensen 2017-09-14 13:25:12 PDT
Comment on attachment 320804 [details]
Fixed

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

> Source/WebCore/platform/network/curl/CurlContext.cpp:590
> +std::optional<long> CurlHandle::getPrimaryPort()

Ports are uint16_t's.  It might be worth range checking and returning a std::optional<uint16_t>

> Source/WebCore/platform/network/curl/CurlDownload.cpp:186
> +        if (*httpCode >= 200 && *httpCode < 300) {

This is now unchecked use of a std::optional.
Comment 7 Basuke Suzuki 2017-09-14 14:31:37 PDT
Created attachment 320824 [details]
patch
Comment 8 WebKit Commit Bot 2017-09-14 17:29:50 PDT
Comment on attachment 320824 [details]
patch

Clearing flags on attachment: 320824

Committed r222068: <http://trac.webkit.org/changeset/222068>
Comment 9 WebKit Commit Bot 2017-09-14 17:29:52 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2017-09-27 12:27:25 PDT
<rdar://problem/34693311>