Changeset 46324 in webkit
- Timestamp:
- Jul 24, 2009 12:28:44 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r46322 r46324 1 2009-07-24 Mike Fenton <mike.fenton@torchmobile.com> 2 3 Reviewed by Eric Seidel. 4 5 Update WebCore/page/DOMTimer.cpp/h to conform to WebKit 6 Style Guidelines as identified by cpplint.py. 7 https://bugs.webkit.org/show_bug.cgi?id=27618 8 9 * page/DOMTimer.cpp: 10 (WebCore::DOMTimer::DOMTimer): 11 (WebCore::DOMTimer::~DOMTimer): 12 (WebCore::DOMTimer::fired): 13 (WebCore::DOMTimer::suspend): 14 (WebCore::DOMTimer::resume): 15 (WebCore::DOMTimer::canSuspend): 16 * page/DOMTimer.h: 17 (WebCore::DOMTimer::minTimerInterval): 18 (WebCore::DOMTimer::setMinTimerInterval): 19 1 20 2009-07-24 Eric Seidel <eric@webkit.org> 2 21 -
trunk/WebCore/page/DOMTimer.cpp
r41878 r46324 55 55 lastUsedTimeoutId = 1; 56 56 m_timeoutId = lastUsedTimeoutId; 57 57 58 58 m_nestingLevel = timerNestingLevel + 1; 59 59 … … 75 75 DOMTimer::~DOMTimer() 76 76 { 77 if (scriptExecutionContext()) {77 if (scriptExecutionContext()) 78 78 scriptExecutionContext()->removeTimeout(m_timeoutId); 79 }80 79 } 81 80 82 81 int DOMTimer::install(ScriptExecutionContext* context, ScheduledAction* action, int timeout, bool singleShot) 83 82 { … … 111 110 augmentRepeatInterval(s_minTimerInterval - repeatInterval()); 112 111 } 113 112 114 113 // No access to member variables after this point, it can delete the timer. 115 114 m_action->execute(context); … … 122 121 // No access to member variables after this point. 123 122 delete this; 124 123 125 124 action->execute(context); 126 125 delete action; … … 148 147 } 149 148 150 void DOMTimer::suspend() 151 { 152 ASSERT( m_nextFireInterval == 0 && m_repeatInterval == 0);149 void DOMTimer::suspend() 150 { 151 ASSERT(!m_nextFireInterval && !m_repeatInterval); 153 152 m_nextFireInterval = nextFireInterval(); 154 153 m_repeatInterval = repeatInterval(); 155 154 TimerBase::stop(); 156 } 157 158 void DOMTimer::resume() 159 { 155 } 156 157 void DOMTimer::resume() 158 { 160 159 start(m_nextFireInterval, m_repeatInterval); 161 160 m_nextFireInterval = 0; 162 161 m_repeatInterval = 0; 163 } 164 165 166 bool DOMTimer::canSuspend() const 167 { 162 } 163 164 165 bool DOMTimer::canSuspend() const 166 { 168 167 return true; 169 168 } -
trunk/WebCore/page/DOMTimer.h
r41878 r46324 34 34 namespace WebCore { 35 35 36 class ScheduledAction;36 class ScheduledAction; 37 37 38 class DOMTimer : public TimerBase, public ActiveDOMObject {39 public:40 virtual ~DOMTimer();41 // Creates a new timer owned by specified ScriptExecutionContext, starts it42 // and returns its Id.43 static int install(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);44 static void removeById(ScriptExecutionContext*, int timeoutId);38 class DOMTimer : public TimerBase, public ActiveDOMObject { 39 public: 40 virtual ~DOMTimer(); 41 // Creates a new timer owned by specified ScriptExecutionContext, starts it 42 // and returns its Id. 43 static int install(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot); 44 static void removeById(ScriptExecutionContext*, int timeoutId); 45 45 46 // ActiveDOMObject47 virtual bool hasPendingActivity() const;48 virtual void contextDestroyed();49 virtual void stop();50 virtual bool canSuspend() const;51 virtual void suspend();52 virtual void resume();46 // ActiveDOMObject 47 virtual bool hasPendingActivity() const; 48 virtual void contextDestroyed(); 49 virtual void stop(); 50 virtual bool canSuspend() const; 51 virtual void suspend(); 52 virtual void resume(); 53 53 54 // The lowest allowable timer setting (in seconds, 0.001 == 1 ms).55 // Default is 10ms.56 // Chromium uses a non-default timeout.57 static double minTimerInterval() { return s_minTimerInterval; }58 static void setMinTimerInterval(double value) { s_minTimerInterval = value; }54 // The lowest allowable timer setting (in seconds, 0.001 == 1 ms). 55 // Default is 10ms. 56 // Chromium uses a non-default timeout. 57 static double minTimerInterval() { return s_minTimerInterval; } 58 static void setMinTimerInterval(double value) { s_minTimerInterval = value; } 59 59 60 private:61 DOMTimer(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot);62 virtual void fired();60 private: 61 DOMTimer(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot); 62 virtual void fired(); 63 63 64 int m_timeoutId;65 int m_nestingLevel;66 OwnPtr<ScheduledAction> m_action;67 double m_nextFireInterval;68 double m_repeatInterval;69 static double s_minTimerInterval;70 };64 int m_timeoutId; 65 int m_nestingLevel; 66 OwnPtr<ScheduledAction> m_action; 67 double m_nextFireInterval; 68 double m_repeatInterval; 69 static double s_minTimerInterval; 70 }; 71 71 72 72 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.