<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161319] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161319">161319</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2014-01-05 00:28:30 -0800 (Sun, 05 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move process suppression of WebProcess to Page (from UIProcess)
https://bugs.webkit.org/show_bug.cgi?id=126480

Reviewed by Sam Weinig.

Let each page take a UserActivity rather than having to coalesce this state, and take different activity
tokens for normal visibility and suppression disabled, so we can see why the process is not suppressed.

Source/WebCore: 

* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::setIsVisuallyIdle):
* page/Page.h:
    - setThrottled -&gt; setIsVisuallyIdle.
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
    - Initialize m_visuallyNonIdle.
(WebCore::PageThrottler::~PageThrottler):
    - setThrottled -&gt; setIsVisuallyIdle.
(WebCore::PageThrottler::setIsVisuallyIdle):
    - Use m_visuallyNonIdle to disable supression when the page is not visually idle.
* page/PageThrottler.h:
    - setThrottled -&gt; setIsVisuallyIdle, added m_visuallyNonIdle.

Source/WebKit2: 

* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::platformInitialize):
    - Don't start with process supression disabled; this is unnecessary,
      message from the UIProcess should wake.
* UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::updateProcessSuppressionState):
    - Don't send explicit messages to supress the WebProcess, it handles this for itself.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
    - call setIsVisuallyIdle.
(WebKit::WebPage::setViewState):
    - call setIsVisuallyIdle.
(WebKit::WebPage::updatePreferences):
    - Use m_suppressionDisabled to disable supression if the WebPreference is set.
(WebKit::WebPage::setIsVisuallyIdle):
    - setThrottled -&gt; setIsVisuallyIdle.
* WebProcess/WebPage/WebPage.h:
    - setThrottled -&gt; setIsVisuallyIdle, added m_suppressionDisabled.
* WebProcess/WebProcess.cpp:
* WebProcess/WebProcess.h:
(WebKit::WebProcess::shouldForceScreenFontSubstitution):
    - Removed setProcessSuppressionEnabled - WebPage now detects the supression change.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebCorepagePageThrottlercpp">trunk/Source/WebCore/page/PageThrottler.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageThrottlerh">trunk/Source/WebCore/page/PageThrottler.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacChildProcessMacmm">trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebProcessProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebCore/ChangeLog        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-01-05  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        Move process suppression of WebProcess to Page (from UIProcess)
+        https://bugs.webkit.org/show_bug.cgi?id=126480
+
+        Reviewed by Sam Weinig.
+
+        Let each page take a UserActivity rather than having to coalesce this state, and take different activity
+        tokens for normal visibility and suppression disabled, so we can see why the process is not suppressed.
+
+        * WebCore.exp.in:
+        * page/Page.cpp:
+        (WebCore::Page::setIsVisuallyIdle):
+        * page/Page.h:
+            - setThrottled -&gt; setIsVisuallyIdle.
+        * page/PageThrottler.cpp:
+        (WebCore::PageThrottler::PageThrottler):
+            - Initialize m_visuallyNonIdle.
+        (WebCore::PageThrottler::~PageThrottler):
+            - setThrottled -&gt; setIsVisuallyIdle.
+        (WebCore::PageThrottler::setIsVisuallyIdle):
+            - Use m_visuallyNonIdle to disable supression when the page is not visually idle.
+        * page/PageThrottler.h:
+            - setThrottled -&gt; setIsVisuallyIdle, added m_visuallyNonIdle.
+
</ins><span class="cx"> 2014-01-04  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Move a few more functions from RenderBlock to RenderBlockFlow
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -968,7 +968,6 @@
</span><span class="cx"> __ZN7WebCore4Page11PageClientsD1Ev
</span><span class="cx"> __ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore4Page12setIsVisibleEbb
</span><del>-__ZN7WebCore4Page12setThrottledEb
</del><span class="cx"> __ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj
</span><span class="cx"> __ZN7WebCore4Page13setIsInWindowEb
</span><span class="cx"> __ZN7WebCore4Page13setPaginationERKNS_10PaginationE
</span><span class="lines">@@ -978,6 +977,7 @@
</span><span class="cx"> __ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
</span><span class="cx"> __ZN7WebCore4Page16setCanStartMediaEb
</span><span class="cx"> __ZN7WebCore4Page16setDefersLoadingEb
</span><ins>+__ZN7WebCore4Page17setIsVisuallyIdleEb
</ins><span class="cx"> __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
</span><span class="cx"> __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
</span><span class="cx"> __ZN7WebCore4Page19addFooterWithHeightEi
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebCore/page/Page.cpp        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -909,9 +909,9 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Page::setThrottled(bool throttled)
</del><ins>+void Page::setIsVisuallyIdle(bool isVisuallyIdle)
</ins><span class="cx"> {
</span><del>-    m_pageThrottler-&gt;setThrottled(throttled);
</del><ins>+    m_pageThrottler-&gt;setIsVisuallyIdle(isVisuallyIdle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Page::userStyleSheetLocationChanged()
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebCore/page/Page.h        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -305,7 +305,7 @@
</span><span class="cx">     void suspendScriptedAnimations();
</span><span class="cx">     void resumeScriptedAnimations();
</span><span class="cx">     bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
</span><del>-    void setThrottled(bool);
</del><ins>+    void setIsVisuallyIdle(bool);
</ins><span class="cx"> 
</span><span class="cx">     void userStyleSheetLocationChanged();
</span><span class="cx">     const String&amp; userStyleSheet() const;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageThrottlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageThrottler.cpp (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageThrottler.cpp        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebCore/page/PageThrottler.cpp        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -41,13 +41,14 @@
</span><span class="cx">     : m_page(page)
</span><span class="cx">     , m_throttleState(PageNotThrottledState)
</span><span class="cx">     , m_throttleHysteresisTimer(this, &amp;PageThrottler::throttleHysteresisTimerFired)
</span><ins>+    , m_visuallyNonIdle(&quot;Page is not visually idle.&quot;)
</ins><span class="cx"> {
</span><span class="cx">     m_page.chrome().client().incrementActivePageCount();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PageThrottler::~PageThrottler()
</span><span class="cx"> {
</span><del>-    setThrottled(false);
</del><ins>+    setIsVisuallyIdle(false);
</ins><span class="cx"> 
</span><span class="cx">     for (auto it = m_activityTokens.begin(), end = m_activityTokens.end(); it != end; ++it)
</span><span class="cx">         (*it)-&gt;invalidate();
</span><span class="lines">@@ -94,14 +95,18 @@
</span><span class="cx">     m_page.unthrottleTimers();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageThrottler::setThrottled(bool isThrottled)
</del><ins>+void PageThrottler::setIsVisuallyIdle(bool isVisuallyIdle)
</ins><span class="cx"> {
</span><del>-    if (isThrottled) {
</del><ins>+    if (isVisuallyIdle) {
</ins><span class="cx">         m_throttleState = PageWaitingToThrottleState;
</span><span class="cx">         startThrottleHysteresisTimer();
</span><ins>+        if (m_visuallyNonIdle.isActive())
+            m_visuallyNonIdle.endActivity();
</ins><span class="cx">     } else {
</span><span class="cx">         unthrottlePage();
</span><span class="cx">         stopThrottleHysteresisTimer();
</span><ins>+        if (!m_visuallyNonIdle.isActive())
+            m_visuallyNonIdle.beginActivity();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageThrottlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageThrottler.h (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageThrottler.h        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebCore/page/PageThrottler.h        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> 
</span><ins>+#include &lt;WebCore/UserActivity.h&gt;
</ins><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/PassOwnPtr.h&gt;
</span><span class="lines">@@ -47,7 +48,7 @@
</span><span class="cx">     bool shouldThrottleAnimations() const { return m_throttleState != PageNotThrottledState; }
</span><span class="cx">     bool shouldThrottleTimers() const { return m_throttleState != PageNotThrottledState; }
</span><span class="cx"> 
</span><del>-    void setThrottled(bool);
</del><ins>+    void setIsVisuallyIdle(bool);
</ins><span class="cx"> 
</span><span class="cx">     void reportInterestingEvent();
</span><span class="cx"> 
</span><span class="lines">@@ -73,6 +74,7 @@
</span><span class="cx">     PageThrottleState m_throttleState;
</span><span class="cx">     Timer&lt;PageThrottler&gt; m_throttleHysteresisTimer;
</span><span class="cx">     HashSet&lt;PageActivityAssertionToken*&gt; m_activityTokens;
</span><ins>+    UserActivity m_visuallyNonIdle;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2014-01-05  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        Move process suppression of WebProcess to Page (from UIProcess)
+        https://bugs.webkit.org/show_bug.cgi?id=126480
+
+        Reviewed by Sam Weinig.
+
+        Let each page take a UserActivity rather than having to coalesce this state, and take different activity
+        tokens for normal visibility and suppression disabled, so we can see why the process is not suppressed.
+
+        * Shared/mac/ChildProcessMac.mm:
+        (WebKit::ChildProcess::platformInitialize):
+            - Don't start with process supression disabled; this is unnecessary,
+              message from the UIProcess should wake.
+        * UIProcess/mac/WebProcessProxyMac.mm:
+        (WebKit::WebProcessProxy::updateProcessSuppressionState):
+            - Don't send explicit messages to supress the WebProcess, it handles this for itself.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+            - call setIsVisuallyIdle.
+        (WebKit::WebPage::setViewState):
+            - call setIsVisuallyIdle.
+        (WebKit::WebPage::updatePreferences):
+            - Use m_suppressionDisabled to disable supression if the WebPreference is set.
+        (WebKit::WebPage::setIsVisuallyIdle):
+            - setThrottled -&gt; setIsVisuallyIdle.
+        * WebProcess/WebPage/WebPage.h:
+            - setThrottled -&gt; setIsVisuallyIdle, added m_suppressionDisabled.
+        * WebProcess/WebProcess.cpp:
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::shouldForceScreenFontSubstitution):
+            - Removed setProcessSuppressionEnabled - WebPage now detects the supression change.
+
</ins><span class="cx"> 2014-01-04  Martin Robinson  &lt;mrobinson@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] [CMake] Improve the way we locate gobject-introspection
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacChildProcessMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -88,8 +88,6 @@
</span><span class="cx"> #if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx">     initializeTimerCoalescingPolicy();
</span><span class="cx"> #endif
</span><del>-    // Start with process suppression disabled.
-    m_processSuppressionDisabled.beginActivity();
</del><span class="cx"> 
</span><span class="cx">     [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] bundlePath]];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebProcessProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -74,8 +74,6 @@
</span><span class="cx">         return;
</span><span class="cx">     m_processSuppressionEnabled = canEnable;
</span><span class="cx"> 
</span><del>-    connection()-&gt;send(Messages::WebProcess::SetProcessSuppressionEnabled(m_processSuppressionEnabled), 0);
-
</del><span class="cx">     m_context-&gt;updateProcessSuppressionState();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -282,6 +282,7 @@
</span><span class="cx">     , m_scrollPinningBehavior(DoNotPin)
</span><span class="cx">     , m_useAsyncScrolling(false)
</span><span class="cx">     , m_viewState(parameters.viewState)
</span><ins>+    , m_processSuppressionDisabledByWebPreference(&quot;Process suppression is disabled.&quot;)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_pageID);
</span><span class="cx">     // FIXME: This is a non-ideal location for this Setting and
</span><span class="lines">@@ -425,6 +426,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     m_page-&gt;setIsVisible(m_viewState &amp; ViewState::IsVisible, true);
</span><ins>+    setIsVisuallyIdle(m_viewState &amp; ViewState::IsVisuallyIdle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebPage::~WebPage()
</span><span class="lines">@@ -2080,6 +2082,8 @@
</span><span class="cx">         setActive(viewState &amp; ViewState::WindowIsActive);
</span><span class="cx">     if (changed &amp; ViewState::IsInWindow)
</span><span class="cx">         setIsInWindow(viewState &amp; ViewState::IsInWindow);
</span><ins>+    if (changed &amp; ViewState::IsVisuallyIdle)
+        setIsVisuallyIdle(viewState &amp; ViewState::IsVisuallyIdle);
</ins><span class="cx"> 
</span><span class="cx">     for (auto* pluginView : m_pluginViews)
</span><span class="cx">         pluginView-&gt;viewStateDidChange(changed);
</span><span class="lines">@@ -2543,6 +2547,14 @@
</span><span class="cx">     settings.setMediaSourceEnabled(store.getBoolValueForKey(WebPreferencesKey::mediaSourceEnabledKey()));
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    if (store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey())) {
+        if (m_processSuppressionDisabledByWebPreference.isActive())
+            m_processSuppressionDisabledByWebPreference.endActivity();
+    } else {
+        if (!m_processSuppressionDisabledByWebPreference.isActive())
+            m_processSuppressionDisabledByWebPreference.beginActivity();
+    }
+
</ins><span class="cx">     platformPreferencesDidChange(store);
</span><span class="cx"> 
</span><span class="cx">     if (m_drawingArea)
</span><span class="lines">@@ -3670,10 +3682,9 @@
</span><span class="cx">         m_page-&gt;setIsPrerender();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::setThrottled(bool isThrottled)
</del><ins>+void WebPage::setIsVisuallyIdle(bool isVisuallyIdle)
</ins><span class="cx"> {
</span><del>-    if (m_page)
-        m_page-&gt;setThrottled(isThrottled);
</del><ins>+    m_page-&gt;setIsVisuallyIdle(isVisuallyIdle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> #include &lt;WebCore/PlatformScreen.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScrollTypes.h&gt;
</span><span class="cx"> #include &lt;WebCore/TextChecking.h&gt;
</span><ins>+#include &lt;WebCore/UserActivity.h&gt;
</ins><span class="cx"> #include &lt;WebCore/WebCoreKeyboardUIMode.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="lines">@@ -615,7 +616,6 @@
</span><span class="cx"> 
</span><span class="cx">     void setVisibilityStatePrerender();
</span><span class="cx">     void updateVisibilityState(bool isInitialState = false);
</span><del>-    void setThrottled(bool isThrottled);
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     void didFinishScrolling(const WebCore::FloatPoint&amp; contentOffset);
</span><span class="lines">@@ -731,6 +731,7 @@
</span><span class="cx">     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&amp;);
</span><span class="cx">     void setWindowResizerSize(const WebCore::IntSize&amp;);
</span><span class="cx">     void setIsInWindow(bool);
</span><ins>+    void setIsVisuallyIdle(bool);
</ins><span class="cx">     void setViewState(ViewState::Flags, bool wantsDidUpdateViewState);
</span><span class="cx">     void validateCommand(const String&amp;, uint64_t);
</span><span class="cx">     void executeEditCommand(const String&amp;);
</span><span class="lines">@@ -1045,6 +1046,8 @@
</span><span class="cx">     bool m_useAsyncScrolling;
</span><span class="cx"> 
</span><span class="cx">     ViewState::Flags m_viewState;
</span><ins>+
+    UserActivity m_processSuppressionDisabledByWebPreference;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -548,19 +548,6 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-#if PLATFORM(MAC)
-void WebProcess::setProcessSuppressionEnabled(bool processSuppressionEnabled)
-{
-    HashMap&lt;uint64_t, RefPtr&lt;WebPage&gt;&gt;::const_iterator end = m_pageMap.end();
-    for (HashMap&lt;uint64_t, RefPtr&lt;WebPage&gt;&gt;::const_iterator it = m_pageMap.begin(); it != end; ++it) {
-        WebPage* page = (*it).value.get();
-        page-&gt;setThrottled(processSuppressionEnabled);
-    }
-    
-    ChildProcess::setProcessSuppressionEnabled(processSuppressionEnabled);
-}
-#endif
-
</del><span class="cx"> WebPage* WebProcess::webPage(uint64_t pageID) const
</span><span class="cx"> {
</span><span class="cx">     return m_pageMap.get(pageID);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (161318 => 161319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2014-01-05 07:29:27 UTC (rev 161318)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2014-01-05 08:28:30 UTC (rev 161319)
</span><span class="lines">@@ -137,8 +137,6 @@
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     pid_t presenterApplicationPid() const { return m_presenterApplicationPid; }
</span><span class="cx">     bool shouldForceScreenFontSubstitution() const { return m_shouldForceScreenFontSubstitution; }
</span><del>-
-    void setProcessSuppressionEnabled(bool);
</del><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx">     const TextCheckerState&amp; textCheckerState() const { return m_textCheckerState; }
</span></span></pre>
</div>
</div>

</body>
</html>