Title: [132538] trunk/Source/WebCore
Revision
132538
Author
[email protected]
Date
2012-10-25 14:49:22 -0700 (Thu, 25 Oct 2012)

Log Message

Move default DOM Timer values into Settings
https://bugs.webkit.org/show_bug.cgi?id=100405

Reviewed by Kenneth Russell.

Move the global values for defaultMinDOMTimerInterval and defaultDOMTimerAlignmentInterval into
the Settings object. This is more consistent with other global settings and allows us to remove
the setters on the DOMTimer object.

No new tests, this is a refactor.

* page/DOMTimer.cpp: Remove globals.
* page/DOMTimer.h:
(WebCore::DOMTimer::defaultMinTimerInterval): Call through to Settings
(WebCore::DOMTimer::defaultTimerAlignmentInterval): Call through to Settings.
(DOMTimer): Remove setters.
* page/Settings.cpp:
(WebCore::Settings::setDefaultMinDOMTimerInterval): Use a global in Settings.
(WebCore::Settings::setDefaultDOMTimerAlignmentInterval): Use a global in Settings.
* page/Settings.h:
(WebCore::Settings::defaultMinDOMTimerInterval): Inline the getter.
(WebCore::Settings::defaultDOMTimerAlignmentInterval): Inline the getter.
(Settings): Add globals.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132537 => 132538)


--- trunk/Source/WebCore/ChangeLog	2012-10-25 21:42:12 UTC (rev 132537)
+++ trunk/Source/WebCore/ChangeLog	2012-10-25 21:49:22 UTC (rev 132538)
@@ -1,3 +1,29 @@
+2012-10-25  Tony Chang  <[email protected]>
+
+        Move default DOM Timer values into Settings
+        https://bugs.webkit.org/show_bug.cgi?id=100405
+
+        Reviewed by Kenneth Russell.
+
+        Move the global values for defaultMinDOMTimerInterval and defaultDOMTimerAlignmentInterval into
+        the Settings object. This is more consistent with other global settings and allows us to remove
+        the setters on the DOMTimer object.
+
+        No new tests, this is a refactor.
+
+        * page/DOMTimer.cpp: Remove globals.
+        * page/DOMTimer.h:
+        (WebCore::DOMTimer::defaultMinTimerInterval): Call through to Settings
+        (WebCore::DOMTimer::defaultTimerAlignmentInterval): Call through to Settings.
+        (DOMTimer): Remove setters.
+        * page/Settings.cpp:
+        (WebCore::Settings::setDefaultMinDOMTimerInterval): Use a global in Settings.
+        (WebCore::Settings::setDefaultDOMTimerAlignmentInterval): Use a global in Settings.
+        * page/Settings.h:
+        (WebCore::Settings::defaultMinDOMTimerInterval): Inline the getter.
+        (WebCore::Settings::defaultDOMTimerAlignmentInterval): Inline the getter.
+        (Settings): Add globals.
+
 2012-10-25  Simon Fraser  <[email protected]>
 
         Report the tile coverage rect in layer coords, and add some tests for tiled backing and zooming

Modified: trunk/Source/WebCore/page/DOMTimer.cpp (132537 => 132538)


--- trunk/Source/WebCore/page/DOMTimer.cpp	2012-10-25 21:42:12 UTC (rev 132537)
+++ trunk/Source/WebCore/page/DOMTimer.cpp	2012-10-25 21:49:22 UTC (rev 132538)
@@ -41,8 +41,6 @@
 static const int maxIntervalForUserGestureForwarding = 1000; // One second matches Gecko.
 static const int maxTimerNestingLevel = 5;
 static const double _oneMillisecond_ = 0.001;
-double DOMTimer::s_minDefaultTimerInterval = 0.010; // 10 milliseconds
-double DOMTimer::s_defaultTimerAlignmentInterval = 0;
 
 static int timerNestingLevel = 0;
     

Modified: trunk/Source/WebCore/page/DOMTimer.h (132537 => 132538)


--- trunk/Source/WebCore/page/DOMTimer.h	2012-10-25 21:42:12 UTC (rev 132537)
+++ trunk/Source/WebCore/page/DOMTimer.h	2012-10-25 21:49:22 UTC (rev 132538)
@@ -27,6 +27,7 @@
 #ifndef DOMTimer_h
 #define DOMTimer_h
 
+#include "Settings.h"
 #include "SuspendableTimer.h"
 #include "UserGestureIndicator.h"
 #include <wtf/OwnPtr.h>
@@ -35,10 +36,8 @@
 namespace WebCore {
 
     class ScheduledAction;
-    class Settings;
 
     class DOMTimer : public SuspendableTimer {
-        friend class Settings;
     public:
         virtual ~DOMTimer();
         // Creates a new timer owned by specified ScriptExecutionContext, starts it
@@ -62,26 +61,20 @@
         double intervalClampedToMinimum(int timeout, double minimumTimerInterval) const;
 
         // The default minimum allowable timer setting (in seconds, 0.001 == 1 ms).
-        // These are only modified via static methods in Settings.
-        static double defaultMinTimerInterval() { return s_minDefaultTimerInterval; }
-        static void setDefaultMinTimerInterval(double value) { s_minDefaultTimerInterval = value; }
+        static double defaultMinTimerInterval() { return Settings::defaultMinDOMTimerInterval(); }
 
         // Retuns timer fire time rounded to the next multiple of timer alignment interval.
         virtual double alignedFireTime(double) const;
 
         // The default timer alignment interval (in seconds). If non zero, timer fire times
         // will be rounded to a multiple of the alignment interval.
-        // These are only modified via static methods in Settings.
-        static double defaultTimerAlignmentInterval() { return s_defaultTimerAlignmentInterval; }
-        static void setDefaultTimerAlignmentInterval(double value) { s_defaultTimerAlignmentInterval = value; }
+        static double defaultTimerAlignmentInterval() { return Settings::defaultDOMTimerAlignmentInterval(); }
 
         int m_timeoutId;
         int m_nestingLevel;
         OwnPtr<ScheduledAction> m_action;
         int m_originalInterval;
         RefPtr<UserGestureIndicator::Token> m_userGestureToken;
-        static double s_minDefaultTimerInterval;
-        static double s_defaultTimerAlignmentInterval;
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/Settings.cpp (132537 => 132538)


--- trunk/Source/WebCore/page/Settings.cpp	2012-10-25 21:42:12 UTC (rev 132537)
+++ trunk/Source/WebCore/page/Settings.cpp	2012-10-25 21:49:22 UTC (rev 132538)
@@ -81,12 +81,15 @@
     return emptyAtom;
 }
 
+double Settings::gDefaultMinDOMTimerInterval = 0.010; // 10 milliseconds
+double Settings::gDefaultDOMTimerAlignmentInterval = 0;
+
 #if USE(SAFARI_THEME)
 bool Settings::gShouldPaintNativeControls = true;
 #endif
 
 #if USE(AVFOUNDATION)
-bool Settings::gAVFoundationEnabled(false);
+bool Settings::gAVFoundationEnabled = false;
 #endif
 
 bool Settings::gMockScrollbarsEnabled = false;
@@ -697,14 +700,9 @@
 
 void Settings::setDefaultMinDOMTimerInterval(double interval)
 {
-    DOMTimer::setDefaultMinTimerInterval(interval);
+    gDefaultMinDOMTimerInterval = interval;
 }
 
-double Settings::defaultMinDOMTimerInterval()
-{
-    return DOMTimer::defaultMinTimerInterval();
-}
-
 void Settings::setMinDOMTimerInterval(double interval)
 {
     m_page->setMinimumTimerInterval(interval);
@@ -717,14 +715,9 @@
 
 void Settings::setDefaultDOMTimerAlignmentInterval(double interval)
 {
-    DOMTimer::setDefaultTimerAlignmentInterval(interval);
+    gDefaultDOMTimerAlignmentInterval = interval;
 }
 
-double Settings::defaultDOMTimerAlignmentInterval()
-{
-    return DOMTimer::defaultTimerAlignmentInterval();
-}
-
 void Settings::setDOMTimerAlignmentInterval(double interval)
 {
     m_page->setTimerAlignmentInterval(interval);

Modified: trunk/Source/WebCore/page/Settings.h (132537 => 132538)


--- trunk/Source/WebCore/page/Settings.h	2012-10-25 21:42:12 UTC (rev 132537)
+++ trunk/Source/WebCore/page/Settings.h	2012-10-25 21:49:22 UTC (rev 132538)
@@ -257,13 +257,13 @@
         bool isDOMPasteAllowed() const { return m_isDOMPasteAllowed; }
         
         static void setDefaultMinDOMTimerInterval(double); // Interval specified in seconds.
-        static double defaultMinDOMTimerInterval();
+        static double defaultMinDOMTimerInterval() { return gDefaultMinDOMTimerInterval; }
         
         void setMinDOMTimerInterval(double); // Per-page; initialized to default value.
         double minDOMTimerInterval();
 
         static void setDefaultDOMTimerAlignmentInterval(double);
-        static double defaultDOMTimerAlignmentInterval();
+        static double defaultDOMTimerAlignmentInterval() { return gDefaultDOMTimerAlignmentInterval; }
 
         void setDOMTimerAlignmentInterval(double);
         double domTimerAlignmentInterval() const;
@@ -849,6 +849,9 @@
 
         double m_incrementalRenderingSuppressionTimeoutInSeconds;
 
+        static double gDefaultMinDOMTimerInterval;
+        static double gDefaultDOMTimerAlignmentInterval;
+
 #if USE(AVFOUNDATION)
         static bool gAVFoundationEnabled;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to