Changeset 238525 in webkit
- Timestamp:
- Nov 26, 2018 2:54:48 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r238515 r238525 1 2018-11-26 Chris Dumez <cdumez@apple.com> 2 3 [PSON] process pre-warming should not be on for everyone 4 https://bugs.webkit.org/show_bug.cgi?id=191966 5 <rdar://problem/46138499> 6 7 Reviewed by Ryosuke Niwa. 8 9 If automatic process-prewarming is not explicitly turned on/off by the client, then we now only 10 turn it on automatically after the first process swap. Previously, it was always enabled if 11 process-swap on cross-site navigation was enabled (which is the case by default for all apps). 12 13 This is important because some apps do not actually browse (only display static content) or never 14 browse cross-site, and thus would not benefit from process prewarming and yet pay a memory cost. 15 16 * UIProcess/API/APIProcessPoolConfiguration.h: 17 Add m_clientWouldBenefitFromAutomaticProcessPrewarming flag which is false by default and is used 18 as a fallback if the client did not call setIsAutomaticProcessWarmingEnabled(). 19 20 * UIProcess/API/C/WKContextConfigurationRef.cpp: 21 (WKContextConfigurationPrewarmsProcessesAutomatically): 22 (WKContextConfigurationSetPrewarmsProcessesAutomatically): 23 Add C API to toggle automatic process prewarming. It is needed for Safari to turn on this feature 24 by default for browsing. This way Safari does not have to wait for the first process swap to 25 start prewarming. 26 27 * UIProcess/API/C/WKContextConfigurationRef.h: 28 * UIProcess/WebProcessPool.cpp: 29 (WebKit::WebProcessPool::didReachGoodTimeToPrewarm): 30 Only do automatic process prewarming if process-swap on cross-site navigation is also enabled. 31 This is needed for clients like Safari that explicitly enable automatic process prewarming but 32 only want to have it enabled if PSON is also enabled via experimental features. 33 34 (WebKit::WebProcessPool::processForNavigation): 35 On first process swap, if the client did not explicitly turn on or off automatic process prewarming 36 then we enable it then. This avoids paying the cost of process prewarming in apps that would not 37 benefit from it. 38 1 39 2018-11-26 Andy Estes <aestes@apple.com> 2 40 -
trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
r238388 r238525 62 62 bool isAutomaticProcessWarmingEnabled() const 63 63 { 64 // FIXME: For now, turning on PSON from the experimental features menu also turns on 65 // automatic process warming until clients can be updated. 66 return m_isAutomaticProcessWarmingEnabledByClient.value_or(m_processSwapsOnNavigationFromExperimentalFeatures); 64 return m_isAutomaticProcessWarmingEnabledByClient.value_or(m_clientWouldBenefitFromAutomaticProcessPrewarming); 67 65 } 66 67 bool wasAutomaticProcessWarmingSetByClient() const { return !!m_isAutomaticProcessWarmingEnabledByClient; } 68 68 void setIsAutomaticProcessWarmingEnabled(bool value) { m_isAutomaticProcessWarmingEnabledByClient = value; } 69 70 bool clientWouldBenefitFromAutomaticProcessPrewarming() const { return m_clientWouldBenefitFromAutomaticProcessPrewarming; } 71 void setClientWouldBenefitFromAutomaticProcessPrewarming(bool value) { m_clientWouldBenefitFromAutomaticProcessPrewarming = value; } 69 72 70 73 bool diskCacheSpeculativeValidationEnabled() const { return m_diskCacheSpeculativeValidationEnabled; } … … 223 226 bool m_processSwapsOnWindowOpenWithOpener { false }; 224 227 std::optional<bool> m_isAutomaticProcessWarmingEnabledByClient; 228 bool m_clientWouldBenefitFromAutomaticProcessPrewarming { false }; 225 229 WTF::String m_customWebContentServiceBundleIdentifier; 226 230 bool m_isJITEnabled { true }; -
trunk/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp
r232531 r238525 169 169 } 170 170 171 bool WKContextConfigurationPrewarmsProcessesAutomatically(WKContextConfigurationRef configuration) 172 { 173 return toImpl(configuration)->isAutomaticProcessWarmingEnabled(); 174 } 175 176 void WKContextConfigurationSetPrewarmsProcessesAutomatically(WKContextConfigurationRef configuration, bool prewarms) 177 { 178 toImpl(configuration)->setIsAutomaticProcessWarmingEnabled(prewarms); 179 } 180 171 181 bool WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses(WKContextConfigurationRef configuration) 172 182 { -
trunk/Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h
r232531 r238525 72 72 WK_EXPORT void WKContextConfigurationSetProcessSwapsOnNavigation(WKContextConfigurationRef configuration, bool swaps); 73 73 74 WK_EXPORT bool WKContextConfigurationPrewarmsProcessesAutomatically(WKContextConfigurationRef configuration); 75 WK_EXPORT void WKContextConfigurationSetPrewarmsProcessesAutomatically(WKContextConfigurationRef configuration, bool prewarms); 76 74 77 WK_EXPORT bool WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses(WKContextConfigurationRef configuration); 75 78 WK_EXPORT void WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses(WKContextConfigurationRef configuration, bool keepAndReuse); -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r238330 r238525 1286 1286 void WebProcessPool::didReachGoodTimeToPrewarm() 1287 1287 { 1288 if (!configuration().isAutomaticProcessWarmingEnabled() )1288 if (!configuration().isAutomaticProcessWarmingEnabled() || !configuration().processSwapsOnNavigation()) 1289 1289 return; 1290 1290 … … 2114 2114 auto process = processForNavigationInternal(page, navigation, processSwapRequestedByClient, reason); 2115 2115 2116 // We are process-swapping so automatic process prewarming would be beneficial if the client has not explicitly enabled / disabled it. 2117 bool doingAnAutomaticProcessSwap = processSwapRequestedByClient == ProcessSwapRequestedByClient::No && process.ptr() != &page.process(); 2118 if (doingAnAutomaticProcessSwap && !configuration().wasAutomaticProcessWarmingSetByClient() && !configuration().clientWouldBenefitFromAutomaticProcessPrewarming()) { 2119 RELEASE_LOG(PerformanceLogging, "Automatically turning on process prewarming because the client would benefit from it"); 2120 configuration().setClientWouldBenefitFromAutomaticProcessPrewarming(true); 2121 } 2122 2116 2123 if (m_configuration->alwaysKeepAndReuseSwappedProcesses() && process.ptr() != &page.process()) { 2117 2124 static std::once_flag onceFlag;
Note: See TracChangeset
for help on using the changeset viewer.