Changeset 207424 in webkit
- Timestamp:
- Oct 17, 2016 1:18:38 PM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r207414 r207424 1 2016-10-17 Gavin Barraclough <barraclough@apple.com> 2 3 UIProcess should determine throttle state for WebContent process 4 https://bugs.webkit.org/show_bug.cgi?id=163556 5 6 Reviewed by Anders Carlsson. 7 8 This is a step towards merging page/process throttling code for mac & iOS. 9 10 Previously WebPage determined whether to start a UserActivity based on page activity, 11 visibility and the preference to disable. Now WebPage passes the activity state across 12 to WebPageProxy, which makes the decision & explicitly instructs WebPage to start/stop 13 the UserActivity. 14 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::WebPageProxy): 17 - updateActivityToken + updateProccessSuppressionState -> updateThrottleState 18 (WebKit::WebPageProxy::reattachToWebProcess): 19 - updateActivityToken -> updateThrottleState 20 (WebKit::WebPageProxy::dispatchViewStateChange): 21 - updateActivityToken -> updateThrottleState 22 (WebKit::WebPageProxy::setPageActivityState): 23 - Record activity state passed from WebPage, and update. 24 (WebKit::WebPageProxy::preferencesDidChange): 25 - updateProccessSuppressionState -> updateThrottleState 26 (WebKit::WebPageProxy::updateActivityToken): Deleted. 27 (WebKit::WebPageProxy::updateProccessSuppressionState): Deleted. 28 (WebKit::WebPageProxy::updateThrottleState): 29 - Merged existing updateActivityToken/updateProccessSuppressionState to unified updateThrottleState. 30 - Compute whether page should be suppressed, and send SetPageSuppressed message accordingly. 31 * UIProcess/WebPageProxy.h: 32 - Merged existing updateActivityToken/updateProccessSuppressionState to unified updateThrottleState. 33 - Added setPageActivityState/m_activityState to report/record page activity. 34 - Added m_pageSuppressed to prevent redundant message sends. 35 * UIProcess/WebPageProxy.messages.in: 36 - Expose SetPageActivityState message (called by WebPage). 37 * WebProcess/WebPage/WebPage.cpp: 38 (WebKit::WebPage::WebPage): 39 - removed m_processSuppressionEnabled 40 - updateUserActivity -> setPageSuppressed - explicitly set the page to not be suppressed, until WebPageProxy tells us to do so. 41 (WebKit::WebPage::setPageActivityState): 42 - post activity state on to WebPageProxy. 43 (WebKit::WebPage::setPageSuppressed): 44 - Start/stop USerActivity accordingly. 45 (WebKit::WebPage::setViewState): 46 - No longer need to monitor ViewState changes on the WebProcess side. 47 (WebKit::WebPage::updatePreferences): 48 - No longer need to monitor preference changes on the WebProcess side. 49 (WebKit::WebPage::updateUserActivity): Deleted. 50 - Only updated on reciept of setPageSuppressed message. 51 * WebProcess/WebPage/WebPage.h: 52 - Removed m_activityState, m_processSuppressionEnabled, updateUserActivity. 53 - Added setPageSuppressed message. 54 * WebProcess/WebPage/WebPage.messages.in: 55 - Added SetPageSuppressed message. 56 1 57 2016-10-17 Michael Catanzaro <mcatanzaro@igalia.com> 2 58 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r207298 r207424 458 458 459 459 updateViewState(); 460 updateActivityToken(); 461 updateProccessSuppressionState(); 460 updateThrottleState(); 462 461 updateHiddenPageThrottlingAutoIncreases(); 463 462 … … 716 715 717 716 updateViewState(); 718 update ActivityToken();717 updateThrottleState(); 719 718 720 719 m_inspector = WebInspectorProxy::create(this); … … 1539 1538 1540 1539 // This must happen after the SetViewState message is sent, to ensure the page visibility event can fire. 1541 update ActivityToken();1540 updateThrottleState(); 1542 1541 1543 1542 // If we've started the responsiveness timer as part of telling the web process to update the backing store … … 1564 1563 } 1565 1564 1565 void WebPageProxy::setPageActivityState(WebCore::PageActivityState::Flags activityState) 1566 { 1567 m_activityState = activityState; 1568 updateThrottleState(); 1569 } 1570 1566 1571 bool WebPageProxy::isAlwaysOnLoggingAllowed() const 1567 1572 { … … 1569 1574 } 1570 1575 1571 void WebPageProxy::updateActivityToken() 1572 { 1576 void WebPageProxy::updateThrottleState() 1577 { 1578 bool processSuppressionEnabled = m_preferences->pageVisibilityBasedProcessSuppressionEnabled(); 1579 1580 // If process suppression is not enabled take a token on the process pool to disable suppression of support processes. 1581 if (!processSuppressionEnabled) 1582 m_preventProcessSuppressionCount = m_process->processPool().processSuppressionDisabledForPageCount(); 1583 else if (!m_preventProcessSuppressionCount) 1584 m_preventProcessSuppressionCount = nullptr; 1585 1586 // We should suppress if the page is not active, is visually idle, and supression is enabled. 1587 bool pageShouldBeSuppressed = !m_activityState && processSuppressionEnabled && (m_viewState & ViewState::IsVisuallyIdle); 1588 if (m_pageSuppressed != pageShouldBeSuppressed) { 1589 m_pageSuppressed = pageShouldBeSuppressed; 1590 m_process->send(Messages::WebPage::SetPageSuppressed(m_pageSuppressed), m_pageID); 1591 } 1592 1573 1593 if (m_viewState & ViewState::IsVisuallyIdle) 1574 1594 m_pageIsUserObservableCount = nullptr; … … 1590 1610 } 1591 1611 #endif 1592 }1593 1594 void WebPageProxy::updateProccessSuppressionState()1595 {1596 if (m_preferences->pageVisibilityBasedProcessSuppressionEnabled())1597 m_preventProcessSuppressionCount = nullptr;1598 else if (!m_preventProcessSuppressionCount)1599 m_preventProcessSuppressionCount = m_process->processPool().processSuppressionDisabledForPageCount();1600 1612 } 1601 1613 … … 3013 3025 #endif 3014 3026 3015 update ProccessSuppressionState();3027 updateThrottleState(); 3016 3028 updateHiddenPageThrottlingAutoIncreases(); 3017 3029 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r207298 r207424 1138 1138 1139 1139 void updateViewState(WebCore::ViewState::Flags flagsToUpdate = WebCore::ViewState::AllFlags); 1140 void updateActivityToken(); 1141 void updateProccessSuppressionState(); 1140 void updateThrottleState(); 1142 1141 void updateHiddenPageThrottlingAutoIncreases(); 1143 1142 … … 1521 1520 void viewDidLeaveWindow(); 1522 1521 void viewDidEnterWindow(); 1522 void setPageActivityState(WebCore::PageActivityState::Flags); 1523 1523 1524 1524 #if PLATFORM(MAC) … … 1714 1714 DownloadID m_syncNavigationActionPolicyDownloadID; 1715 1715 bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false }; 1716 WebCore::PageActivityState::Flags m_activityState { WebCore::PageActivityState::NoFlags }; 1717 bool m_pageSuppressed { false }; 1716 1718 1717 1719 Deque<NativeWebKeyboardEvent> m_keyEventQueue; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r206771 r207424 409 409 410 410 DidUpdateViewState() 411 411 SetPageActivityState(int32_t pageActivityState) 412 412 413 DidSaveToPageCache() 413 414 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r207159 r207424 377 377 , m_useAsyncScrolling(false) 378 378 , m_viewState(parameters.viewState) 379 , m_processSuppressionEnabled(true)380 379 , m_userActivity("Process suppression disabled for page.") 381 380 , m_pendingNavigationID(0) … … 496 495 if (!isVisible()) 497 496 m_page->setIsPrerender(); 498 updateUserActivity();497 setPageSuppressed(false); 499 498 500 499 updateIsInWindow(true); … … 583 582 void WebPage::setPageActivityState(PageActivityState::Flags activityState) 584 583 { 585 PageActivityState::Flags changed = m_activityState ^ activityState; 586 m_activityState = activityState; 587 588 if (changed) 589 updateUserActivity(); 590 } 591 592 void WebPage::updateUserActivity() 593 { 594 // Start the activity to prevent AppNap if the page activity is in progress, 595 // the page is visible and non-idle, or process suppression is disabled. 596 if (m_activityState || !(m_viewState & ViewState::IsVisuallyIdle) || !m_processSuppressionEnabled) 584 send(Messages::WebPageProxy::SetPageActivityState(activityState)); 585 } 586 587 void WebPage::setPageSuppressed(bool pageSuppressed) 588 { 589 // The UserActivity keeps the processes runnable. So if the page should be suppressed, stop the activity. 590 // If the page should not be supressed, start it. 591 if (pageSuppressed) 592 m_userActivity.stop(); 593 else 597 594 m_userActivity.start(); 598 else599 m_userActivity.stop();600 595 } 601 596 … … 2596 2591 m_viewState = viewState; 2597 2592 2598 if (changed)2599 updateUserActivity();2600 2601 2593 m_page->setViewState(viewState); 2602 2594 for (auto* pluginView : m_pluginViews) … … 3234 3226 RuntimeEnabledFeatures::sharedFeatures().setModernMediaControlsEnabled(store.getBoolValueForKey(WebPreferencesKey::modernMediaControlsEnabledKey())); 3235 3227 3236 bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());3237 if (m_processSuppressionEnabled != processSuppressionEnabled) {3238 m_processSuppressionEnabled = processSuppressionEnabled;3239 updateUserActivity();3240 }3241 3242 3228 platformPreferencesDidChange(store); 3243 3229 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r206626 r207424 927 927 928 928 void setPageActivityState(WebCore::PageActivityState::Flags); 929 void setPageSuppressed(bool); 929 930 930 931 void postMessage(const String& messageName, API::Object* messageBody); … … 1040 1041 void setEditable(bool); 1041 1042 1042 void updateUserActivity();1043 1044 1043 void mouseEvent(const WebMouseEvent&); 1045 1044 void keyEvent(const WebKeyboardEvent&); … … 1477 1476 1478 1477 WebCore::ViewState::Flags m_viewState; 1479 WebCore::PageActivityState::Flags m_activityState; 1480 1481 bool m_processSuppressionEnabled; 1478 1482 1479 UserActivity m_userActivity; 1483 1480 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r206929 r207424 25 25 SetViewState(unsigned viewState, bool wantsDidUpdateViewState, Vector<uint64_t> callbackIDs) 26 26 SetLayerHostingMode(enum WebKit::LayerHostingMode layerHostingMode) 27 SetPageSuppressed(bool pageSuppressed) 27 28 28 29 SetDrawsBackground(bool drawsBackground)
Note: See TracChangeset
for help on using the changeset viewer.