Bug 169506

Summary: Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
Product: WebKit Reporter: John Wilander <wilander>
Component: WebKit2Assignee: John Wilander <wilander>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, cdumez, commit-queue, dbates, japhet, webkit-bug-importer, wilander
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description John Wilander 2017-03-10 20:27:29 PST
We should send batches of domains to remove and add in one message type to the network process.

Also, there is a bug in how user interaction gets reported to the network process. It has to go through the UI process which will be addressed by the same change.

We should make sure we behave gracefully if we have nothing to report to the network process.
Comment 1 John Wilander 2017-03-10 20:48:12 PST
Created attachment 304123 [details]
Patch
Comment 2 Alex Christensen 2017-03-13 11:36:06 PDT
Comment on attachment 304123 [details]
Patch

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

> Source/WebCore/loader/ResourceLoadStatistics.cpp:297
> +    // In-memory only

I'm not sure this comment helps anything

> Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp:185
> -    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& primaryDomains, bool value) {
> -        shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
> +    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {

The WTFMove will still be necessary when we change the std::function to WTF::Function and make sure it's never copied.  Removing the WTFMove just makes a copy, which doesn't cause a problem in this case.
Comment 3 John Wilander 2017-03-13 13:54:28 PDT
Created attachment 304295 [details]
Patch
Comment 4 John Wilander 2017-03-13 13:57:55 PDT
(In reply to comment #2)
> Comment on attachment 304123 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=304123&action=review
> 
> > Source/WebCore/loader/ResourceLoadStatistics.cpp:297
> > +    // In-memory only
> 
> I'm not sure this comment helps anything

I commented on it to minimize confusion as to why this value is not persisted to or decoded from disk and that it has to be generated at runtime. This is because the state in the network process only exists at runtime.

> > Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp:185
> > -    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& primaryDomains, bool value) {
> > -        shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
> > +    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
> 
> The WTFMove will still be necessary when we change the std::function to
> WTF::Function and make sure it's never copied.  Removing the WTFMove just
> makes a copy, which doesn't cause a problem in this case.

Good catch! That change was unintentional. I was changing things as part of my debugging. The move is now back in.

Thanks for the review, Alex!
Comment 5 Radar WebKit Bug Importer 2017-03-13 14:08:12 PDT
<rdar://problem/31019494>
Comment 6 WebKit Commit Bot 2017-03-13 14:50:54 PDT
Comment on attachment 304295 [details]
Patch

Clearing flags on attachment: 304295

Committed r213871: <http://trac.webkit.org/changeset/213871>
Comment 7 WebKit Commit Bot 2017-03-13 14:50:58 PDT
All reviewed patches have been landed.  Closing bug.