Changeset 147592 in webkit
- Timestamp:
- Apr 3, 2013 3:54:51 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r147579 r147592 1 2013-04-02 Mark Rowe <mrowe@apple.com> 2 3 Enable process suppression when no windows in the application have drawn recently. 4 <http://webkit.org/b/113854> / <rdar://problem/13540351> 5 6 Reviewed by Darin Adler. 7 8 * UIProcess/mac/WebContextMac.mm: 9 (WebKit::applicationWindowModificationsStarted): Note that modifications are no longer stopped. 10 (WebKit::applicationWindowModificationsStopped): Note that modifications have stopped. 11 (WebKit::registerOcclusionNotificationHandlers): Register handlers for the start and stop notifications. 12 (WebKit::unregisterOcclusionNotificationHandlers): Unregister handlers for the start and stop notifications. 13 (WebKit::WebContext::canEnableProcessSuppressionForNetworkProcess): Allow suppression if the application is occluded 14 or the application has not drawn recently. 15 (WebKit::WebContext::canEnableProcessSuppressionForWebProcess): Ditto. 16 (WebKit::WebContext::canEnableProcessSuppressionForGlobalChildProcesses): Ditto. 17 1 18 2013-04-03 Dean Jackson <dino@apple.com> 2 19 -
trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm
r141167 r147592 67 67 68 68 static bool s_applicationIsOccluded = false; 69 static bool s_applicationWindowModificationsHaveStopped = false; 69 70 static bool s_occlusionNotificationHandlersRegistered = false; 70 71 static bool s_processSuppressionEnabledForAllContexts = true; … … 129 130 applicationOcclusionStateChanged(); 130 131 } 132 133 static void applicationWindowModificationsStarted(uint32_t, void*, uint32_t, void*, uint32_t) 134 { 135 if (!s_applicationWindowModificationsHaveStopped) 136 return; 137 s_applicationWindowModificationsHaveStopped = false; 138 applicationOcclusionStateChanged(); 139 } 140 141 static void applicationWindowModificationsStopped(uint32_t, void*, uint32_t, void*, uint32_t) 142 { 143 if (s_applicationWindowModificationsHaveStopped) 144 return; 145 s_applicationWindowModificationsHaveStopped = true; 146 applicationOcclusionStateChanged(); 147 } 148 131 149 #endif 132 150 … … 139 157 } 140 158 141 if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameOccluded)) 159 if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameOccluded)) { 142 160 WTFLogAlways("Registration of \"Application Became Occluded\" notification handler failed.\n"); 161 return; 162 } 163 164 if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStarted, applicationWindowModificationsStarted)) { 165 WTFLogAlways("Registration of \"Application Window Modifications Started\" notification handler failed.\n"); 166 return; 167 } 168 169 if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStopped, applicationWindowModificationsStopped)) { 170 WTFLogAlways("Registration of \"Application Window Modifications Stopped\" notification handler failed.\n"); 171 return; 172 } 143 173 #endif 144 174 } … … 152 182 } 153 183 154 if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameVisible)) 184 if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameVisible)) { 155 185 WTFLogAlways("Unregistration of \"Application Became Visible\" notification handler failed.\n"); 186 return; 187 } 188 189 if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStarted, applicationWindowModificationsStarted)) { 190 WTFLogAlways("Unregistration of \"Application Window Modifications Started\" notification handler failed.\n"); 191 return; 192 } 193 194 if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStopped, applicationWindowModificationsStopped)) { 195 WTFLogAlways("Unregistration of \"Application Window Modifications Stopped\" notification handler failed.\n"); 196 return; 197 } 156 198 #endif 157 199 } … … 447 489 bool WebContext::canEnableProcessSuppressionForNetworkProcess() const 448 490 { 449 return s_applicationIsOccluded&& m_processSuppressionEnabled && !omitProcessSuppression();491 return (s_applicationIsOccluded || s_applicationWindowModificationsHaveStopped) && m_processSuppressionEnabled && !omitProcessSuppression(); 450 492 } 451 493 452 494 bool WebContext::canEnableProcessSuppressionForWebProcess(const WebKit::WebProcessProxy *webProcess) const 453 495 { 454 return (s_applicationIsOccluded || webProcess->allPagesAreProcessSuppressible())496 return (s_applicationIsOccluded || s_applicationWindowModificationsHaveStopped || webProcess->allPagesAreProcessSuppressible()) 455 497 && m_processSuppressionEnabled && !omitProcessSuppression(); 456 498 } … … 458 500 bool WebContext::canEnableProcessSuppressionForGlobalChildProcesses() 459 501 { 460 return s_applicationIsOccluded&& s_processSuppressionEnabledForAllContexts && !omitProcessSuppression();502 return (s_applicationIsOccluded || s_applicationWindowModificationsHaveStopped) && s_processSuppressionEnabledForAllContexts && !omitProcessSuppression(); 461 503 } 462 504
Note: See TracChangeset
for help on using the changeset viewer.