Bug 190312

Summary: Prewarm FontDatabase on process swap
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, cdumez, commit-queue, ews-watchlist, ggaren, mmaxfield, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
none
patch
none
patch
cdumez: review+
patch none

Antti Koivisto
Reported 2018-10-05 07:48:46 PDT
Prewarm process using cached information about the fonts the page likely needs.
Attachments
patch (24.85 KB, patch)
2018-10-05 08:44 PDT, Antti Koivisto
no flags
patch (25.83 KB, patch)
2018-10-08 02:25 PDT, Antti Koivisto
no flags
patch (25.84 KB, patch)
2018-10-08 03:44 PDT, Antti Koivisto
no flags
patch (26.10 KB, patch)
2018-10-08 04:11 PDT, Antti Koivisto
cdumez: review+
patch (26.18 KB, patch)
2018-10-09 00:52 PDT, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2018-10-05 08:44:24 PDT
Alex Christensen
Comment 2 2018-10-05 11:13:46 PDT
Comment on attachment 351675 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=351675&action=review > Source/WebCore/page/PrewarmInformation.h:52 > + return { }; std::nullopt > Source/WebKit/UIProcess/WebProcessPool.h:702 > + HashMap<String, std::unique_ptr<WebCore::PrewarmInformation>> m_prewarmInformationForRegistrableDomain; It seems like the map should not have unique_ptr values. Why not HashMap<String, WebCore::PrewarmInformation>? > Source/WebKit/WebProcess/WebProcess.h:252 > void prewarm(); > + void prewarmWithDomainInformation(const WebCore::PrewarmInformation&); Do we need both of these?
Antti Koivisto
Comment 3 2018-10-05 11:35:57 PDT
> It seems like the map should not have unique_ptr values. Why not > HashMap<String, WebCore::PrewarmInformation>? Complex structures as map values are a bad idea as rehashing can involve lots of copying. PrewarmInformation is not that complex yet but the idea is for it to be expandable. > > Source/WebKit/WebProcess/WebProcess.h:252 > > void prewarm(); > > + void prewarmWithDomainInformation(const WebCore::PrewarmInformation&); > > Do we need both of these? First one is for general prewarming that doesn't require any context and is done right after process creation. The seconds one requires we know the domain and happens on the first page load in the process. Some renaming might be good to clarify this.
Alex Christensen
Comment 4 2018-10-05 11:42:16 PDT
Comment on attachment 351675 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=351675&action=review > Source/WebKit/UIProcess/WebProcessPool.cpp:2268 > + auto& value = m_prewarmInformationForRegistrableDomain.ensure(registrableDomain, [] { > + return std::make_unique<WebCore::PrewarmInformation>(); > + }).iterator->value; > + > + *value = prewarmInformation; I agree with using std::unique_ptr for the key now, but could we call set instead of ensure, creating an empty structure, then copying values into it?
Antti Koivisto
Comment 5 2018-10-08 00:51:28 PDT
> I agree with using std::unique_ptr for the key now, but could we call set > instead of ensure, creating an empty structure, then copying values into it? I don't see how that would be better.
Antti Koivisto
Comment 6 2018-10-08 02:25:08 PDT
Antti Koivisto
Comment 7 2018-10-08 02:26:05 PDT
> std::nullopt Why?
Antti Koivisto
Comment 8 2018-10-08 03:44:14 PDT
Antti Koivisto
Comment 9 2018-10-08 04:11:52 PDT
Chris Dumez
Comment 10 2018-10-08 09:23:35 PDT
Comment on attachment 351768 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=351768&action=review r=me > Source/WebKit/UIProcess/WebProcessPool.h:702 > + HashMap<String, std::unique_ptr<WebCore::PrewarmInformation>> m_prewarmInformationForRegistrableDomain; It seems we use PerRegistrableDomain naming above, let's be consistent?
Antti Koivisto
Comment 11 2018-10-09 00:52:57 PDT
WebKit Commit Bot
Comment 12 2018-10-09 02:14:44 PDT
Comment on attachment 351869 [details] patch Clearing flags on attachment: 351869 Committed r236959: <https://trac.webkit.org/changeset/236959>
WebKit Commit Bot
Comment 13 2018-10-09 02:14:46 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14 2018-10-09 02:15:23 PDT
Note You need to log in before you can comment on or make changes to this bug.