Title: [208237] trunk/Source
Revision
208237
Author
barraclo...@apple.com
Date
2016-11-01 13:38:39 -0700 (Tue, 01 Nov 2016)

Log Message

Add IsAudible, IsLoading to ActivityState
https://bugs.webkit.org/show_bug.cgi?id=164286

Reviewed by Geoff Garen.

By computing these values in the UIProcess and passing them to WebContent we can
more closely unify iOS & macOS throttling, and remove the PageThrottler class.

Source/WebCore:

* page/ActivityState.h:
    - added IsAudible, IsLoading

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityState):
    - Added update for IsAudible, IsLoading flags.
(WebKit::WebPageProxy::updateThrottleState):
    - Read IsAudible, IsLoading flags from ActivityState.
(WebKit::WebPageProxy::setMuted):
    - call activityStateDidChange to trigger update.
(WebKit::WebPageProxy::isPlayingMediaDidChange):
    - call activityStateDidChange to trigger update.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isLoadingChanged):
    - call activityStateDidChange to trigger update.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208236 => 208237)


--- trunk/Source/WebCore/ChangeLog	2016-11-01 20:37:48 UTC (rev 208236)
+++ trunk/Source/WebCore/ChangeLog	2016-11-01 20:38:39 UTC (rev 208237)
@@ -1,3 +1,16 @@
+2016-11-01  Gavin Barraclough  <barraclo...@apple.com>
+
+        Add IsAudible, IsLoading to ActivityState
+        https://bugs.webkit.org/show_bug.cgi?id=164286
+
+        Reviewed by Geoff Garen.
+
+        By computing these values in the UIProcess and passing them to WebContent we can
+        more closely unify iOS & macOS throttling, and remove the PageThrottler class.
+
+        * page/ActivityState.h:
+            - added IsAudible, IsLoading
+
 2016-10-31  Gavin Barraclough  <barraclo...@apple.com>
 
         Rename ViewState to ActivityState

Modified: trunk/Source/WebCore/page/ActivityState.h (208236 => 208237)


--- trunk/Source/WebCore/page/ActivityState.h	2016-11-01 20:37:48 UTC (rev 208236)
+++ trunk/Source/WebCore/page/ActivityState.h	2016-11-01 20:38:39 UTC (rev 208237)
@@ -35,12 +35,14 @@
         IsVisibleOrOccluded = 1 << 3,
         IsInWindow = 1 << 4,
         IsVisuallyIdle = 1 << 5,
+        IsAudible = 1 << 6,
+        IsLoading = 1 << 7,
     };
 
     typedef unsigned Flags;
 
     static const Flags NoFlags = 0;
-    static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsVisibleOrOccluded | IsInWindow | IsVisuallyIdle;
+    static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsVisibleOrOccluded | IsInWindow | IsVisuallyIdle | IsAudible | IsLoading;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit2/ChangeLog (208236 => 208237)


--- trunk/Source/WebKit2/ChangeLog	2016-11-01 20:37:48 UTC (rev 208236)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-01 20:38:39 UTC (rev 208237)
@@ -1,3 +1,26 @@
+2016-11-01  Gavin Barraclough  <barraclo...@apple.com>
+
+        Add IsAudible, IsLoading to ActivityState
+        https://bugs.webkit.org/show_bug.cgi?id=164286
+
+        Reviewed by Geoff Garen.
+
+        By computing these values in the UIProcess and passing them to WebContent we can
+        more closely unify iOS & macOS throttling, and remove the PageThrottler class.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::updateActivityState):
+            - Added update for IsAudible, IsLoading flags.
+        (WebKit::WebPageProxy::updateThrottleState):
+            - Read IsAudible, IsLoading flags from ActivityState.
+        (WebKit::WebPageProxy::setMuted):
+            - call activityStateDidChange to trigger update.
+        (WebKit::WebPageProxy::isPlayingMediaDidChange):
+            - call activityStateDidChange to trigger update.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isLoadingChanged):
+            - call activityStateDidChange to trigger update.
+
 2016-10-31  Gavin Barraclough  <barraclo...@apple.com>
 
         Rename ViewState to ActivityState

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (208236 => 208237)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-01 20:37:48 UTC (rev 208236)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-01 20:38:39 UTC (rev 208237)
@@ -1464,6 +1464,10 @@
         m_activityState |= ActivityState::IsInWindow;
     if (flagsToUpdate & ActivityState::IsVisuallyIdle && m_pageClient.isVisuallyIdle())
         m_activityState |= ActivityState::IsVisuallyIdle;
+    if (flagsToUpdate & ActivityState::IsAudible && m_mediaState & MediaProducer::IsPlayingAudio && !(m_mutedState & MediaProducer::AudioIsMuted))
+        m_activityState |= ActivityState::IsAudible;
+    if (flagsToUpdate & ActivityState::IsLoading && m_pageLoadState.isLoading())
+        m_activityState |= ActivityState::IsLoading;
 }
 
 void WebPageProxy::activityStateDidChange(ActivityState::Flags mayHaveChanged, bool wantsSynchronousReply, ActivityStateChangeDispatchMode dispatchMode)
@@ -1590,8 +1594,8 @@
         m_preventProcessSuppressionCount = nullptr;
 
     // We should suppress if the page is not active, is visually idle, and supression is enabled.
-    bool isLoading = m_pageLoadState.isLoading();
-    bool isPlayingAudio = m_mediaState & MediaProducer::IsPlayingAudio && !(m_mutedState & MediaProducer::AudioIsMuted);
+    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;
@@ -4167,7 +4171,7 @@
 
     m_process->send(Messages::WebPage::SetMuted(state), m_pageID);
 
-    updateThrottleState();
+    activityStateDidChange(ActivityState::IsAudible);
 }
 
 #if ENABLE(MEDIA_SESSION)
@@ -6359,7 +6363,7 @@
     MediaProducer::MediaStateFlags oldState = m_mediaState;
     m_mediaState = state;
 
-    updateThrottleState();
+    activityStateDidChange(ActivityState::IsAudible);
 
     playingMediaMask |= MediaProducer::HasActiveMediaCaptureDevice;
     if ((oldState & playingMediaMask) != (m_mediaState & playingMediaMask))

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (208236 => 208237)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-01 20:37:48 UTC (rev 208236)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-01 20:38:39 UTC (rev 208237)
@@ -1142,7 +1142,7 @@
         
     WeakPtr<WebPageProxy> createWeakPtr() const { return m_weakPtrFactory.createWeakPtr(); }
 
-    void isLoadingChanged() { updateThrottleState(); }
+    void isLoadingChanged() { activityStateDidChange(WebCore::ActivityState::IsLoading); }
 
 private:
     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to