Title: [209102] trunk/Source/WebKit2
Revision
209102
Author
[email protected]
Date
2016-11-29 17:00:12 -0800 (Tue, 29 Nov 2016)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (209101 => 209102)


--- trunk/Source/WebKit2/ChangeLog	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-30 01:00:12 UTC (rev 209102)
@@ -1,3 +1,34 @@
+2016-11-29  Gavin Barraclough  <[email protected]>
+
+        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.
+
 2016-11-29  Andy Estes  <[email protected]>
 
         [Cocoa] Enable two clang warnings recommended by Xcode

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (209101 => 209102)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-30 01:00:12 UTC (rev 209102)
@@ -1609,15 +1609,6 @@
     else if (!m_preventProcessSuppressionCount)
         m_preventProcessSuppressionCount = nullptr;
 
-    // We should suppress if the page is not active, is visually idle, and supression is enabled.
-    bool isLoading = m_activityState & ActivityState::IsLoading;
-    bool isPlayingAudio = m_activityState & ActivityState::IsAudible;
-    bool pageShouldBeSuppressed = !isLoading && !isPlayingAudio && processSuppressionEnabled && (m_activityState & ActivityState::IsVisuallyIdle);
-    if (m_pageSuppressed != pageShouldBeSuppressed) {
-        m_pageSuppressed = pageShouldBeSuppressed;
-        m_process->send(Messages::WebPage::SetPageSuppressed(m_pageSuppressed), m_pageID);
-    }
-
     if (m_activityState & ActivityState::IsVisuallyIdle)
         m_pageIsUserObservableCount = nullptr;
     else if (!m_pageIsUserObservableCount)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (209101 => 209102)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-30 01:00:12 UTC (rev 209102)
@@ -1763,7 +1763,6 @@
     WebCore::PolicyAction m_syncNavigationActionPolicyAction;
     DownloadID m_syncNavigationActionPolicyDownloadID;
     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
-    bool m_pageSuppressed { false };
 
     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
     Deque<NativeWebWheelEvent> m_wheelEventQueue;

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (209101 => 209102)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-11-30 01:00:12 UTC (rev 209102)
@@ -1088,7 +1088,7 @@
 		75A8D2D6187D1C0E00C39C9E /* WKWebsiteDataStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A8D2D4187D1C0100C39C9E /* WKWebsiteDataStoreInternal.h */; };
 		762B748D120BC75C00819339 /* WKPreferencesRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7A5E394A1D5BD8BE00B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb in Resources */ = {isa = PBXBuildFile; fileRef = 7A5E39491D5BD8A700B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb */; };
-		7A772C8D1DDD4A25000F34F1 /* com.apple.WebKit.plugin-common.sb in Resources */ = {isa = PBXBuildFile; fileRef = 7A1506721DD56298001F4B58 /* com.apple.WebKit.plugin-common.sb */; };
+		7A772C8D1DDD4A25000F34F1 /* com.apple.WebKit.plugin-common.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7A1506721DD56298001F4B58 /* com.apple.WebKit.plugin-common.sb */; };
 		7A791EFA1C7CFCF100C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A791EF91C7CFB3700C4C52B /* WebResourceLoadStatisticsStoreMessageReceiver.cpp */; };
 		7A791EFB1C7CFD0100C4C52B /* WebResourceLoadStatisticsStoreMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A791EF81C7CFB1000C4C52B /* WebResourceLoadStatisticsStoreMessages.h */; };
 		7A791EFC1C7D08C500C4C52B /* WebResourceLoadStatisticsStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A9CD8C01C77984900D9F6C7 /* WebResourceLoadStatisticsStore.cpp */; };

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (209101 => 209102)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-30 01:00:12 UTC (rev 209102)
@@ -324,6 +324,7 @@
 #endif
     , m_layerVolatilityTimer(*this, &WebPage::layerVolatilityTimerFired)
     , m_activityState(parameters.activityState)
+    , m_processSuppressionEnabled(true)
     , m_userActivity("Process suppression disabled for page.")
     , m_userActivityHysteresis([this](HysteresisState) { updateUserActivity(); })
     , m_userInterfaceLayoutDirection(parameters.userInterfaceLayoutDirection)
@@ -438,7 +439,6 @@
     m_page->setActivityState(m_activityState);
     if (!isVisible())
         m_page->setIsPrerender();
-    setPageSuppressed(false);
 
     updateIsInWindow(true);
 
@@ -525,8 +525,13 @@
         setLayerHostingMode(parameters.layerHostingMode);
 }
 
-void WebPage::setPageSuppressed(bool pageSuppressed)
+void WebPage::updateThrottleState()
 {
+    // We should suppress if the page is not active, is visually idle, and supression is enabled.
+    bool isLoading = m_activityState & ActivityState::IsLoading;
+    bool isPlayingAudio = m_activityState & ActivityState::IsAudible;
+    bool pageSuppressed = !isLoading && !isPlayingAudio && m_processSuppressionEnabled && (m_activityState & ActivityState::IsVisuallyIdle);
+
     // The UserActivity keeps the processes runnable. So if the page should be suppressed, stop the activity.
     // If the page should not be supressed, start it.
     if (pageSuppressed)
@@ -2544,6 +2549,10 @@
     ActivityState::Flags changed = m_activityState ^ activityState;
     m_activityState = activityState;
 
+    if (!changed)
+        return;
+        updateThrottleState();
+
     m_page->setActivityState(activityState);
     for (auto* pluginView : m_pluginViews)
         pluginView->activityStateDidChange(changed);
@@ -3195,6 +3204,12 @@
     RuntimeEnabledFeatures::sharedFeatures().setIntersectionObserverEnabled(store.getBoolValueForKey(WebPreferencesKey::intersectionObserverEnabledKey()));
 #endif
 
+    bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
+    if (m_processSuppressionEnabled != processSuppressionEnabled) {
+        m_processSuppressionEnabled = processSuppressionEnabled;
+        updateThrottleState();
+    }
+
     platformPreferencesDidChange(store);
 
     if (m_drawingArea)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (209101 => 209102)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-11-30 01:00:12 UTC (rev 209102)
@@ -929,8 +929,6 @@
     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
 
-    void setPageSuppressed(bool);
-
     void postMessage(const String& messageName, API::Object* messageBody);
     void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
 
@@ -978,6 +976,7 @@
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
+    void updateThrottleState();
     void updateUserActivity();
 
     // IPC::MessageSender
@@ -1490,6 +1489,7 @@
 
     WebCore::ActivityState::Flags m_activityState;
 
+    bool m_processSuppressionEnabled;
     UserActivity m_userActivity;
     WebCore::HysteresisActivity m_userActivityHysteresis;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (209101 => 209102)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2016-11-30 00:06:50 UTC (rev 209101)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2016-11-30 01:00:12 UTC (rev 209102)
@@ -24,7 +24,6 @@
     SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, uint64_t callbackID)
     SetActivityState(unsigned activityState, bool wantsDidUpdateActivityState, Vector<uint64_t> callbackIDs)
     SetLayerHostingMode(enum WebKit::LayerHostingMode layerHostingMode)
-    SetPageSuppressed(bool pageSuppressed)
 
     SetDrawsBackground(bool drawsBackground)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to