Commit 33c74813 authored by abarth@webkit.org's avatar abarth@webkit.org

2009-07-24 Mike Fenton <mike.fenton@torchmobile.com>

        Reviewed by Eric Seidel.

        Update WebCore/page/DOMTimer.cpp/h to conform to WebKit
        Style Guidelines as identified by cpplint.py.
        https://bugs.webkit.org/show_bug.cgi?id=27618

        * page/DOMTimer.cpp:
        (WebCore::DOMTimer::DOMTimer):
        (WebCore::DOMTimer::~DOMTimer):
        (WebCore::DOMTimer::fired):
        (WebCore::DOMTimer::suspend):
        (WebCore::DOMTimer::resume):
        (WebCore::DOMTimer::canSuspend):
        * page/DOMTimer.h:
        (WebCore::DOMTimer::minTimerInterval):
        (WebCore::DOMTimer::setMinTimerInterval):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 77962a87
2009-07-24 Mike Fenton <mike.fenton@torchmobile.com>
Reviewed by Eric Seidel.
Update WebCore/page/DOMTimer.cpp/h to conform to WebKit
Style Guidelines as identified by cpplint.py.
https://bugs.webkit.org/show_bug.cgi?id=27618
* page/DOMTimer.cpp:
(WebCore::DOMTimer::DOMTimer):
(WebCore::DOMTimer::~DOMTimer):
(WebCore::DOMTimer::fired):
(WebCore::DOMTimer::suspend):
(WebCore::DOMTimer::resume):
(WebCore::DOMTimer::canSuspend):
* page/DOMTimer.h:
(WebCore::DOMTimer::minTimerInterval):
(WebCore::DOMTimer::setMinTimerInterval):
2009-07-24 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
......
......@@ -54,7 +54,7 @@ DOMTimer::DOMTimer(ScriptExecutionContext* context, ScheduledAction* action, int
if (lastUsedTimeoutId <= 0)
lastUsedTimeoutId = 1;
m_timeoutId = lastUsedTimeoutId;
m_nestingLevel = timerNestingLevel + 1;
scriptExecutionContext()->addTimeout(m_timeoutId, this);
......@@ -74,11 +74,10 @@ DOMTimer::DOMTimer(ScriptExecutionContext* context, ScheduledAction* action, int
DOMTimer::~DOMTimer()
{
if (scriptExecutionContext()) {
if (scriptExecutionContext())
scriptExecutionContext()->removeTimeout(m_timeoutId);
}
}
int DOMTimer::install(ScriptExecutionContext* context, ScheduledAction* action, int timeout, bool singleShot)
{
// DOMTimer constructor links the new timer into a list of ActiveDOMObjects held by the 'context'.
......@@ -110,7 +109,7 @@ void DOMTimer::fired()
if (m_nestingLevel >= maxTimerNestingLevel)
augmentRepeatInterval(s_minTimerInterval - repeatInterval());
}
// No access to member variables after this point, it can delete the timer.
m_action->execute(context);
return;
......@@ -121,7 +120,7 @@ void DOMTimer::fired()
// No access to member variables after this point.
delete this;
action->execute(context);
delete action;
timerNestingLevel = 0;
......@@ -147,24 +146,24 @@ void DOMTimer::stop()
m_action.clear();
}
void DOMTimer::suspend()
{
ASSERT(m_nextFireInterval == 0 && m_repeatInterval == 0);
void DOMTimer::suspend()
{
ASSERT(!m_nextFireInterval && !m_repeatInterval);
m_nextFireInterval = nextFireInterval();
m_repeatInterval = repeatInterval();
TimerBase::stop();
}
void DOMTimer::resume()
{
}
void DOMTimer::resume()
{
start(m_nextFireInterval, m_repeatInterval);
m_nextFireInterval = 0;
m_repeatInterval = 0;
}
bool DOMTimer::canSuspend() const
{
}
bool DOMTimer::canSuspend() const
{
return true;
}
......
......@@ -33,41 +33,41 @@
namespace WebCore {
class ScheduledAction;
class ScheduledAction;
class DOMTimer : public TimerBase, public ActiveDOMObject {
public:
virtual ~DOMTimer();
// Creates a new timer owned by specified ScriptExecutionContext, starts it
// and returns its Id.
static int install(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);
static void removeById(ScriptExecutionContext*, int timeoutId);
class DOMTimer : public TimerBase, public ActiveDOMObject {
public:
virtual ~DOMTimer();
// Creates a new timer owned by specified ScriptExecutionContext, starts it
// and returns its Id.
static int install(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);
static void removeById(ScriptExecutionContext*, int timeoutId);
// ActiveDOMObject
virtual bool hasPendingActivity() const;
virtual void contextDestroyed();
virtual void stop();
virtual bool canSuspend() const;
virtual void suspend();
virtual void resume();
// ActiveDOMObject
virtual bool hasPendingActivity() const;
virtual void contextDestroyed();
virtual void stop();
virtual bool canSuspend() const;
virtual void suspend();
virtual void resume();
// The lowest allowable timer setting (in seconds, 0.001 == 1 ms).
// Default is 10ms.
// Chromium uses a non-default timeout.
static double minTimerInterval() { return s_minTimerInterval; }
static void setMinTimerInterval(double value) { s_minTimerInterval = value; }
// The lowest allowable timer setting (in seconds, 0.001 == 1 ms).
// Default is 10ms.
// Chromium uses a non-default timeout.
static double minTimerInterval() { return s_minTimerInterval; }
static void setMinTimerInterval(double value) { s_minTimerInterval = value; }
private:
DOMTimer(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);
virtual void fired();
private:
DOMTimer(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);
virtual void fired();
int m_timeoutId;
int m_nestingLevel;
OwnPtr<ScheduledAction> m_action;
double m_nextFireInterval;
double m_repeatInterval;
static double s_minTimerInterval;
};
int m_timeoutId;
int m_nestingLevel;
OwnPtr<ScheduledAction> m_action;
double m_nextFireInterval;
double m_repeatInterval;
static double s_minTimerInterval;
};
} // namespace WebCore
......
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