No subject


Tue May 3 15:05:30 PDT 2016


foreground app. However, in the Safari case, the foreground app is Safari (UIProcess) and
the same policy does not apply to our foreground WebContent process unless we explicitly
make it so. This patch addresses the issue by taking a UserActivity when the tab is
active to prevent app nap.

[1] https://developer.apple.com/library/content/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/AppNap.html

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateThrottleState):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213648 => 213649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog	2017-03-09 18:53:05 UTC (rev 213648)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-09 18:54:01 UTC (rev 213649)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2017-03-09  Chris Dumez  &lt;cdumez at apple.com&gt;
+
+        [WK2] Prevent app nap for the active tab
+        https://bugs.webkit.org/show_bug.cgi?id=169417
+        &lt;rdar://problem/30876965&gt;
+
+        Reviewed by Gavin Barraclough.
+
+        Prevent app nap for the active tab to minimize the risks of breakage.
+
+        From the AppNap documentation [1], the app is only a candidate for app nap if it not the
+        foreground app. However, in the Safari case, the foreground app is Safari (UIProcess) and
+        the same policy does not apply to our foreground WebContent process unless we explicitly
+        make it so. This patch addresses the issue by taking a UserActivity when the tab is
+        active to prevent app nap.
+
+        [1] https://developer.apple.com/library/content/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/AppNap.html
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updateThrottleState):
+
</ins><span class="cx"> 2017-03-08  Anders Carlsson  &lt;andersca at apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add new delegate methods
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (213648 => 213649)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-03-09 18:53:05 UTC (rev 213648)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-03-09 18:54:01 UTC (rev 213649)
</span><span class="lines">@@ -576,7 +576,9 @@
</span><span class="cx">     // We should suppress if the page is not active, is visually idle, and supression is enabled.
</span><span class="cx">     bool isLoading = m_activityState &amp; ActivityState::IsLoading;
</span><span class="cx">     bool isPlayingAudio = m_activityState &amp; ActivityState::IsAudible;
</span><del>-    bool pageSuppressed = !isLoading &amp;&amp; !isPlayingAudio &amp;&amp; m_processSuppressionEnabled &amp;&amp; (m_activityState &amp; ActivityState::IsVisuallyIdle);
</del><ins>+    bool isVisuallyIdle = m_activityState &amp; ActivityState::IsVisuallyIdle;
+    bool windowIsActive = m_activityState &amp; ActivityState::WindowIsActive;
+    bool pageSuppressed = !windowIsActive &amp;&amp; !isLoading &amp;&amp; !isPlayingAudio &amp;&amp; m_processSuppressionEnabled &amp;&amp; isVisuallyIdle;
</ins><span class="cx"> 
</span><span class="cx">     // The UserActivity keeps the processes runnable. So if the page should be suppressed, stop the activity.
</span><span class="cx">     // If the page should not be supressed, start it.
</span></span></pre>
</div>
</div>

</body>
</html>


More information about the webkit-changes mailing list