Bug 198692 - [iOS] ResourceLoadStatistics state is not properly relayed to the NetworkProcess
Summary: [iOS] ResourceLoadStatistics state is not properly relayed to the NetworkProcess
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks: 198694
  Show dependency treegraph
 
Reported: 2019-06-08 14:01 PDT by Brent Fulgham
Modified: 2019-06-09 17:25 PDT (History)
11 users (show)

See Also:


Attachments
Patch (1.49 KB, patch)
2019-06-08 14:04 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (1.49 KB, patch)
2019-06-08 16:50 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (1.54 KB, patch)
2019-06-08 17:01 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (1.58 KB, patch)
2019-06-08 18:20 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (1.56 KB, patch)
2019-06-08 19:10 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2019-06-08 14:01:49 PDT
When I moved the ResourceLoadStatistics logic to the NetworkProcess, I did not realize that the iOS process startup does not have a WebsiteDataStore attached until much later in the launch cycle. Because of this, we do not pass the ITP state to the NetworkProcess at launch (as part of its configuration parameters), and when we attempt to message the state to the NetworkProcess during startup we do so at a moment when we have not associated the WebProcessPool with the WebsiteDataStore object that knows about ITP status.

Furthermore, I failed to notice that the method to activate ITP only messages the WebContent processes, not the NetworkProcess. This had not been needed before I moved the logic to the NetworkProcess, and was an oversight.

This patch updates WebProcessPool::setResourceLoadStatisticsEnabled so that the process pool tells the NetworkProcess when the ITP state changes.
Comment 1 Brent Fulgham 2019-06-08 14:03:37 PDT
<rdar://problem/51538088>
Comment 2 Brent Fulgham 2019-06-08 14:04:43 PDT
Created attachment 371666 [details]
Patch
Comment 3 John Wilander 2019-06-08 14:15:42 PDT
Comment on attachment 371666 [details]
Patch

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

> Source/WebKit/UIProcess/WebProcessPool.cpp:1491
> +    sendToNetworkingProcess(Messages::WebProcess::SetResourceLoadStatisticsEnabled(enabled));

This message type should be for the NetworkProcess, not the WebProcess.
Comment 4 Maciej Stachowiak 2019-06-08 14:25:00 PDT
Comment on attachment 371666 [details]
Patch

This really needs a test, since it is a fix for a real regression and one that wen't long unnoticed. r- for lack of test case.
Comment 5 Brent Fulgham 2019-06-08 16:50:00 PDT
Created attachment 371681 [details]
Patch
Comment 6 Brent Fulgham 2019-06-08 16:51:33 PDT
Comment on attachment 371681 [details]
Patch

Updated to use proper message heading.

I'll tackle the test separately since it will be a larger patch.
Comment 7 Brent Fulgham 2019-06-08 17:01:23 PDT
Created attachment 371682 [details]
Patch
Comment 8 Brent Fulgham 2019-06-08 17:01:46 PDT
Comment on attachment 371682 [details]
Patch

Updated to address WPE build failure.
Comment 9 John Wilander 2019-06-08 17:19:13 PDT
Comment on attachment 371682 [details]
Patch

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

> Source/WebKit/UIProcess/WebProcessPool.cpp:1492
> +    sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(enabled));

I’m looking at this on my phone so I don’t have the larger picture. Do we need to ensure that there is a network process here? I know we had some cases where that was a requirement.
Comment 10 Brent Fulgham 2019-06-08 17:44:15 PDT
Comment on attachment 371682 [details]
Patch

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

>> Source/WebKit/UIProcess/WebProcessPool.cpp:1492
>> +    sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(enabled));
> 
> I’m looking at this on my phone so I don’t have the larger picture. Do we need to ensure that there is a network process here? I know we had some cases where that was a requirement.

That's probably a good idea. It looks like we do something like that when dealing with Ephemeral sessions, so this probably has the same requirement.
Comment 11 Brent Fulgham 2019-06-08 17:47:14 PDT
(In reply to Maciej Stachowiak from comment #4)
> Comment on attachment 371666 [details]
> Patch
> 
> This really needs a test, since it is a fix for a real regression and one
> that wen't long unnoticed. r- for lack of test case.

I started doing this, but the patch grew much larger. I would rather handle the test case as a distinct patch so that it's clear what's going on.

See Bug 198694 for that work.
Comment 12 Brent Fulgham 2019-06-08 18:20:44 PDT
Created attachment 371691 [details]
Patch
Comment 13 Brent Fulgham 2019-06-08 19:07:27 PDT
(In reply to Brent Fulgham from comment #10)
> Comment on attachment 371682 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=371682&action=review
> 
> >> Source/WebKit/UIProcess/WebProcessPool.cpp:1492
> >> +    sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(enabled));
> > 
> > I’m looking at this on my phone so I don’t have the larger picture. Do we need to ensure that there is a network process here? I know we had some cases where that was a requirement.
> 
> That's probably a good idea. It looks like we do something like that when
> dealing with Ephemeral sessions, so this probably has the same requirement.

Actually it's not a good idea because it breaks the API tests involving a lack of a process pool (TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPoolWithPrewarming and the without prewarming case).

So, we don't want to force a network process launch if it doesn't already exist -- we just want to make sure we do send it the message.
Comment 14 Brent Fulgham 2019-06-08 19:10:16 PDT
Created attachment 371697 [details]
Patch
Comment 15 Maciej Stachowiak 2019-06-09 16:30:20 PDT
Comment on attachment 371697 [details]
Patch

Looks good.
Comment 16 WebKit Commit Bot 2019-06-09 17:25:25 PDT
Comment on attachment 371697 [details]
Patch

Clearing flags on attachment: 371697

Committed r246248: <https://trac.webkit.org/changeset/246248>
Comment 17 WebKit Commit Bot 2019-06-09 17:25:27 PDT
All reviewed patches have been landed.  Closing bug.