mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Fixing a test-stopping bug, approved by sar.
This commit is contained in:
parent
2108b03575
commit
440b822263
@ -39,6 +39,7 @@ Repeater::~Repeater()
|
||||
|
||||
// protected helper functs
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void Repeater::AddToRepeatList()
|
||||
{
|
||||
if (sRepeaters)
|
||||
@ -48,6 +49,8 @@ void Repeater::AddToRepeatList()
|
||||
}
|
||||
sRepeaters = this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void Repeater::RemoveFromRepeatList()
|
||||
{
|
||||
if (sRepeaters == this) sRepeaters = mNextRptr;
|
||||
@ -56,18 +59,22 @@ void Repeater::RemoveFromRepeatList()
|
||||
mPrevRptr = 0;
|
||||
mNextRptr = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void Repeater::AddToIdleList()
|
||||
{
|
||||
if (sRepeaters)
|
||||
if (sIdlers)
|
||||
{
|
||||
sRepeaters->mPrevIdlr = this;
|
||||
mNextIdlr = sRepeaters;
|
||||
sIdlers->mPrevIdlr = this;
|
||||
mNextIdlr = sIdlers;
|
||||
}
|
||||
sRepeaters = this;
|
||||
sIdlers = this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void Repeater::RemoveFromIdleList()
|
||||
{
|
||||
if (sRepeaters == this) sRepeaters = mNextIdlr;
|
||||
if (sIdlers == this) sIdlers = mNextIdlr;
|
||||
if (mPrevIdlr) mPrevIdlr->mNextIdlr = mNextIdlr;
|
||||
if (mNextIdlr) mNextIdlr->mPrevIdlr = mPrevIdlr;
|
||||
mPrevIdlr = 0;
|
||||
@ -75,6 +82,7 @@ void Repeater::RemoveFromIdleList()
|
||||
}
|
||||
|
||||
// repeater methods
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void Repeater::StartRepeating()
|
||||
{
|
||||
|
@ -77,9 +77,23 @@ class TimerImpl : public nsITimer
|
||||
|
||||
virtual void* GetClosure();
|
||||
|
||||
#if DEBUG
|
||||
enum {
|
||||
eGoodTimerSignature = 'Barf',
|
||||
eDeletedTimerSignature = 'oops'
|
||||
};
|
||||
|
||||
Boolean IsGoodTimer() { return (mSignature == eGoodTimerSignature); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Calculates mFireTime too
|
||||
void SetDelaySelf( PRUint32 aDelay );
|
||||
|
||||
#if DEBUG
|
||||
UInt32 mSignature;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#pragma mark class TimerPeriodical
|
||||
@ -126,6 +140,7 @@ TimerImpl::TimerImpl()
|
||||
, mClosure(nsnull)
|
||||
, mDelay(0)
|
||||
, mFireTime(0)
|
||||
, mSignature(eGoodTimerSignature)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
@ -136,6 +151,7 @@ TimerImpl::~TimerImpl()
|
||||
{
|
||||
Cancel();
|
||||
NS_IF_RELEASE(mCallbackObject);
|
||||
mSignature = eDeletedTimerSignature;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@ -265,7 +281,10 @@ void TimerPeriodical::RepeatAction( const EventRecord &inMacEvent)
|
||||
|
||||
while (iter != mTimers.end())
|
||||
{
|
||||
TimerImpl* timer = *iter;
|
||||
TimerImpl* timer = *iter;
|
||||
|
||||
NS_ASSERTION(timer->IsGoodTimer(), "Bad timer!");
|
||||
|
||||
if (timer->GetFireTime() <= inMacEvent.when)
|
||||
{
|
||||
mTimers.erase(iter++);
|
||||
|
Loading…
Reference in New Issue
Block a user