Bug 1430682 - Use OwningNonNull for nsPagePrintTimer::mDocViewerPrint and remove null checks. r=bobowen

MozReview-Commit-ID: 5CPaYTA2PrC
This commit is contained in:
Jonathan Watt 2018-01-09 22:21:53 +00:00
Родитель 706256a2cc
Коммит e04dd6678d
2 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@ -140,24 +140,22 @@ nsPagePrintTimer::Notify(nsITimer *timer)
}
}
if (mDocViewerPrint) {
bool donePrePrint = true;
// Don't start to pre-print if we're waiting on the parent still.
if (mPrintJob && !mWaitingForRemotePrint) {
donePrePrint = mPrintJob->PrePrintPage();
}
if (donePrePrint && !mWaitingForRemotePrint) {
StopWatchDogTimer();
// Pass nullptr here since name already was set in constructor.
mDocument->Dispatch(TaskCategory::Other, do_AddRef(this));
} else {
// Start the watch dog if we're waiting for preprint to ensure that if any
// mozPrintCallbacks take to long we error out.
StartWatchDogTimer();
}
bool donePrePrint = true;
// Don't start to pre-print if we're waiting on the parent still.
if (mPrintJob && !mWaitingForRemotePrint) {
donePrePrint = mPrintJob->PrePrintPage();
}
if (donePrePrint && !mWaitingForRemotePrint) {
StopWatchDogTimer();
// Pass nullptr here since name already was set in constructor.
mDocument->Dispatch(TaskCategory::Other, do_AddRef(this));
} else {
// Start the watch dog if we're waiting for preprint to ensure that if any
// mozPrintCallbacks take to long we error out.
StartWatchDogTimer();
}
return NS_OK;
}

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsIDocumentViewerPrint.h"
#include "nsPrintObject.h"
#include "mozilla/Attributes.h"
#include "mozilla/OwningNonNull.h"
#include "nsThreadUtils.h"
class nsPrintJob;
@ -33,7 +34,7 @@ public:
uint32_t aDelay)
: Runnable("nsPagePrintTimer")
, mPrintJob(aPrintJob)
, mDocViewerPrint(aDocViewerPrint)
, mDocViewerPrint(*aDocViewerPrint)
, mDocument(aDocument)
, mDelay(aDelay)
, mFiringCount(0)
@ -41,7 +42,7 @@ public:
, mWatchDogCount(0)
, mDone(false)
{
MOZ_ASSERT(aDocument);
MOZ_ASSERT(aDocViewerPrint && aDocument);
mDocViewerPrint->IncrementDestroyBlockedCount();
}
@ -71,7 +72,7 @@ private:
void Fail();
nsPrintJob* mPrintJob;
nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
const mozilla::OwningNonNull<nsIDocumentViewerPrint> mDocViewerPrint;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsITimer> mTimer;
nsCOMPtr<nsITimer> mWatchDogTimer;