Commit 784b4519 authored by tony@chromium.org's avatar tony@chromium.org

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0cc0271b
2012-10-25 Tony Chang <tony@chromium.org>
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 <simon.fraser@apple.com>
Report the tile coverage rect in layer coords, and add some tests for tiled backing and zooming
......@@ -41,8 +41,6 @@ namespace WebCore {
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;
......
......@@ -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 @@ namespace WebCore {
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
......
......@@ -81,12 +81,15 @@ static inline const AtomicString& getGenericFontFamilyForScript(const ScriptFont
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,12 +700,7 @@ void Settings::setDOMPasteAllowed(bool DOMPasteAllowed)
void Settings::setDefaultMinDOMTimerInterval(double interval)
{
DOMTimer::setDefaultMinTimerInterval(interval);
}
double Settings::defaultMinDOMTimerInterval()
{
return DOMTimer::defaultMinTimerInterval();
gDefaultMinDOMTimerInterval = interval;
}
void Settings::setMinDOMTimerInterval(double interval)
......@@ -717,12 +715,7 @@ double Settings::minDOMTimerInterval()
void Settings::setDefaultDOMTimerAlignmentInterval(double interval)
{
DOMTimer::setDefaultTimerAlignmentInterval(interval);
}
double Settings::defaultDOMTimerAlignmentInterval()
{
return DOMTimer::defaultTimerAlignmentInterval();
gDefaultDOMTimerAlignmentInterval = interval;
}
void Settings::setDOMTimerAlignmentInterval(double interval)
......
......@@ -257,13 +257,13 @@ namespace WebCore {
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 @@ namespace WebCore {
double m_incrementalRenderingSuppressionTimeoutInSeconds;
static double gDefaultMinDOMTimerInterval;
static double gDefaultDOMTimerAlignmentInterval;
#if USE(AVFOUNDATION)
static bool gAVFoundationEnabled;
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment