bug 118061 Adding NS_NewTimer r=dveditz sr=sfraser

git-svn-id: svn://10.0.0.236/trunk@112666 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dp%netscape.com 2002-01-24 06:37:38 +00:00
parent e262b0cb89
commit 826c21e7bc
2 changed files with 22 additions and 0 deletions

View File

@ -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___

View File

@ -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;
}