Bug 180374 - Don't force creation of process pool when enabling resource load statistics
Summary: Don't force creation of process pool when enabling resource load statistics
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:
 
Reported: 2017-12-04 13:22 PST by Brent Fulgham
Modified: 2017-12-05 14:36 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.60 KB, patch)
2017-12-04 13:26 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (1.69 KB, patch)
2017-12-04 14:07 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (1.69 KB, patch)
2017-12-04 14:11 PST, Brent Fulgham
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2017-12-04 13:22:01 PST
When activating resource load statistics, we should avoid forcing the creation of a new process pool if it doesn't yet exist. We will properly set the value when initializing the first web view, so there is no point in paying the construction cost for the process pool during initial launch.
Comment 1 Brent Fulgham 2017-12-04 13:22:16 PST
<rdar://problem/35545639>
Comment 2 Brent Fulgham 2017-12-04 13:26:28 PST
Created attachment 328382 [details]
Patch
Comment 3 Alex Christensen 2017-12-04 13:29:20 PST
Comment on attachment 328382 [details]
Patch

Reading the code, I don't understand what it does or what it means.  It's very not straightforward and if I wrote more code I would make this same mistake.
This has no tests.
Comment 4 Brent Fulgham 2017-12-04 13:37:04 PST
(In reply to Alex Christensen from comment #3)
> Comment on attachment 328382 [details]
> Patch
> 
> Reading the code, I don't understand what it does or what it means.  It's
> very not straightforward and if I wrote more code I would make this same
> mistake.
> This has no tests.

I'm not sure I follow the r- here. You're saying the patch is bad because it uses the existing (but confusing) API to fix the bug I was trying to resolve? It might be clearer if you said "please create a brand new API that is not confusing".

The functionality of activating resource load statistics is covered by existing tests, which should not fail after this patch.

We do not have testing infrastructure (supported by our LayoutTest) for measuring startup cost, which is what this is trying to resolve.
Comment 5 Geoffrey Garen 2017-12-04 13:49:30 PST
Comment on attachment 328382 [details]
Patch

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

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1323
> +    for (auto& processPool : processPools(1, false))

You can make this code clearer by putting 1 and false into local named variables that reflect their meanings.

It's weird to write this code as a loop since the 1 you've passed to processPools guarantees there will be only one item.

Maybe you can just reuse the processPoolForCookieStorageOperations() function here. But you're not doing cookie operations, so it needs a clearer name for its purpose. Maybe "anyProcessPool()".
Comment 6 Brent Fulgham 2017-12-04 14:07:00 PST
Created attachment 328386 [details]
Patch
Comment 7 Brent Fulgham 2017-12-04 14:09:25 PST
Comment on attachment 328382 [details]
Patch

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

>> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1323
>> +    for (auto& processPool : processPools(1, false))
> 
> You can make this code clearer by putting 1 and false into local named variables that reflect their meanings.
> 
> It's weird to write this code as a loop since the 1 you've passed to processPools guarantees there will be only one item.
> 
> Maybe you can just reuse the processPoolForCookieStorageOperations() function here. But you're not doing cookie operations, so it needs a clearer name for its purpose. Maybe "anyProcessPool()".

Yeah -- this is wrong. I do want to get whatever pools exist -- I just don't want to create a process pool if it doesn't exist yet.

I was thinking about making a new method wrapper called "existingProcessPools()" that would do this:

return processPools(std::numeric_limits<size_t>::max(), false);
Comment 8 Brent Fulgham 2017-12-04 14:11:01 PST
Created attachment 328388 [details]
Patch
Comment 9 Brent Fulgham 2017-12-04 17:11:54 PST
Committed r225508: <https://trac.webkit.org/changeset/225508>
Comment 10 Geoffrey Garen 2017-12-05 14:36:41 PST
Still think it would be nice to name the arguments here.