- Revision
- 237004
- Author
- an...@apple.com
- Date
- 2018-10-10 10:41:55 -0700 (Wed, 10 Oct 2018)
Log Message
Do domain prewarming for processes for new tabs
https://bugs.webkit.org/show_bug.cgi?id=190425
Reviewed by Chris Dumez.
We currently only do domain prewarming for navigation process swaps.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigationInternal):
Do domain prewarming when using an existing but so far unused process.
(WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
Factor into a function.
* UIProcess/WebProcessPool.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):
This didn't usually get invoked.
(WebKit::WebPage::didReceivePolicyDecision):
(WebKit::WebPage::didFinishLoad):
Update prewarm information when a top level load finishes.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::sendPrewarmInformation):
* WebProcess/WebProcess.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (237003 => 237004)
--- trunk/Source/WebKit/ChangeLog 2018-10-10 17:16:07 UTC (rev 237003)
+++ trunk/Source/WebKit/ChangeLog 2018-10-10 17:41:55 UTC (rev 237004)
@@ -1,3 +1,36 @@
+2018-10-10 Antti Koivisto <an...@apple.com>
+
+ Do domain prewarming for processes for new tabs
+ https://bugs.webkit.org/show_bug.cgi?id=190425
+
+ Reviewed by Chris Dumez.
+
+ We currently only do domain prewarming for navigation process swaps.
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::processForNavigationInternal):
+
+ Do domain prewarming when using an existing but so far unused process.
+
+ (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
+
+ Factor into a function.
+
+ * UIProcess/WebProcessPool.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::close):
+
+ This didn't usually get invoked.
+
+ (WebKit::WebPage::didReceivePolicyDecision):
+ (WebKit::WebPage::didFinishLoad):
+
+ Update prewarm information when a top level load finishes.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::sendPrewarmInformation):
+ * WebProcess/WebProcess.h:
+
2018-10-09 Antoine Quint <grao...@apple.com>
Remove the frames() timing function
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (237003 => 237004)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-10-10 17:16:07 UTC (rev 237003)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-10-10 17:41:55 UTC (rev 237004)
@@ -2073,6 +2073,8 @@
Ref<WebProcessProxy> WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, ProcessSwapRequestedByClient processSwapRequestedByClient, PolicyAction& action, String& reason)
{
+ auto& targetURL = navigation.currentRequest().url();
+
if (!m_configuration->processSwapsOnNavigation() && processSwapRequestedByClient == ProcessSwapRequestedByClient::No) {
reason = "Feature is disabled"_s;
return page.process();
@@ -2090,6 +2092,7 @@
if (!page.process().hasCommittedAnyProvisionalLoads()) {
reason = "Process has not yet committed any provisional loads"_s;
+ tryPrewarmWithDomainInformation(page.process(), targetURL);
return page.process();
}
@@ -2130,7 +2133,6 @@
}
}
- auto targetURL = navigation.currentRequest().url();
if (processSwapRequestedByClient == ProcessSwapRequestedByClient::No) {
if (navigation.treatAsSameOriginNavigation()) {
reason = "The treatAsSameOriginNavigation flag is set"_s;
@@ -2182,9 +2184,7 @@
action = ""
if (RefPtr<WebProcessProxy> process = tryTakePrewarmedProcess(page.websiteDataStore())) {
- if (auto* prewarmInformation = m_prewarmInformationPerRegistrableDomain.get(toRegistrableDomain(targetURL)))
- process->send(Messages::WebProcess::PrewarmWithDomainInformation(*prewarmInformation), 0);
-
+ tryPrewarmWithDomainInformation(*process, targetURL);
return process.releaseNonNull();
}
@@ -2274,4 +2274,12 @@
*value = prewarmInformation;
}
+void WebProcessPool::tryPrewarmWithDomainInformation(WebProcessProxy& process, const WebCore::URL& url)
+{
+ auto* prewarmInformation = m_prewarmInformationPerRegistrableDomain.get(toRegistrableDomain(url));
+ if (!prewarmInformation)
+ return;
+ process.send(Messages::WebProcess::PrewarmWithDomainInformation(*prewarmInformation), 0);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (237003 => 237004)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2018-10-10 17:16:07 UTC (rev 237003)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2018-10-10 17:41:55 UTC (rev 237004)
@@ -523,6 +523,8 @@
void addProcessToOriginCacheSet(WebPageProxy&);
void removeProcessFromOriginCacheSet(WebProcessProxy&);
+ void tryPrewarmWithDomainInformation(WebProcessProxy&, const WebCore::URL&);
+
Ref<API::ProcessPoolConfiguration> m_configuration;
IPC::MessageReceiverMap m_messageReceiverMap;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (237003 => 237004)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-10-10 17:16:07 UTC (rev 237003)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-10-10 17:41:55 UTC (rev 237004)
@@ -1173,12 +1173,9 @@
m_isClosed = true;
// If there is still no URL, then we never loaded anything in this page, so nothing to report.
- if (!mainWebFrame()->url().isEmpty()) {
+ if (!mainWebFrame()->url().isEmpty())
reportUsedFeatures();
- WebProcess::singleton().sendPrewarmInformation(toRegistrableDomain(mainWebFrame()->url()));
- }
-
if (pageGroup()->isVisibleToInjectedBundle() && WebProcess::singleton().injectedBundle())
WebProcess::singleton().injectedBundle()->willDestroyPage(this);
@@ -2877,7 +2874,7 @@
ASSERT(frame == m_mainFrame);
setIsSuspended(true);
- WebProcess::singleton().sendPrewarmInformation(toRegistrableDomain(mainWebFrame()->url()));
+ WebProcess::singleton().sendPrewarmInformation(mainWebFrame()->url());
}
frame->didReceivePolicyDecision(listenerID, policyAction, navigationID, downloadID, WTFMove(websitePolicies));
}
@@ -5385,10 +5382,12 @@
void WebPage::didFinishLoad(WebFrame* frame)
{
-#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
if (!frame->isMainFrame())
return;
+ WebProcess::singleton().sendPrewarmInformation(frame->url());
+
+#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
m_readyToFindPrimarySnapshottedPlugin = true;
LOG(Plugins, "Primary Plug-In Detection: triggering detection from didFinishLoad (marking as ready to detect).");
m_determinePrimarySnapshottedPlugInTimer.startOneShot(0_s);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (237003 => 237004)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2018-10-10 17:16:07 UTC (rev 237003)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2018-10-10 17:41:55 UTC (rev 237004)
@@ -1473,8 +1473,9 @@
#endif
}
-void WebProcess::sendPrewarmInformation(const String& registrableDomain)
+void WebProcess::sendPrewarmInformation(const WebCore::URL& url)
{
+ auto registrableDomain = toRegistrableDomain(url);
if (registrableDomain.isEmpty())
return;
parentProcessConnection()->send(Messages::WebProcessProxy::DidCollectPrewarmInformation(registrableDomain, WebCore::ProcessWarming::collectPrewarmInformation()), 0);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (237003 => 237004)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2018-10-10 17:16:07 UTC (rev 237003)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2018-10-10 17:41:55 UTC (rev 237004)
@@ -201,7 +201,7 @@
void cancelPrepareToSuspend();
void processDidResume();
- void sendPrewarmInformation(const String& registrableDomain);
+ void sendPrewarmInformation(const WebCore::URL&);
#if PLATFORM(IOS)
void resetAllGeolocationPermissions();