Changeset 209102 in webkit


Ignore:
Timestamp:
Nov 29, 2016, 5:00:12 PM (9 years ago)
Author:
barraclough@apple.com
Message:

Remove WebPage::SetPageSuppressed
https://bugs.webkit.org/show_bug.cgi?id=165158

Reviewed by Tim Horton.

This was scaffolding. We've now refactored to the point that the information driving throttling originates
from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
don't need a separate message to handle this - necessary state to determine is provided in ActivityState.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::updateThrottleState):

  • used to send SetPageSuppressed; no longer does.
  • UIProcess/WebPageProxy.h:
    • removed m_pageSuppressed (was used to avoid duplicated messages).
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updateThrottleState):

  • compute throttle state based on m_activityState.

(WebKit::WebPage::setActivityState):

  • update throttle state whenever activity state changes.

(WebKit::WebPage::updatePreferences):

  • update throttle state whenever preferences change (throttling can be disabled via preference).

(WebKit::WebPage::setPageSuppressed): Deleted.

  • Removed WebPage::SetPageSuppressed.
  • WebProcess/WebPage/WebPage.h:
    • Removed WebPage::SetPageSuppressed.
    • Added m_processSuppressionEnabled, to cache preference state.
  • WebProcess/WebPage/WebPage.messages.in:
    • Removed WebPage::SetPageSuppressed.
Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r209088 r209102  
     12016-11-29  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Remove WebPage::SetPageSuppressed
     4        https://bugs.webkit.org/show_bug.cgi?id=165158
     5
     6        Reviewed by Tim Horton.
     7
     8        This was scaffolding. We've now refactored to the point that the information driving throttling originates
     9        from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
     10        don't need a separate message to handle this - necessary state to determine is provided in ActivityState.
     11
     12        * UIProcess/WebPageProxy.cpp:
     13        (WebKit::WebPageProxy::updateThrottleState):
     14            - used to send SetPageSuppressed; no longer does.
     15        * UIProcess/WebPageProxy.h:
     16            - removed m_pageSuppressed (was used to avoid duplicated messages).
     17        * WebProcess/WebPage/WebPage.cpp:
     18        (WebKit::WebPage::updateThrottleState):
     19            - compute throttle state based on m_activityState.
     20        (WebKit::WebPage::setActivityState):
     21            - update throttle state whenever activity state changes.
     22        (WebKit::WebPage::updatePreferences):
     23            - update throttle state whenever preferences change (throttling can be disabled via preference).
     24        (WebKit::WebPage::setPageSuppressed): Deleted.
     25            - Removed WebPage::SetPageSuppressed.
     26        * WebProcess/WebPage/WebPage.h:
     27            - Removed WebPage::SetPageSuppressed.
     28            - Added m_processSuppressionEnabled, to cache preference state.
     29        * WebProcess/WebPage/WebPage.messages.in:
     30            - Removed WebPage::SetPageSuppressed.
     31
    1322016-11-29  Andy Estes  <aestes@apple.com>
    233
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r209082 r209102  
    16101610        m_preventProcessSuppressionCount = nullptr;
    16111611
    1612     // We should suppress if the page is not active, is visually idle, and supression is enabled.
    1613     bool isLoading = m_activityState & ActivityState::IsLoading;
    1614     bool isPlayingAudio = m_activityState & ActivityState::IsAudible;
    1615     bool pageShouldBeSuppressed = !isLoading && !isPlayingAudio && processSuppressionEnabled && (m_activityState & ActivityState::IsVisuallyIdle);
    1616     if (m_pageSuppressed != pageShouldBeSuppressed) {
    1617         m_pageSuppressed = pageShouldBeSuppressed;
    1618         m_process->send(Messages::WebPage::SetPageSuppressed(m_pageSuppressed), m_pageID);
    1619     }
    1620 
    16211612    if (m_activityState & ActivityState::IsVisuallyIdle)
    16221613        m_pageIsUserObservableCount = nullptr;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r209082 r209102  
    17641764    DownloadID m_syncNavigationActionPolicyDownloadID;
    17651765    bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
    1766     bool m_pageSuppressed { false };
    17671766
    17681767    Deque<NativeWebKeyboardEvent> m_keyEventQueue;
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r209057 r209102  
    10891089                762B748D120BC75C00819339 /* WKPreferencesRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10901090                7A5E394A1D5BD8BE00B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb in Resources */ = {isa = PBXBuildFile; fileRef = 7A5E39491D5BD8A700B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb */; };
    1091                 7A772C8D1DDD4A25000F34F1 /* com.apple.WebKit.plugin-common.sb in Resources */ = {isa = PBXBuildFile; fileRef = 7A1506721DD56298001F4B58 /* com.apple.WebKit.plugin-common.sb */; };
     1091                7A772C8D1DDD4A25000F34F1 /* com.apple.WebKit.plugin-common.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7A1506721DD56298001F4B58 /* com.apple.WebKit.plugin-common.sb */; };
    10921092                7A791EFA1C7CFCF100C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */; };
    10931093                7A791EFB1C7CFD0100C4C52B /* WebResourceLoadStatisticsStoreMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */; };
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r208985 r209102  
    325325    , m_layerVolatilityTimer(*this, &WebPage::layerVolatilityTimerFired)
    326326    , m_activityState(parameters.activityState)
     327    , m_processSuppressionEnabled(true)
    327328    , m_userActivity("Process suppression disabled for page.")
    328329    , m_userActivityHysteresis([this](HysteresisState) { updateUserActivity(); })
     
    439440    if (!isVisible())
    440441        m_page->setIsPrerender();
    441     setPageSuppressed(false);
    442442
    443443    updateIsInWindow(true);
     
    526526}
    527527
    528 void WebPage::setPageSuppressed(bool pageSuppressed)
    529 {
     528void WebPage::updateThrottleState()
     529{
     530    // We should suppress if the page is not active, is visually idle, and supression is enabled.
     531    bool isLoading = m_activityState & ActivityState::IsLoading;
     532    bool isPlayingAudio = m_activityState & ActivityState::IsAudible;
     533    bool pageSuppressed = !isLoading && !isPlayingAudio && m_processSuppressionEnabled && (m_activityState & ActivityState::IsVisuallyIdle);
     534
    530535    // The UserActivity keeps the processes runnable. So if the page should be suppressed, stop the activity.
    531536    // If the page should not be supressed, start it.
     
    25452550    m_activityState = activityState;
    25462551
     2552    if (!changed)
     2553        return;
     2554        updateThrottleState();
     2555
    25472556    m_page->setActivityState(activityState);
    25482557    for (auto* pluginView : m_pluginViews)
     
    31963205#endif
    31973206
     3207    bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
     3208    if (m_processSuppressionEnabled != processSuppressionEnabled) {
     3209        m_processSuppressionEnabled = processSuppressionEnabled;
     3210        updateThrottleState();
     3211    }
     3212
    31983213    platformPreferencesDidChange(store);
    31993214
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r208985 r209102  
    930930    bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
    931931
    932     void setPageSuppressed(bool);
    933 
    934932    void postMessage(const String& messageName, API::Object* messageBody);
    935933    void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
     
    979977    WebPage(uint64_t pageID, const WebPageCreationParameters&);
    980978
     979    void updateThrottleState();
    981980    void updateUserActivity();
    982981
     
    14911490    WebCore::ActivityState::Flags m_activityState;
    14921491
     1492    bool m_processSuppressionEnabled;
    14931493    UserActivity m_userActivity;
    14941494    WebCore::HysteresisActivity m_userActivityHysteresis;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r208985 r209102  
    2525    SetActivityState(unsigned activityState, bool wantsDidUpdateActivityState, Vector<uint64_t> callbackIDs)
    2626    SetLayerHostingMode(enum WebKit::LayerHostingMode layerHostingMode)
    27     SetPageSuppressed(bool pageSuppressed)
    2827
    2928    SetDrawsBackground(bool drawsBackground)
Note: See TracChangeset for help on using the changeset viewer.