<!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>[177396] 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/177396">177396</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2014-12-16 14:28:49 -0800 (Tue, 16 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move Mac process suppression from WebCore to WebKit2
https://bugs.webkit.org/show_bug.cgi?id=139705
Reviewed by Geoff Garen.
Currently PageThrottler constructs the PageActivityState, holds a copy of the ViewState,
and an optional UserActivity.
Instead, still construct the PageActivityState but just pass this out via the Page to WebPage.
Logic From PageThrottler::updateUserActivity merged into WebPage::updateUserActivity.
Source/WebCore:
* WebCore.exp.in:
- removed createUserActivity.
* page/ChromeClient.h:
(WebCore::ChromeClient::setPageActivityState):
- added to propagate PageActivityState to WebPage.
* page/Page.cpp:
(WebCore::Page::Page):
- PageThrottler constructor now takes a Page&.
(WebCore::Page::setViewState):
- no longer necessary to pass this to PageThrottler.
(WebCore::Page::setPageActivityState):
- added to propagate PageActivityState to WebPage.
(WebCore::Page::enablePageThrottler): Deleted.
- PageThrottler no longer has a UserActivity.
* page/Page.h:
(WebCore::Page::pageThrottler):
- added setPageActivityState, removed enablePageThrottler.
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
- removed m_viewState, added m_page.
(WebCore::PageThrottler::setActivityFlag):
- propagate PageActivityState via Page to WebPage.
(WebCore::PageThrottler::createUserActivity): Deleted.
(WebCore::PageThrottler::updateUserActivity): Deleted.
(WebCore::PageThrottler::setViewState): Deleted.
- removed; PageThrottler no longer has a PageThrottler or UserActivity.
* page/PageThrottler.h:
- removed createUserActivity, setViewState, m_viewState, m_activity; added m_page.
Source/WebKit2:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setPageActivityState):
- added to propagate PageActivityState to WebPage.
* WebProcess/WebCoreSupport/WebChromeClient.h:
- added setPageActivityState to propagate PageActivityState to WebPage.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
- calls to updateUserActivity.
(WebKit::WebPage::setPageActivityState):
- calls to updateUserActivity.
(WebKit::WebPage::updateUserActivity):
- incorporate logic from PageThrottler::updateUserActivity.
(WebKit::WebPage::setViewState):
- calls to updateUserActivity.
(WebKit::WebPage::updatePreferences):
- calls to updateUserActivity.
* WebProcess/WebPage/WebPage.h:
- added setPageActivityState, m_activityState.</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="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</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="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/ChangeLog        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2014-12-16 Gavin Barraclough <barraclough@apple.com>
+
+ Move Mac process suppression from WebCore to WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=139705
+
+ Reviewed by Geoff Garen.
+
+ Currently PageThrottler constructs the PageActivityState, holds a copy of the ViewState,
+ and an optional UserActivity.
+
+ Instead, still construct the PageActivityState but just pass this out via the Page to WebPage.
+ Logic From PageThrottler::updateUserActivity merged into WebPage::updateUserActivity.
+
+ * WebCore.exp.in:
+ - removed createUserActivity.
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::setPageActivityState):
+ - added to propagate PageActivityState to WebPage.
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ - PageThrottler constructor now takes a Page&.
+ (WebCore::Page::setViewState):
+ - no longer necessary to pass this to PageThrottler.
+ (WebCore::Page::setPageActivityState):
+ - added to propagate PageActivityState to WebPage.
+ (WebCore::Page::enablePageThrottler): Deleted.
+ - PageThrottler no longer has a UserActivity.
+ * page/Page.h:
+ (WebCore::Page::pageThrottler):
+ - added setPageActivityState, removed enablePageThrottler.
+ * page/PageThrottler.cpp:
+ (WebCore::PageThrottler::PageThrottler):
+ - removed m_viewState, added m_page.
+ (WebCore::PageThrottler::setActivityFlag):
+ - propagate PageActivityState via Page to WebPage.
+ (WebCore::PageThrottler::createUserActivity): Deleted.
+ (WebCore::PageThrottler::updateUserActivity): Deleted.
+ (WebCore::PageThrottler::setViewState): Deleted.
+ - removed; PageThrottler no longer has a PageThrottler or UserActivity.
+ * page/PageThrottler.h:
+ - removed createUserActivity, setViewState, m_viewState, m_activity; added m_page.
+
</ins><span class="cx"> 2014-12-16 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix after r177375; explicitly cast to NSUInteger.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -1159,7 +1159,6 @@
</span><span class="cx"> __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointEb
</span><span class="cx"> __ZN7WebCore4Page18setTopContentInsetEf
</span><span class="cx"> __ZN7WebCore4Page19addLayoutMilestonesEj
</span><del>-__ZN7WebCore4Page19enablePageThrottlerEv
</del><span class="cx"> __ZN7WebCore4Page19setVisitedLinkStoreEON3WTF3RefINS_16VisitedLinkStoreEEE
</span><span class="cx"> __ZN7WebCore4Page20scrollingCoordinatorEv
</span><span class="cx"> __ZN7WebCore4Page20setDeviceScaleFactorEf
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/page/ChromeClient.h        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "HTMLMediaElement.h"
</span><span class="cx"> #include "HostWindow.h"
</span><span class="cx"> #include "LayerFlushThrottleState.h"
</span><ins>+#include "PageThrottler.h"
</ins><span class="cx"> #include "PopupMenu.h"
</span><span class="cx"> #include "PopupMenuClient.h"
</span><span class="cx"> #include "RenderEmbeddedObject.h"
</span><span class="lines">@@ -432,6 +433,7 @@
</span><span class="cx"> virtual bool shouldUseTiledBackingForFrameView(const FrameView*) const { return false; }
</span><span class="cx">
</span><span class="cx"> virtual void isPlayingAudioDidChange(bool) { }
</span><ins>+ virtual void setPageActivityState(PageActivityState::Flags) { }
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> virtual bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const { return false; }
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/page/Page.cpp        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> , m_alternativeTextClient(pageConfiguration.alternativeTextClient)
</span><span class="cx"> , m_scriptedAnimationsSuspended(false)
</span><del>- , m_pageThrottler(m_viewState)
</del><ins>+ , m_pageThrottler(*this)
</ins><span class="cx"> , m_consoleClient(std::make_unique<PageConsoleClient>(*this))
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> , m_inspectorDebuggable(std::make_unique<PageDebuggable>(*this))
</span><span class="lines">@@ -1260,11 +1260,6 @@
</span><span class="cx"> view->resumeVisibleImageAnimationsIncludingSubframes();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Page::enablePageThrottler()
-{
- m_pageThrottler.createUserActivity();
-}
-
</del><span class="cx"> void Page::setViewState(ViewState::Flags viewState)
</span><span class="cx"> {
</span><span class="cx"> ViewState::Flags changed = m_viewState ^ viewState;
</span><span class="lines">@@ -1275,7 +1270,6 @@
</span><span class="cx">
</span><span class="cx"> m_viewState = viewState;
</span><span class="cx"> m_focusController->setViewState(viewState);
</span><del>- m_pageThrottler.setViewState(viewState);
</del><span class="cx">
</span><span class="cx"> if (changed & ViewState::IsVisible)
</span><span class="cx"> setIsVisibleInternal(viewState & ViewState::IsVisible);
</span><span class="lines">@@ -1288,6 +1282,11 @@
</span><span class="cx"> observer->viewStateDidChange(oldViewState, m_viewState);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Page::setPageActivityState(PageActivityState::Flags activityState)
+{
+ chrome().client().setPageActivityState(activityState);
+}
+
</ins><span class="cx"> void Page::setIsVisible(bool isVisible)
</span><span class="cx"> {
</span><span class="cx"> if (isVisible)
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/page/Page.h        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -291,6 +291,7 @@
</span><span class="cx">
</span><span class="cx"> // Notifications when the Page starts and stops being presented via a native window.
</span><span class="cx"> WEBCORE_EXPORT void setViewState(ViewState::Flags);
</span><ins>+ void setPageActivityState(PageActivityState::Flags);
</ins><span class="cx"> WEBCORE_EXPORT void setIsVisible(bool);
</span><span class="cx"> WEBCORE_EXPORT void setIsPrerender();
</span><span class="cx"> bool isVisible() const { return m_viewState & ViewState::IsVisible; }
</span><span class="lines">@@ -382,7 +383,6 @@
</span><span class="cx"> void resetSeenMediaEngines();
</span><span class="cx">
</span><span class="cx"> PageThrottler& pageThrottler() { return m_pageThrottler; }
</span><del>- WEBCORE_EXPORT void enablePageThrottler();
</del><span class="cx">
</span><span class="cx"> PageConsoleClient& console() { return *m_consoleClient; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageThrottlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageThrottler.cpp (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageThrottler.cpp        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/page/PageThrottler.cpp        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -26,10 +26,12 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "PageThrottler.h"
</span><span class="cx">
</span><ins>+#include "Page.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-PageThrottler::PageThrottler(ViewState::Flags viewState)
- : m_viewState(viewState)
</del><ins>+PageThrottler::PageThrottler(Page& page)
+ : m_page(page)
</ins><span class="cx"> , m_userInputHysteresis([this](HysteresisState state) { setActivityFlag(PageActivityState::UserInputActivity, state == HysteresisState::Started); })
</span><span class="cx"> , m_audiblePluginHysteresis([this](HysteresisState state) { setActivityFlag(PageActivityState::AudiblePlugin, state == HysteresisState::Started); })
</span><span class="cx"> , m_mediaActivityCounter([this]() { setActivityFlag(PageActivityState::MediaActivity, m_mediaActivityCounter.value()); })
</span><span class="lines">@@ -37,13 +39,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PageThrottler::createUserActivity()
-{
- ASSERT(!m_activity);
- m_activity = std::make_unique<UserActivity>("Page is active.");
- updateUserActivity();
-}
-
</del><span class="cx"> PageActivityAssertionToken PageThrottler::mediaActivityToken()
</span><span class="cx"> {
</span><span class="cx"> return m_mediaActivityCounter.count();
</span><span class="lines">@@ -54,18 +49,6 @@
</span><span class="cx"> return m_pageLoadActivityCounter.count();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PageThrottler::updateUserActivity()
-{
- if (!m_activity)
- return;
-
- // Allow throttling if there is no page activity, and the page is visually idle.
- if (!m_activityState && m_viewState & ViewState::IsVisuallyIdle)
- m_activity->stop();
- else
- m_activity->start();
-}
-
</del><span class="cx"> void PageThrottler::setActivityFlag(PageActivityState::Flags flag, bool value)
</span><span class="cx"> {
</span><span class="cx"> PageActivityState::Flags activityState = m_activityState;
</span><span class="lines">@@ -78,16 +61,7 @@
</span><span class="cx"> return;
</span><span class="cx"> m_activityState = activityState;
</span><span class="cx">
</span><del>- updateUserActivity();
</del><ins>+ m_page.setPageActivityState(m_activityState);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void PageThrottler::setViewState(ViewState::Flags viewState)
-{
- ViewState::Flags changed = m_viewState ^ viewState;
- m_viewState = viewState;
-
- if (changed & ViewState::IsVisuallyIdle)
- updateUserActivity();
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorepagePageThrottlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageThrottler.h (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageThrottler.h        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebCore/page/PageThrottler.h        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class Page;
+
</ins><span class="cx"> typedef RefPtr<RefCounter::Count> PageActivityAssertionToken;
</span><span class="cx">
</span><span class="cx"> struct PageActivityState {
</span><span class="lines">@@ -53,27 +55,22 @@
</span><span class="cx"> class PageThrottler {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- PageThrottler(ViewState::Flags);
</del><ins>+ PageThrottler(Page&);
</ins><span class="cx">
</span><del>- void createUserActivity();
- void setViewState(ViewState::Flags);
-
</del><span class="cx"> void didReceiveUserInput() { m_userInputHysteresis.impulse(); }
</span><span class="cx"> void pluginDidEvaluateWhileAudioIsPlaying() { m_audiblePluginHysteresis.impulse(); }
</span><span class="cx"> PageActivityAssertionToken mediaActivityToken();
</span><span class="cx"> PageActivityAssertionToken pageLoadActivityToken();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- void updateUserActivity();
</del><span class="cx"> void setActivityFlag(PageActivityState::Flags, bool);
</span><span class="cx">
</span><del>- ViewState::Flags m_viewState;
</del><ins>+ Page& m_page;
</ins><span class="cx"> PageActivityState::Flags m_activityState { PageActivityState::NoFlags };
</span><span class="cx"> HysteresisActivity m_userInputHysteresis;
</span><span class="cx"> HysteresisActivity m_audiblePluginHysteresis;
</span><span class="cx"> RefCounter m_mediaActivityCounter;
</span><span class="cx"> RefCounter m_pageLoadActivityCounter;
</span><del>- std::unique_ptr<UserActivity> m_activity;
</del><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 (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-12-16 Gavin Barraclough <barraclough@apple.com>
+
+ Move Mac process suppression from WebCore to WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=139705
+
+ Reviewed by Geoff Garen.
+
+ Currently PageThrottler constructs the PageActivityState, holds a copy of the ViewState,
+ and an optional UserActivity.
+
+ Instead, still construct the PageActivityState but just pass this out via the Page to WebPage.
+ Logic From PageThrottler::updateUserActivity merged into WebPage::updateUserActivity.
+
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::setPageActivityState):
+ - added to propagate PageActivityState to WebPage.
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ - added setPageActivityState to propagate PageActivityState to WebPage.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ - calls to updateUserActivity.
+ (WebKit::WebPage::setPageActivityState):
+ - calls to updateUserActivity.
+ (WebKit::WebPage::updateUserActivity):
+ - incorporate logic from PageThrottler::updateUserActivity.
+ (WebKit::WebPage::setViewState):
+ - calls to updateUserActivity.
+ (WebKit::WebPage::updatePreferences):
+ - calls to updateUserActivity.
+ * WebProcess/WebPage/WebPage.h:
+ - added setPageActivityState, m_activityState.
+
</ins><span class="cx"> 2014-12-16 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> More StorageManager modernization
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -1045,6 +1045,11 @@
</span><span class="cx"> m_page->send(Messages::WebPageProxy::IsPlayingAudioDidChange(newIsPlayingAudio));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebChromeClient::setPageActivityState(PageActivityState::Flags activityState)
+{
+ m_page->setPageActivityState(activityState);
+}
+
</ins><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> bool WebChromeClient::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -295,6 +295,7 @@
</span><span class="cx"> virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) const override;
</span><span class="cx">
</span><span class="cx"> virtual void isPlayingAudioDidChange(bool) override;
</span><ins>+ virtual void setPageActivityState(WebCore::PageActivityState::Flags) override;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> virtual bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -440,7 +440,7 @@
</span><span class="cx"> m_page->setViewState(m_viewState);
</span><span class="cx"> if (!isVisible())
</span><span class="cx"> m_page->setIsPrerender();
</span><del>- m_page->enablePageThrottler();
</del><ins>+ updateUserActivity();
</ins><span class="cx">
</span><span class="cx"> updateIsInWindow(true);
</span><span class="cx">
</span><span class="lines">@@ -512,10 +512,20 @@
</span><span class="cx"> setLayerHostingMode(static_cast<unsigned>(parameters.layerHostingMode));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebPage::setPageActivityState(PageActivityState::Flags activityState)
+{
+ PageActivityState::Flags changed = m_activityState ^ activityState;
+ m_activityState = activityState;
+
+ if (changed)
+ updateUserActivity();
+}
+
</ins><span class="cx"> void WebPage::updateUserActivity()
</span><span class="cx"> {
</span><del>- // If process suppression is disabled, then start the activity to prevent AppNap.
- if (!m_processSuppressionEnabled)
</del><ins>+ // Start the activity to prevent AppNap if the page activity is in progress,
+ // the page is visible and non-idle, or process suppression is disabled.
+ if (m_activityState || !(m_viewState & ViewState::IsVisuallyIdle) || !m_processSuppressionEnabled)
</ins><span class="cx"> m_userActivity.start();
</span><span class="cx"> else
</span><span class="cx"> m_userActivity.stop();
</span><span class="lines">@@ -2328,6 +2338,9 @@
</span><span class="cx"> ViewState::Flags changed = m_viewState ^ viewState;
</span><span class="cx"> m_viewState = viewState;
</span><span class="cx">
</span><ins>+ if (changed)
+ updateUserActivity();
+
</ins><span class="cx"> m_page->setViewState(viewState);
</span><span class="cx"> for (auto* pluginView : m_pluginViews)
</span><span class="cx"> pluginView->viewStateDidChange(changed);
</span><span class="lines">@@ -2888,8 +2901,11 @@
</span><span class="cx"> settings.setServiceControlsEnabled(store.getBoolValueForKey(WebPreferencesKey::serviceControlsEnabledKey()));
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- m_processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
- updateUserActivity();
</del><ins>+ bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
+ if (m_processSuppressionEnabled != processSuppressionEnabled) {
+ m_processSuppressionEnabled = processSuppressionEnabled;
+ updateUserActivity();
+ }
</ins><span class="cx">
</span><span class="cx"> platformPreferencesDidChange(store);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (177395 => 177396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-12-16 22:07:16 UTC (rev 177395)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-12-16 22:28:49 UTC (rev 177396)
</span><span class="lines">@@ -861,6 +861,8 @@
</span><span class="cx"> void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
</span><span class="cx"> bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
</span><span class="cx">
</span><ins>+ void setPageActivityState(WebCore::PageActivityState::Flags);
+
</ins><span class="cx"> private:
</span><span class="cx"> WebPage(uint64_t pageID, const WebPageCreationParameters&);
</span><span class="cx">
</span><span class="lines">@@ -1315,6 +1317,7 @@
</span><span class="cx"> bool m_useAsyncScrolling;
</span><span class="cx">
</span><span class="cx"> WebCore::ViewState::Flags m_viewState;
</span><ins>+ WebCore::PageActivityState::Flags m_activityState;
</ins><span class="cx">
</span><span class="cx"> bool m_processSuppressionEnabled;
</span><span class="cx"> UserActivity m_userActivity;
</span></span></pre>
</div>
</div>
</body>
</html>