Title: [146704] trunk
Revision
146704
Author
[email protected]
Date
2013-03-22 19:15:36 -0700 (Fri, 22 Mar 2013)

Log Message

Add runtime setting for hidden page DOM timer throttling and CSS animation suspension
https://bugs.webkit.org/show_bug.cgi?id=112308

Reviewed by Gavin Barraclough.

Source/WebCore:

No new tests.  Only adding settings to enable/disable existing features
and hence existing tests suffice.

* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::setVisibilityState): Check if DOM timer throttling
and CSS animation suspension are enabled before turning them on.
(WebCore::Page::hiddenPageDOMTimerThrottlingStateChanged): Start or stop
DOM timer throttling based on page visibility and the new setting state.
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): Ditto
for CSS animation suspension.
* page/Page.h:
* page/Settings.cpp:
(WebCore::Settings::Settings): Initialize the flags for enabling hidden
page DOM timer throttling and CSS animation suspension to false.
(WebCore::Settings::setHiddenPageDOMTimerThrottlingEnabled): Update flag
and notify page that the state of the setting has changed.
(WebCore::Settings::setHiddenPageCSSAnimationSuspensionEnabled): Ditto.
* page/Settings.h:
(WebCore::Settings::hiddenPageDOMTimerThrottlingEnabled):
(WebCore::Settings::hiddenPageCSSAnimationSuspensionEnabled):

Source/WebKit/mac:

Add private preference for enabling/disabling hidden page DOM timer
throttling and CSS animation suspension.  The preference should be
disabled by default to avoid compatibility issues.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences hiddenPageDOMTimerThrottlingEnabled]):
(-[WebPreferences setHiddenPageDOMTimerThrottlingEnabled:]):
(-[WebPreferences hiddenPageCSSAnimationSuspensionEnabled]):
(-[WebPreferences setHiddenPageCSSAnimationSuspensionEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add private preference for enabling/disabling hidden page DOM timer
throttling and CSS animation suspension.  The preference should be
enabled by default only on Mac, where WebKit2 is a private API and
hence compatibility is less of a issue.

* Shared/WebPreferencesStore.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled):
(WKPreferencesGetHiddenPageDOMTimerThrottlingEnabled):
(WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled):
(WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled):
* UIProcess/API/C/WKPreferencesPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Allow
WebKitTestRunner to override hiddenPageDOMTimerThrottlingEnabled.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

Hidden page DOM timer throttling is disabled by default in WebKit1 and
in WebKit2 for platforms other than Mac.  Override the preference to
enable it during the test.

* fast/dom/timer-throttling-hidden-page.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (146703 => 146704)


--- trunk/LayoutTests/ChangeLog	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/LayoutTests/ChangeLog	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1,3 +1,16 @@
+2013-03-21  Kiran Muppala  <[email protected]>
+
+        Add runtime setting for hidden page DOM timer throttling and CSS animation suspension
+        https://bugs.webkit.org/show_bug.cgi?id=112308
+
+        Reviewed by Gavin Barraclough.
+
+        Hidden page DOM timer throttling is disabled by default in WebKit1 and
+        in WebKit2 for platforms other than Mac.  Override the preference to
+        enable it during the test.
+
+        * fast/dom/timer-throttling-hidden-page.html:
+
 2013-03-22  Stephen Chenney  <[email protected]>
 
         [Chromium] Test expectations after Skia changes

Modified: trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html (146703 => 146704)


--- trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/LayoutTests/fast/dom/timer-throttling-hidden-page.html	2013-03-23 02:15:36 UTC (rev 146704)
@@ -56,6 +56,8 @@
                 debug('This test requires testRunner');
                 return;
             }
+            testRunner.overridePreference("WebKitHiddenPageDOMTimerThrottlingEnabled", 1);
+
             var timeoutIntervalSpans = document.getElementsByClassName('timeoutInterval');
             for (var i = 0; i < timeoutIntervalSpans.length; i++)
                 timeoutIntervalSpans[i].innerText = timeoutInterval;

Modified: trunk/Source/WebCore/ChangeLog (146703 => 146704)


--- trunk/Source/WebCore/ChangeLog	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebCore/ChangeLog	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1,3 +1,32 @@
+2013-03-21  Kiran Muppala  <[email protected]>
+
+        Add runtime setting for hidden page DOM timer throttling and CSS animation suspension
+        https://bugs.webkit.org/show_bug.cgi?id=112308
+
+        Reviewed by Gavin Barraclough.
+
+        No new tests.  Only adding settings to enable/disable existing features
+        and hence existing tests suffice.
+
+        * WebCore.exp.in:
+        * page/Page.cpp:
+        (WebCore::Page::setVisibilityState): Check if DOM timer throttling
+        and CSS animation suspension are enabled before turning them on.
+        (WebCore::Page::hiddenPageDOMTimerThrottlingStateChanged): Start or stop
+        DOM timer throttling based on page visibility and the new setting state.
+        (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged): Ditto
+        for CSS animation suspension.
+        * page/Page.h:
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings): Initialize the flags for enabling hidden
+        page DOM timer throttling and CSS animation suspension to false.
+        (WebCore::Settings::setHiddenPageDOMTimerThrottlingEnabled): Update flag
+        and notify page that the state of the setting has changed.
+        (WebCore::Settings::setHiddenPageCSSAnimationSuspensionEnabled): Ditto.
+        * page/Settings.h:
+        (WebCore::Settings::hiddenPageDOMTimerThrottlingEnabled):
+        (WebCore::Settings::hiddenPageCSSAnimationSuspensionEnabled):
+
 2013-03-22  Benjamin Poulain  <[email protected]>
 
         Remove 2 bad branches from StringHash::equal() and CaseFoldingHash::equal()

Modified: trunk/Source/WebCore/WebCore.exp.in (146703 => 146704)


--- trunk/Source/WebCore/WebCore.exp.in	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1051,6 +1051,8 @@
 __ZN7WebCore8Settings32setScreenFontSubstitutionEnabledEb
 __ZN7WebCore8Settings33setAggressiveTileRetentionEnabledEb
 __ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
+__ZN7WebCore8Settings38setHiddenPageDOMTimerThrottlingEnabledEb
+__ZN7WebCore8Settings42setHiddenPageCSSAnimationSuspensionEnabledEb
 __ZN7WebCore8Settings45setShouldRespectPriorityInCSSAttributeSettersEb
 __ZN7WebCore8Settings21setResolutionOverrideERKNS_7IntSizeE
 __ZN7WebCore8Settings20setMediaTypeOverrideERKN3WTF6StringE

Modified: trunk/Source/WebCore/page/Page.cpp (146703 => 146704)


--- trunk/Source/WebCore/page/Page.cpp	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebCore/page/Page.cpp	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1238,14 +1238,18 @@
 
     if (visibilityState == WebCore::PageVisibilityStateHidden) {
 #if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
-        setTimerAlignmentInterval(Settings::hiddenPageDOMTimerAlignmentInterval());
+        if (m_settings->hiddenPageDOMTimerThrottlingEnabled())
+            setTimerAlignmentInterval(Settings::hiddenPageDOMTimerAlignmentInterval());
 #endif
-        mainFrame()->animation()->suspendAnimations();
+        if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
+            mainFrame()->animation()->suspendAnimations();
     } else {
 #if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
-        setTimerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval());
+        if (m_settings->hiddenPageDOMTimerThrottlingEnabled())
+            setTimerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval());
 #endif
-        mainFrame()->animation()->resumeAnimations();
+        if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
+            mainFrame()->animation()->resumeAnimations();
     }
 #if !ENABLE(PAGE_VISIBILITY_API)
     UNUSED_PARAM(isInitialState);
@@ -1444,6 +1448,31 @@
     m_seenMediaEngines.clear();
 }
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+void Page::hiddenPageDOMTimerThrottlingStateChanged()
+{
+    if (m_settings->hiddenPageDOMTimerThrottlingEnabled()) {
+#if ENABLE(PAGE_VISIBILITY_API)
+        if (m_visibilityState == WebCore::PageVisibilityStateHidden)
+            setTimerAlignmentInterval(Settings::hiddenPageDOMTimerAlignmentInterval());
+#endif
+    } else
+        setTimerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval());
+}
+#endif
+
+#if (ENABLE_PAGE_VISIBILITY_API)
+void Page::hiddenPageCSSAnimationSuspensionStateChanged()
+{
+    if (m_visibilityState == WebCore::PageVisibilityStateHidden) {
+        if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
+            mainFrame()->animation()->suspendAnimations();
+        else
+            mainFrame()->animation()->resumeAnimations();
+    }
+}
+#endif
+
 void Page::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Page);

Modified: trunk/Source/WebCore/page/Page.h (146703 => 146704)


--- trunk/Source/WebCore/page/Page.h	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebCore/page/Page.h	2013-03-23 02:15:36 UTC (rev 146704)
@@ -380,6 +380,14 @@
     void resetSeenMediaEngines();
 
     PageConsole* console() { return m_console.get(); }
+
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+    void hiddenPageDOMTimerThrottlingStateChanged();
+#endif
+#if ENABLE(PAGE_VISIBILITY_API)
+    void hiddenPageCSSAnimationSuspensionStateChanged();
+#endif
+
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
 #if ENABLE(VIDEO_TRACK)

Modified: trunk/Source/WebCore/page/Settings.cpp (146703 => 146704)


--- trunk/Source/WebCore/page/Settings.cpp	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebCore/page/Settings.cpp	2013-03-23 02:15:36 UTC (rev 146704)
@@ -201,6 +201,12 @@
     , m_aggressiveTileRetentionEnabled(false)
     , m_timeWithoutMouseMovementBeforeHidingControls(3)
     , m_setImageLoadingSettingsTimer(this, &Settings::imageLoadingSettingsTimerFired)
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+    , m_hiddenPageDOMTimerThrottlingEnabled(false)
+#endif
+#if ENABLE(PAGE_VISIBILITY_API)
+    , m_hiddenPageCSSAnimationSuspensionEnabled(false)
+#endif
 {
     // A Frame may not have been created yet, so we initialize the AtomicString
     // hash before trying to use it.
@@ -617,4 +623,24 @@
 }
 #endif
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+void Settings::setHiddenPageDOMTimerThrottlingEnabled(bool flag)
+{
+    if (m_hiddenPageDOMTimerThrottlingEnabled == flag)
+        return;
+    m_hiddenPageDOMTimerThrottlingEnabled = flag;
+    m_page->hiddenPageDOMTimerThrottlingStateChanged();
+}
+#endif
+
+#if ENABLE(PAGE_VISIBILITY_API)
+void Settings::setHiddenPageCSSAnimationSuspensionEnabled(bool flag)
+{
+    if (m_hiddenPageCSSAnimationSuspensionEnabled == flag)
+        return;
+    m_hiddenPageCSSAnimationSuspensionEnabled = flag;
+    m_page->hiddenPageCSSAnimationSuspensionStateChanged();
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/Settings.h (146703 => 146704)


--- trunk/Source/WebCore/page/Settings.h	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebCore/page/Settings.h	2013-03-23 02:15:36 UTC (rev 146704)
@@ -180,6 +180,11 @@
         void setDOMTimerAlignmentInterval(double);
         double domTimerAlignmentInterval() const;
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+        bool hiddenPageDOMTimerThrottlingEnabled() const { return m_hiddenPageDOMTimerThrottlingEnabled; }
+        void setHiddenPageDOMTimerThrottlingEnabled(bool);
+#endif
+
         void setUsesPageCache(bool);
         bool usesPageCache() const { return m_usesPageCache; }
         
@@ -267,6 +272,11 @@
         void setTimeWithoutMouseMovementBeforeHidingControls(double time) { m_timeWithoutMouseMovementBeforeHidingControls = time; }
         double timeWithoutMouseMovementBeforeHidingControls() const { return m_timeWithoutMouseMovementBeforeHidingControls; }
 
+#if ENABLE(PAGE_VISIBILITY_API)
+        bool hiddenPageCSSAnimationSuspensionEnabled() const { return m_hiddenPageCSSAnimationSuspensionEnabled; }
+        void setHiddenPageCSSAnimationSuspensionEnabled(bool);
+#endif
+
     private:
         explicit Settings(Page*);
 
@@ -328,6 +338,13 @@
         Timer<Settings> m_setImageLoadingSettingsTimer;
         void imageLoadingSettingsTimerFired(Timer<Settings>*);
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+        bool m_hiddenPageDOMTimerThrottlingEnabled : 1;
+#endif
+#if ENABLE(PAGE_VISIBILITY_API)
+        bool m_hiddenPageCSSAnimationSuspensionEnabled : 1;
+#endif
+
         static double gDefaultMinDOMTimerInterval;
         static double gDefaultDOMTimerAlignmentInterval;
 

Modified: trunk/Source/WebKit/mac/ChangeLog (146703 => 146704)


--- trunk/Source/WebKit/mac/ChangeLog	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1,3 +1,25 @@
+2013-03-21  Kiran Muppala  <[email protected]>
+
+        Add runtime setting for hidden page DOM timer throttling and CSS animation suspension
+        https://bugs.webkit.org/show_bug.cgi?id=112308
+
+        Reviewed by Gavin Barraclough.
+
+        Add private preference for enabling/disabling hidden page DOM timer
+        throttling and CSS animation suspension.  The preference should be
+        disabled by default to avoid compatibility issues.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences hiddenPageDOMTimerThrottlingEnabled]):
+        (-[WebPreferences setHiddenPageDOMTimerThrottlingEnabled:]):
+        (-[WebPreferences hiddenPageCSSAnimationSuspensionEnabled]):
+        (-[WebPreferences setHiddenPageCSSAnimationSuspensionEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2013-03-19  Ryosuke Niwa  <[email protected]>
 
         Another Mac build fix attempt after r146239.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (146703 => 146704)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2013-03-23 02:15:36 UTC (rev 146704)
@@ -131,6 +131,8 @@
 #define WebKitStorageBlockingPolicyKey @"WebKitStorageBlockingPolicy"
 #define WebKitPlugInSnapshottingEnabledPreferenceKey @"WebKitPlugInSnapshottingEnabled"
 #define WebKitQTKitEnabledPreferenceKey @"WebKitQTKitEnabled"
+#define WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey @"WebKitHiddenPageDOMTimerThrottlingEnabled"
+#define WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey @"WebKitHiddenPageCSSAnimationSuspensionEnabled"
 
 // These are private both because callers should be using the cover methods and because the
 // cover methods themselves are private.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (146703 => 146704)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2013-03-23 02:15:36 UTC (rev 146704)
@@ -421,6 +421,8 @@
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
         [NSNumber numberWithBool:YES],  WebKitQTKitEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO], WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO], WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
         nil];
 
 
@@ -1809,6 +1811,26 @@
     [self _setBoolValue:enabled forKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
 }
 
+- (BOOL)hiddenPageDOMTimerThrottlingEnabled
+{
+    return [self _boolValueForKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
+}
+
+- (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
+}
+
+- (BOOL)hiddenPageCSSAnimationSuspensionEnabled
+{
+    return [self _boolValueForKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
+}
+
+- (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (146703 => 146704)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2013-03-23 02:15:36 UTC (rev 146704)
@@ -332,4 +332,10 @@
 - (BOOL)plugInSnapshottingEnabled;
 - (void)setPlugInSnapshottingEnabled:(BOOL)enabled;
 
+- (BOOL)hiddenPageDOMTimerThrottlingEnabled;
+- (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)flag;
+
+- (BOOL)hiddenPageCSSAnimationSuspensionEnabled;
+- (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)flag;
+
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (146703 => 146704)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1599,6 +1599,13 @@
 
     settings->setPlugInSnapshottingEnabled([preferences plugInSnapshottingEnabled]);
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+    settings->setHiddenPageDOMTimerThrottlingEnabled([preferences hiddenPageDOMTimerThrottlingEnabled]);
+#endif
+#if ENABLE(PAGE_VISIBILITY_API)
+    settings->setHiddenPageCSSAnimationSuspensionEnabled([preferences hiddenPageCSSAnimationSuspensionEnabled]);
+#endif
+
     // We have enabled this setting in WebKit2 for the sake of some ScrollingCoordinator work.
     // To avoid possible rendering differences, we should enable it for WebKit1 too.
     settings->setFixedPositionCreatesStackingContext(true);

Modified: trunk/Source/WebKit2/ChangeLog (146703 => 146704)


--- trunk/Source/WebKit2/ChangeLog	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit2/ChangeLog	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1,3 +1,28 @@
+2013-03-21  Kiran Muppala  <[email protected]>
+
+        Add runtime setting for hidden page DOM timer throttling and CSS animation suspension
+        https://bugs.webkit.org/show_bug.cgi?id=112308
+
+        Reviewed by Gavin Barraclough.
+
+        Add private preference for enabling/disabling hidden page DOM timer
+        throttling and CSS animation suspension.  The preference should be
+        enabled by default only on Mac, where WebKit2 is a private API and
+        hence compatibility is less of a issue.
+
+        * Shared/WebPreferencesStore.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled):
+        (WKPreferencesGetHiddenPageDOMTimerThrottlingEnabled):
+        (WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled):
+        (WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled):
+        * UIProcess/API/C/WKPreferencesPrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Allow
+        WebKitTestRunner to override hiddenPageDOMTimerThrottlingEnabled.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2013-03-22  Tim Horton  <[email protected]>
 
         Plugin Snapshotting: Auto-start dominant plugins

Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (146703 => 146704)


--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2013-03-23 02:15:36 UTC (rev 146704)
@@ -54,6 +54,14 @@
 #define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED true
 #endif
 
+#if PLATFORM(MAC)
+#define DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED true
+#define DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED true
+#else
+#define DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED false
+#define DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED false
+#endif
+
 #define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
     macro(_javascript_Enabled, _javascript_Enabled, Bool, bool, true) \
     macro(_javascript_MarkupEnabled, _javascript_MarkupEnabled, Bool, bool, true) \
@@ -146,6 +154,8 @@
     macro(SmartInsertDeleteEnabled, smartInsertDeleteEnabled, Bool, bool, true) \
     macro(ShowsURLsInToolTipsEnabled, showsURLsInToolTipsEnabled, Bool, bool, false) \
     macro(AcceleratedCompositingForOverflowScrollEnabled, acceleratedCompositingForOverflowScrollEnabled, Bool, bool, false) \
+    macro(HiddenPageDOMTimerThrottlingEnabled, hiddenPageDOMTimerThrottlingEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED) \
+    macro(HiddenPageCSSAnimationSuspensionEnabled, hiddenPageCSSAnimationSuspensionEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (146703 => 146704)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2013-03-23 02:15:36 UTC (rev 146704)
@@ -1083,3 +1083,23 @@
 {
     return toImpl(preferencesRef)->showsURLsInToolTipsEnabled();
 }
+
+void WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setHiddenPageDOMTimerThrottlingEnabled(enabled);
+}
+
+bool WKPreferencesGetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->hiddenPageDOMTimerThrottlingEnabled();
+}
+
+void WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setHiddenPageCSSAnimationSuspensionEnabled(enabled);
+}
+
+bool WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->hiddenPageCSSAnimationSuspensionEnabled();
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h (146703 => 146704)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h	2013-03-23 02:15:36 UTC (rev 146704)
@@ -259,7 +259,14 @@
 WK_EXPORT void WKPreferencesSetShowsURLsInToolTipsEnabled(WKPreferencesRef preferences, bool enabled);
 WK_EXPORT bool WKPreferencesGetShowsURLsInToolTipsEnabled(WKPreferencesRef preferences);
 
+// Defaults to true on Mac, false on other platforms.
+WK_EXPORT void WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferences);
 
+// Defaults to true on Mac, false on other platforms.
+WK_EXPORT void WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferences);
+
 WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
 
 #ifdef __cplusplus

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (146703 => 146704)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2013-03-23 02:15:36 UTC (rev 146704)
@@ -237,6 +237,10 @@
 
     FOR_EACH_OVERRIDE_BOOL_PREFERENCE(OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES)
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+    OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES(WebKitHiddenPageDOMTimerThrottlingEnabled, HiddenPageDOMTimerThrottlingEnabled, hiddenPageDOMTimerThrottlingEnabled)
+#endif
+
 #undef OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES
 #undef FOR_EACH_OVERRIDE_BOOL_PREFERENCE
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (146703 => 146704)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-23 02:01:11 UTC (rev 146703)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-23 02:15:36 UTC (rev 146704)
@@ -2405,6 +2405,13 @@
     settings->setSmartInsertDeleteEnabled(store.getBoolValueForKey(WebPreferencesKey::smartInsertDeleteEnabledKey()));
     settings->setShowsURLsInToolTips(store.getBoolValueForKey(WebPreferencesKey::showsURLsInToolTipsEnabledKey()));
 
+#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+    settings->setHiddenPageDOMTimerThrottlingEnabled(store.getBoolValueForKey(WebPreferencesKey::hiddenPageDOMTimerThrottlingEnabledKey()));
+#endif
+#if ENABLE(PAGE_VISIBILITY_API)
+    settings->setHiddenPageCSSAnimationSuspensionEnabled(store.getBoolValueForKey(WebPreferencesKey::hiddenPageCSSAnimationSuspensionEnabledKey()));
+#endif
+
     platformPreferencesDidChange(store);
 
     if (m_drawingArea)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to