Diff
Modified: trunk/Source/WebCore/ChangeLog (150155 => 150156)
--- trunk/Source/WebCore/ChangeLog 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/ChangeLog 2013-05-15 23:00:10 UTC (rev 150156)
@@ -1,3 +1,33 @@
+2013-05-08 Gavin Barraclough <[email protected]>
+
+ Process suppression should throttle scripted animations
+ https://bugs.webkit.org/show_bug.cgi?id=115812
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/13799726>
+
+ * WebCore.exp.in:
+ - Expose Page::setThrottled
+ * dom/Document.cpp:
+ (WebCore::Document::scriptedAnimationControllerSetThrottled):
+ (WebCore):
+ * dom/Document.h:
+ (Document):
+ - Forwards to ScriptedAnimationController::setThrottled
+ * dom/ScriptedAnimationController.cpp:
+ (WebCore::ScriptedAnimationController::setThrottled):
+ (WebCore):
+ * dom/ScriptedAnimationController.h:
+ - Force use of a timer.
+ (ScriptedAnimationController):
+ * page/Page.cpp:
+ (WebCore::Page::setThrottled):
+ (WebCore):
+ * page/Page.h:
+ (Page):
+ - When under throttling force the ScriptedAnimationController to use a timer.
+
2013-05-15 Igor Oliveira <[email protected]>
Implement run-in remove child cases.
Modified: trunk/Source/WebCore/WebCore.exp.in (150155 => 150156)
--- trunk/Source/WebCore/WebCore.exp.in 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-05-15 23:00:10 UTC (rev 150156)
@@ -845,6 +845,7 @@
__ZN7WebCore4Page11PageClientsC1Ev
__ZN7WebCore4Page11PageClientsD1Ev
__ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
+__ZN7WebCore4Page12setThrottledEb
__ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj
__ZN7WebCore4Page13setIsInWindowEb
__ZN7WebCore4Page13setPaginationERKNS_10PaginationE
Modified: trunk/Source/WebCore/dom/Document.cpp (150155 => 150156)
--- trunk/Source/WebCore/dom/Document.cpp 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-05-15 23:00:10 UTC (rev 150156)
@@ -4886,6 +4886,14 @@
#endif
}
+void Document::scriptedAnimationControllerSetThrottled(bool isThrottled)
+{
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ if (m_scriptedAnimationController)
+ m_scriptedAnimationController->setThrottled(isThrottled);
+#endif
+}
+
void Document::windowScreenDidChange(PlatformDisplayID displayID)
{
UNUSED_PARAM(displayID);
Modified: trunk/Source/WebCore/dom/Document.h (150155 => 150156)
--- trunk/Source/WebCore/dom/Document.h 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/dom/Document.h 2013-05-15 23:00:10 UTC (rev 150156)
@@ -947,6 +947,7 @@
void suspendScriptedAnimationControllerCallbacks();
void resumeScriptedAnimationControllerCallbacks();
+ virtual void scriptedAnimationControllerSetThrottled(bool);
void windowScreenDidChange(PlatformDisplayID);
Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (150155 => 150156)
--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-05-15 23:00:10 UTC (rev 150156)
@@ -82,6 +82,13 @@
scheduleAnimation();
}
+void ScriptedAnimationController::setThrottled(bool isThrottled)
+{
+#if USE(REQUEST_ANIMATION_FRAME_TIMER) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ m_useTimer = isThrottled;
+#endif
+}
+
ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCallback(PassRefPtr<RequestAnimationFrameCallback> callback)
{
ScriptedAnimationController::CallbackId id = ++m_nextCallbackId;
Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (150155 => 150156)
--- trunk/Source/WebCore/dom/ScriptedAnimationController.h 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h 2013-05-15 23:00:10 UTC (rev 150156)
@@ -65,6 +65,7 @@
void suspend();
void resume();
+ void setThrottled(bool);
void windowScreenDidChange(PlatformDisplayID);
Modified: trunk/Source/WebCore/page/Page.cpp (150155 => 150156)
--- trunk/Source/WebCore/page/Page.cpp 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/page/Page.cpp 2013-05-15 23:00:10 UTC (rev 150156)
@@ -950,6 +950,14 @@
}
}
+void Page::setThrottled(bool isThrottled)
+{
+ for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document())
+ frame->document()->scriptedAnimationControllerSetThrottled(isThrottled);
+ }
+}
+
void Page::userStyleSheetLocationChanged()
{
// FIXME: Eventually we will move to a model of just being handed the sheet
Modified: trunk/Source/WebCore/page/Page.h (150155 => 150156)
--- trunk/Source/WebCore/page/Page.h 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebCore/page/Page.h 2013-05-15 23:00:10 UTC (rev 150156)
@@ -302,6 +302,7 @@
void suspendScriptedAnimations();
void resumeScriptedAnimations();
bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
+ void setThrottled(bool);
void userStyleSheetLocationChanged();
const String& userStyleSheet() const;
Modified: trunk/Source/WebKit2/ChangeLog (150155 => 150156)
--- trunk/Source/WebKit2/ChangeLog 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebKit2/ChangeLog 2013-05-15 23:00:10 UTC (rev 150156)
@@ -1,3 +1,25 @@
+2013-05-08 Gavin Barraclough <[email protected]>
+
+ Process suppression should throttle scripted animations
+ https://bugs.webkit.org/show_bug.cgi?id=115812
+
+ Reviewed by Simon Fraser.
+
+ <rdar://problem/13799726>
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setThrottled):
+ (WebKit):
+ * WebProcess/WebPage/WebPage.h:
+ (WebPage):
+ - Added setThrottled, forwards to WebCore::Page.
+ * WebProcess/WebProcess.cpp:
+ (WebKit):
+ (WebKit::WebProcess::setProcessSuppressionEnabled):
+ * WebProcess/WebProcess.h:
+ (WebProcess):
+ - Intercept calls to setProcessSuppressionEnabled, also mark all pages as being throttled.
+
2013-05-15 Anders Carlsson <[email protected]>
WKPageGetPluginInformationDisplayNameKey doesn't return the right key
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (150155 => 150156)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-05-15 23:00:10 UTC (rev 150156)
@@ -3755,6 +3755,12 @@
}
#endif
+void WebPage::setThrottled(bool isThrottled)
+{
+ if (m_page)
+ m_page->setThrottled(isThrottled);
+}
+
void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
{
m_scrollingPerformanceLoggingEnabled = enabled;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (150155 => 150156)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2013-05-15 23:00:10 UTC (rev 150156)
@@ -608,6 +608,7 @@
#if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
void setVisibilityState(uint32_t /* WebCore::PageVisibilityState */, bool isInitialState);
#endif
+ void setThrottled(bool isThrottled);
#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (150155 => 150156)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-05-15 23:00:10 UTC (rev 150156)
@@ -553,6 +553,19 @@
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 (150155 => 150156)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2013-05-15 22:59:20 UTC (rev 150155)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2013-05-15 23:00:10 UTC (rev 150156)
@@ -132,6 +132,8 @@
#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; }