зеркало из https://github.com/mozilla/gecko-dev.git
Fixed some timer issues that crashed the Mac. r=mmclusk sr=attinasi b=74083
This commit is contained in:
Родитель
096c704d7a
Коммит
3072888e9a
|
@ -416,6 +416,22 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
nsresult startTimer()
|
||||||
|
{
|
||||||
|
nsresult result;
|
||||||
|
|
||||||
|
mTimer = do_CreateInstance("@mozilla.org/timer;1", &result);
|
||||||
|
if (NS_FAILED(result)){
|
||||||
|
NS_WARNING("unable to start the timer");
|
||||||
|
} else {
|
||||||
|
mTimer->Init(this, mDelay, NS_PRIORITY_NORMAL, NS_TYPE_ONE_SHOT);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// nsITimerCallback
|
// nsITimerCallback
|
||||||
NS_IMETHOD_(void) Notify(nsITimer *timer)
|
NS_IMETHOD_(void) Notify(nsITimer *timer)
|
||||||
{
|
{
|
||||||
|
@ -429,6 +445,13 @@ public:
|
||||||
if (mDocViewer->DonePrintingPages()) {
|
if (mDocViewer->DonePrintingPages()) {
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
nsresult result;
|
||||||
|
Stop();
|
||||||
|
result = startTimer();
|
||||||
|
if (NS_FAILED(result)){
|
||||||
|
donePrinting = PR_TRUE; // had a failure.. we are finished..
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,16 +473,7 @@ public:
|
||||||
PRUint32 aDelay)
|
PRUint32 aDelay)
|
||||||
{
|
{
|
||||||
Init(aDocViewerImpl, aPresContext, aPrintOptions, aDelay);
|
Init(aDocViewerImpl, aPresContext, aPrintOptions, aDelay);
|
||||||
|
return startTimer();
|
||||||
if (!mTimer) {
|
|
||||||
nsresult result;
|
|
||||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &result);
|
|
||||||
|
|
||||||
if (NS_FAILED(result))
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mTimer->Init(this, mDelay, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop() { if (mTimer) mTimer->Cancel(); }
|
void Stop() { if (mTimer) mTimer->Cancel(); }
|
||||||
|
|
|
@ -416,6 +416,22 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
nsresult startTimer()
|
||||||
|
{
|
||||||
|
nsresult result;
|
||||||
|
|
||||||
|
mTimer = do_CreateInstance("@mozilla.org/timer;1", &result);
|
||||||
|
if (NS_FAILED(result)){
|
||||||
|
NS_WARNING("unable to start the timer");
|
||||||
|
} else {
|
||||||
|
mTimer->Init(this, mDelay, NS_PRIORITY_NORMAL, NS_TYPE_ONE_SHOT);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// nsITimerCallback
|
// nsITimerCallback
|
||||||
NS_IMETHOD_(void) Notify(nsITimer *timer)
|
NS_IMETHOD_(void) Notify(nsITimer *timer)
|
||||||
{
|
{
|
||||||
|
@ -429,6 +445,13 @@ public:
|
||||||
if (mDocViewer->DonePrintingPages()) {
|
if (mDocViewer->DonePrintingPages()) {
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
nsresult result;
|
||||||
|
Stop();
|
||||||
|
result = startTimer();
|
||||||
|
if (NS_FAILED(result)){
|
||||||
|
donePrinting = PR_TRUE; // had a failure.. we are finished..
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,16 +473,7 @@ public:
|
||||||
PRUint32 aDelay)
|
PRUint32 aDelay)
|
||||||
{
|
{
|
||||||
Init(aDocViewerImpl, aPresContext, aPrintOptions, aDelay);
|
Init(aDocViewerImpl, aPresContext, aPrintOptions, aDelay);
|
||||||
|
return startTimer();
|
||||||
if (!mTimer) {
|
|
||||||
nsresult result;
|
|
||||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &result);
|
|
||||||
|
|
||||||
if (NS_FAILED(result))
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mTimer->Init(this, mDelay, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop() { if (mTimer) mTimer->Cancel(); }
|
void Stop() { if (mTimer) mTimer->Cancel(); }
|
||||||
|
|
Загрузка…
Ссылка в новой задаче