RESOLVED FIXED 207747
NetworkLoadMetrics should be shared by multiple ResourceResponse instances
https://bugs.webkit.org/show_bug.cgi?id=207747
Summary NetworkLoadMetrics should be shared by multiple ResourceResponse instances
Yusuke Suzuki
Reported 2020-02-13 23:24:09 PST
NetworkLoadMetrics should be shared by multiple ResourceResponse instances
Attachments
Patch (34.06 KB, patch)
2020-02-13 23:40 PST, Yusuke Suzuki
no flags
Patch (47.35 KB, patch)
2020-02-14 00:59 PST, Yusuke Suzuki
no flags
Patch (45.66 KB, patch)
2020-02-14 01:06 PST, Yusuke Suzuki
no flags
Patch (45.85 KB, patch)
2020-02-14 01:15 PST, Yusuke Suzuki
no flags
Patch (48.40 KB, patch)
2020-02-14 01:21 PST, Yusuke Suzuki
no flags
Patch (51.12 KB, patch)
2020-02-14 01:36 PST, Yusuke Suzuki
no flags
Patch (50.95 KB, patch)
2020-02-14 02:13 PST, Yusuke Suzuki
no flags
Patch (50.97 KB, patch)
2020-02-14 04:32 PST, Yusuke Suzuki
keith_miller: review+
Yusuke Suzuki
Comment 1 2020-02-13 23:40:24 PST
Yusuke Suzuki
Comment 2 2020-02-13 23:40:57 PST
Comment on attachment 390732 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=390732&action=review > Source/WebCore/ChangeLog:10 > + has Vector<ResourceResponse> to replay response dispatching in the case of loading from BackForwardCache. The problem is Note that this is one of the largest Vector in Membuster.
Radar WebKit Bug Importer
Comment 3 2020-02-13 23:47:11 PST
Yusuke Suzuki
Comment 4 2020-02-14 00:59:31 PST
Yusuke Suzuki
Comment 5 2020-02-14 01:06:53 PST
Yusuke Suzuki
Comment 6 2020-02-14 01:15:31 PST
Yusuke Suzuki
Comment 7 2020-02-14 01:21:36 PST
Yusuke Suzuki
Comment 8 2020-02-14 01:36:16 PST
Yusuke Suzuki
Comment 9 2020-02-14 02:13:33 PST
Yusuke Suzuki
Comment 10 2020-02-14 02:16:01 PST
I'm also considering that making ResourceResponse RefCounted<>, but as a first step, I'll do NetworkLoadMetrics part. I think we could make ResourceResponse RefCounted<> without changing much of things. Due to WebKit2, we already initialize all the fields of ResourceResponse anyway. So, we could make almost all part as immutable.
Yusuke Suzuki
Comment 11 2020-02-14 04:32:25 PST
Keith Miller
Comment 12 2020-02-14 11:33:15 PST
Comment on attachment 390755 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=390755&action=review r=me with nits. > Source/WebCore/ChangeLog:13 > + While we sometimes copies it to modify some part of it, NetworkLoadMetrics is immutable. It is set when response is created, nit: copies => copy Also, what is "it" in "copies it"? A NeworkLoadMetrics or a ResourceResponse? > Source/WebCore/ChangeLog:17 > + This patch puts Box<NetworkLoadMetrics> in ResourceResponse to share it by all copied ResourceResponses. We do not make NetworkLoadMetrics Nit: share it by => hare it with. > Source/WebCore/ChangeLog:18 > + RefCounted<> for now since some legit data structure embeds NetworkLoadMetrics. This patch adds ArgumentCoder for Box so that we Nit: data structure embeds => data structures embed Or did you mean that there is only on data structure that embed's NetworkLoadMetrics? If so can you name that class? > Source/WebCore/platform/network/ResourceResponseBase.h:339 > + if constexpr (Decoder::isIPCDecoder) { > + if (!decoder.decode(response.m_networkLoadMetrics)) > + return false; > + } Why bother with this change? Seems like the compiler will make this optimization anyway? > Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm:68 > + Nit: remove newline here.
Yusuke Suzuki
Comment 13 2020-02-14 11:50:28 PST
Comment on attachment 390755 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=390755&action=review Thanks! >> Source/WebCore/ChangeLog:13 >> + While we sometimes copies it to modify some part of it, NetworkLoadMetrics is immutable. It is set when response is created, > > nit: copies => copy > > Also, what is "it" in "copies it"? A NeworkLoadMetrics or a ResourceResponse? Fixed. DocumentLoader for example is copying ResourceResponse. >> Source/WebCore/ChangeLog:17 >> + This patch puts Box<NetworkLoadMetrics> in ResourceResponse to share it by all copied ResourceResponses. We do not make NetworkLoadMetrics > > Nit: share it by => hare it with. Fixed. >> Source/WebCore/ChangeLog:18 >> + RefCounted<> for now since some legit data structure embeds NetworkLoadMetrics. This patch adds ArgumentCoder for Box so that we > > Nit: data structure embeds => data structures embed > > Or did you mean that there is only on data structure that embed's NetworkLoadMetrics? If so can you name that class? Fixed. Some of multiple classes are embedding NetworkLoadMetrics. So for now, I'm taking an easy path. >> Source/WebCore/platform/network/ResourceResponseBase.h:339 >> + } > > Why bother with this change? Seems like the compiler will make this optimization anyway? Encoder can be persistent coder (which generates bytes for disks). We can omit implementation of persistent coder's NetworkLoadMetrics handling if we use `if constexpr`. >> Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm:68 >> + > > Nit: remove newline here. Fixed.
Yusuke Suzuki
Comment 14 2020-02-14 11:53:22 PST
Note You need to log in before you can comment on or make changes to this bug.