mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 776979 - consolidate InitWithFuncCallback calls into nsTimeout::InitTimer; r=bz
This commit is contained in:
parent
48bb60b4c6
commit
e1ccd4902c
@ -9400,9 +9400,7 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
|
||||
|
||||
nsRefPtr<nsTimeout> copy = timeout;
|
||||
|
||||
rv = timeout->mTimer->InitWithFuncCallback(TimerCallback, timeout,
|
||||
realInterval,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
rv = timeout->InitTimer(TimerCallback, realInterval);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -9637,10 +9635,7 @@ nsGlobalWindow::RescheduleTimeout(nsTimeout* aTimeout, const TimeStamp& now,
|
||||
// platforms whether delay is positive or negative (which we
|
||||
// know is always positive here, but cast anyways for
|
||||
// consistency).
|
||||
nsresult rv = aTimeout->mTimer->
|
||||
InitWithFuncCallback(TimerCallback, aTimeout,
|
||||
delay.ToMilliseconds(),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
nsresult rv = aTimeout->InitTimer(TimerCallback, delay.ToMilliseconds());
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Error initializing timer for DOM timeout!");
|
||||
@ -9982,11 +9977,7 @@ nsresult nsGlobalWindow::ResetTimersForNonBackgroundWindow()
|
||||
timeout->mFiringDepth = firingDepth;
|
||||
timeout->Release();
|
||||
|
||||
nsresult rv =
|
||||
timeout->mTimer->InitWithFuncCallback(TimerCallback,
|
||||
timeout,
|
||||
delay.ToMilliseconds(),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
nsresult rv = timeout->InitTimer(TimerCallback, delay.ToMilliseconds());
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Error resetting non background timer for DOM timeout!");
|
||||
@ -10499,8 +10490,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren)
|
||||
t->mTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
NS_ENSURE_TRUE(t->mTimer, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = t->mTimer->InitWithFuncCallback(TimerCallback, t, delay,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
rv = t->InitTimer(TimerCallback, delay);
|
||||
if (NS_FAILED(rv)) {
|
||||
t->mTimer = nsnull;
|
||||
return rv;
|
||||
|
@ -153,6 +153,11 @@ struct nsTimeout : PRCList
|
||||
return static_cast<nsTimeout*>(PR_PREV_LINK(this));
|
||||
}
|
||||
|
||||
nsresult InitTimer(nsTimerCallbackFunc aFunc, PRUint64 delay) {
|
||||
return mTimer->InitWithFuncCallback(aFunc, this, delay,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
// Window for which this timeout fires
|
||||
nsRefPtr<nsGlobalWindow> mWindow;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user