- Revision
- 161319
- Author
- [email protected]
- Date
- 2014-01-05 00:28:30 -0800 (Sun, 05 Jan 2014)
Log Message
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 -> setIsVisuallyIdle.
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
- Initialize m_visuallyNonIdle.
(WebCore::PageThrottler::~PageThrottler):
- setThrottled -> setIsVisuallyIdle.
(WebCore::PageThrottler::setIsVisuallyIdle):
- Use m_visuallyNonIdle to disable supression when the page is not visually idle.
* page/PageThrottler.h:
- setThrottled -> 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 -> setIsVisuallyIdle.
* WebProcess/WebPage/WebPage.h:
- setThrottled -> setIsVisuallyIdle, added m_suppressionDisabled.
* WebProcess/WebProcess.cpp:
* WebProcess/WebProcess.h:
(WebKit::WebProcess::shouldForceScreenFontSubstitution):
- Removed setProcessSuppressionEnabled - WebPage now detects the supression change.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (161318 => 161319)
--- 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)
@@ -1,3 +1,28 @@
+2014-01-05 Gavin Barraclough <[email protected]>
+
+ 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 -> setIsVisuallyIdle.
+ * page/PageThrottler.cpp:
+ (WebCore::PageThrottler::PageThrottler):
+ - Initialize m_visuallyNonIdle.
+ (WebCore::PageThrottler::~PageThrottler):
+ - setThrottled -> setIsVisuallyIdle.
+ (WebCore::PageThrottler::setIsVisuallyIdle):
+ - Use m_visuallyNonIdle to disable supression when the page is not visually idle.
+ * page/PageThrottler.h:
+ - setThrottled -> setIsVisuallyIdle, added m_visuallyNonIdle.
+
2014-01-04 Sam Weinig <[email protected]>
Move a few more functions from RenderBlock to RenderBlockFlow
Modified: trunk/Source/WebCore/WebCore.exp.in (161318 => 161319)
--- 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)
@@ -968,7 +968,6 @@
__ZN7WebCore4Page11PageClientsD1Ev
__ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
__ZN7WebCore4Page12setIsVisibleEbb
-__ZN7WebCore4Page12setThrottledEb
__ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj
__ZN7WebCore4Page13setIsInWindowEb
__ZN7WebCore4Page13setPaginationERKNS_10PaginationE
@@ -978,6 +977,7 @@
__ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
__ZN7WebCore4Page16setCanStartMediaEb
__ZN7WebCore4Page16setDefersLoadingEb
+__ZN7WebCore4Page17setIsVisuallyIdleEb
__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
__ZN7WebCore4Page19addFooterWithHeightEi
Modified: trunk/Source/WebCore/page/Page.cpp (161318 => 161319)
--- 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)
@@ -909,9 +909,9 @@
}
}
-void Page::setThrottled(bool throttled)
+void Page::setIsVisuallyIdle(bool isVisuallyIdle)
{
- m_pageThrottler->setThrottled(throttled);
+ m_pageThrottler->setIsVisuallyIdle(isVisuallyIdle);
}
void Page::userStyleSheetLocationChanged()
Modified: trunk/Source/WebCore/page/Page.h (161318 => 161319)
--- 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)
@@ -305,7 +305,7 @@
void suspendScriptedAnimations();
void resumeScriptedAnimations();
bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
- void setThrottled(bool);
+ void setIsVisuallyIdle(bool);
void userStyleSheetLocationChanged();
const String& userStyleSheet() const;
Modified: trunk/Source/WebCore/page/PageThrottler.cpp (161318 => 161319)
--- 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)
@@ -41,13 +41,14 @@
: m_page(page)
, m_throttleState(PageNotThrottledState)
, m_throttleHysteresisTimer(this, &PageThrottler::throttleHysteresisTimerFired)
+ , m_visuallyNonIdle("Page is not visually idle.")
{
m_page.chrome().client().incrementActivePageCount();
}
PageThrottler::~PageThrottler()
{
- setThrottled(false);
+ setIsVisuallyIdle(false);
for (auto it = m_activityTokens.begin(), end = m_activityTokens.end(); it != end; ++it)
(*it)->invalidate();
@@ -94,14 +95,18 @@
m_page.unthrottleTimers();
}
-void PageThrottler::setThrottled(bool isThrottled)
+void PageThrottler::setIsVisuallyIdle(bool isVisuallyIdle)
{
- if (isThrottled) {
+ if (isVisuallyIdle) {
m_throttleState = PageWaitingToThrottleState;
startThrottleHysteresisTimer();
+ if (m_visuallyNonIdle.isActive())
+ m_visuallyNonIdle.endActivity();
} else {
unthrottlePage();
stopThrottleHysteresisTimer();
+ if (!m_visuallyNonIdle.isActive())
+ m_visuallyNonIdle.beginActivity();
}
}
Modified: trunk/Source/WebCore/page/PageThrottler.h (161318 => 161319)
--- 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)
@@ -28,6 +28,7 @@
#include "Timer.h"
+#include <WebCore/UserActivity.h>
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -47,7 +48,7 @@
bool shouldThrottleAnimations() const { return m_throttleState != PageNotThrottledState; }
bool shouldThrottleTimers() const { return m_throttleState != PageNotThrottledState; }
- void setThrottled(bool);
+ void setIsVisuallyIdle(bool);
void reportInterestingEvent();
@@ -73,6 +74,7 @@
PageThrottleState m_throttleState;
Timer<PageThrottler> m_throttleHysteresisTimer;
HashSet<PageActivityAssertionToken*> m_activityTokens;
+ UserActivity m_visuallyNonIdle;
};
}
Modified: trunk/Source/WebKit2/ChangeLog (161318 => 161319)
--- 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)
@@ -1,3 +1,36 @@
+2014-01-05 Gavin Barraclough <[email protected]>
+
+ 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 -> setIsVisuallyIdle.
+ * WebProcess/WebPage/WebPage.h:
+ - setThrottled -> setIsVisuallyIdle, added m_suppressionDisabled.
+ * WebProcess/WebProcess.cpp:
+ * WebProcess/WebProcess.h:
+ (WebKit::WebProcess::shouldForceScreenFontSubstitution):
+ - Removed setProcessSuppressionEnabled - WebPage now detects the supression change.
+
2014-01-04 Martin Robinson <[email protected]>
[GTK] [CMake] Improve the way we locate gobject-introspection
Modified: trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm (161318 => 161319)
--- 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)
@@ -88,8 +88,6 @@
#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
initializeTimerCoalescingPolicy();
#endif
- // Start with process suppression disabled.
- m_processSuppressionDisabled.beginActivity();
[[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] bundlePath]];
}
Modified: trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm (161318 => 161319)
--- 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)
@@ -74,8 +74,6 @@
return;
m_processSuppressionEnabled = canEnable;
- connection()->send(Messages::WebProcess::SetProcessSuppressionEnabled(m_processSuppressionEnabled), 0);
-
m_context->updateProcessSuppressionState();
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (161318 => 161319)
--- 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)
@@ -282,6 +282,7 @@
, m_scrollPinningBehavior(DoNotPin)
, m_useAsyncScrolling(false)
, m_viewState(parameters.viewState)
+ , m_processSuppressionDisabledByWebPreference("Process suppression is disabled.")
{
ASSERT(m_pageID);
// FIXME: This is a non-ideal location for this Setting and
@@ -425,6 +426,7 @@
#endif
m_page->setIsVisible(m_viewState & ViewState::IsVisible, true);
+ setIsVisuallyIdle(m_viewState & ViewState::IsVisuallyIdle);
}
WebPage::~WebPage()
@@ -2080,6 +2082,8 @@
setActive(viewState & ViewState::WindowIsActive);
if (changed & ViewState::IsInWindow)
setIsInWindow(viewState & ViewState::IsInWindow);
+ if (changed & ViewState::IsVisuallyIdle)
+ setIsVisuallyIdle(viewState & ViewState::IsVisuallyIdle);
for (auto* pluginView : m_pluginViews)
pluginView->viewStateDidChange(changed);
@@ -2543,6 +2547,14 @@
settings.setMediaSourceEnabled(store.getBoolValueForKey(WebPreferencesKey::mediaSourceEnabledKey()));
#endif
+ if (store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey())) {
+ if (m_processSuppressionDisabledByWebPreference.isActive())
+ m_processSuppressionDisabledByWebPreference.endActivity();
+ } else {
+ if (!m_processSuppressionDisabledByWebPreference.isActive())
+ m_processSuppressionDisabledByWebPreference.beginActivity();
+ }
+
platformPreferencesDidChange(store);
if (m_drawingArea)
@@ -3670,10 +3682,9 @@
m_page->setIsPrerender();
}
-void WebPage::setThrottled(bool isThrottled)
+void WebPage::setIsVisuallyIdle(bool isVisuallyIdle)
{
- if (m_page)
- m_page->setThrottled(isThrottled);
+ m_page->setIsVisuallyIdle(isVisuallyIdle);
}
void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (161318 => 161319)
--- 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)
@@ -57,6 +57,7 @@
#include <WebCore/PlatformScreen.h>
#include <WebCore/ScrollTypes.h>
#include <WebCore/TextChecking.h>
+#include <WebCore/UserActivity.h>
#include <WebCore/WebCoreKeyboardUIMode.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
@@ -615,7 +616,6 @@
void setVisibilityStatePrerender();
void updateVisibilityState(bool isInitialState = false);
- void setThrottled(bool isThrottled);
#if PLATFORM(IOS)
void didFinishScrolling(const WebCore::FloatPoint& contentOffset);
@@ -731,6 +731,7 @@
void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
+ void setIsVisuallyIdle(bool);
void setViewState(ViewState::Flags, bool wantsDidUpdateViewState);
void validateCommand(const String&, uint64_t);
void executeEditCommand(const String&);
@@ -1045,6 +1046,8 @@
bool m_useAsyncScrolling;
ViewState::Flags m_viewState;
+
+ UserActivity m_processSuppressionDisabledByWebPreference;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (161318 => 161319)
--- 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)
@@ -548,19 +548,6 @@
return 0;
}
-#if PLATFORM(MAC)
-void WebProcess::setProcessSuppressionEnabled(bool processSuppressionEnabled)
-{
- HashMap<uint64_t, RefPtr<WebPage>>::const_iterator end = m_pageMap.end();
- for (HashMap<uint64_t, RefPtr<WebPage>>::const_iterator it = m_pageMap.begin(); it != end; ++it) {
- WebPage* page = (*it).value.get();
- page->setThrottled(processSuppressionEnabled);
- }
-
- ChildProcess::setProcessSuppressionEnabled(processSuppressionEnabled);
-}
-#endif
-
WebPage* WebProcess::webPage(uint64_t pageID) const
{
return m_pageMap.get(pageID);
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (161318 => 161319)
--- 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)
@@ -137,8 +137,6 @@
#if PLATFORM(MAC)
pid_t presenterApplicationPid() const { return m_presenterApplicationPid; }
bool shouldForceScreenFontSubstitution() const { return m_shouldForceScreenFontSubstitution; }
-
- void setProcessSuppressionEnabled(bool);
#endif
const TextCheckerState& textCheckerState() const { return m_textCheckerState; }