зеркало из https://github.com/mozilla/pjs.git
bug 118061 Adding NS_NewTimer r=dveditz sr=sfraser
This commit is contained in:
Родитель
6cdbd25563
Коммит
a39dd81ba9
|
@ -152,4 +152,7 @@ public:
|
|||
NS_IMETHOD_(void*) GetClosure() = 0;
|
||||
};
|
||||
|
||||
extern NS_COM nsresult
|
||||
NS_NewTimer(nsITimer* *aResult, nsTimerCallbackFunc aCallback, void *aClosure,
|
||||
PRUint32 aDelay, PRUint32 aPriority, PRUint32 aType);
|
||||
#endif // nsITimer_h___
|
||||
|
|
|
@ -353,3 +353,22 @@ void nsTimerImpl::SetDelayInternal(PRUint32 aDelay)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewTimer(nsITimer* *aResult, nsTimerCallbackFunc aCallback, void *aClosure,
|
||||
PRUint32 aDelay, PRUint32 aPriority, PRUint32 aType)
|
||||
{
|
||||
nsTimerImpl* timer = new nsTimerImpl();
|
||||
if (timer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(timer);
|
||||
|
||||
nsresult rv = timer->Init(aCallback, aClosure, aDelay, aPriority, aType);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(timer);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aResult = timer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче