зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1661137 - Decrement the document viewer's destroy blocker earlier. r=bobowen
Do it as soon as we're done printing, rather than waiting until the print timer dies. Differential Revision: https://phabricator.services.mozilla.com/D88569
This commit is contained in:
Родитель
171d05204b
Коммит
1e6084fb60
|
@ -14,9 +14,16 @@ using namespace mozilla;
|
|||
NS_IMPL_ISUPPORTS_INHERITED(nsPagePrintTimer, mozilla::Runnable,
|
||||
nsITimerCallback)
|
||||
|
||||
nsPagePrintTimer::~nsPagePrintTimer() {
|
||||
nsPagePrintTimer::~nsPagePrintTimer() { Disconnect(); }
|
||||
|
||||
void nsPagePrintTimer::Disconnect() {
|
||||
mPrintJob = nullptr;
|
||||
mPrintObj = nullptr;
|
||||
if (mDocViewerPrint) {
|
||||
// This matches the IncrementDestroyBlockedCount call in the constructor.
|
||||
mDocViewerPrint->DecrementDestroyBlockedCount();
|
||||
mDocViewerPrint = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsPagePrintTimer::StartTimer(bool aUseDelay) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class nsPagePrintTimer final : public mozilla::Runnable,
|
|||
mozilla::dom::Document* aDocument, uint32_t aDelay)
|
||||
: Runnable("nsPagePrintTimer"),
|
||||
mPrintJob(aPrintJob),
|
||||
mDocViewerPrint(*aDocViewerPrint),
|
||||
mDocViewerPrint(aDocViewerPrint),
|
||||
mDocument(aDocument),
|
||||
mDelay(aDelay),
|
||||
mFiringCount(0),
|
||||
|
@ -52,10 +52,7 @@ class nsPagePrintTimer final : public mozilla::Runnable,
|
|||
void WaitForRemotePrint();
|
||||
void RemotePrintFinished();
|
||||
|
||||
void Disconnect() {
|
||||
mPrintJob = nullptr;
|
||||
mPrintObj = nullptr;
|
||||
}
|
||||
void Disconnect();
|
||||
|
||||
private:
|
||||
~nsPagePrintTimer();
|
||||
|
@ -66,7 +63,7 @@ class nsPagePrintTimer final : public mozilla::Runnable,
|
|||
void Fail();
|
||||
|
||||
nsPrintJob* mPrintJob;
|
||||
const mozilla::OwningNonNull<nsIDocumentViewerPrint> mDocViewerPrint;
|
||||
nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
|
||||
RefPtr<mozilla::dom::Document> mDocument;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsITimer> mWatchDogTimer;
|
||||
|
|
|
@ -2556,9 +2556,8 @@ nsresult nsPrintJob::StartPagePrintTimer(const UniquePtr<nsPrintObject>& aPO) {
|
|||
nsCOMPtr<Document> doc = cv->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
RefPtr<nsPagePrintTimer> timer =
|
||||
mPagePrintTimer =
|
||||
new nsPagePrintTimer(this, mDocViewerPrint, doc, printPageDelay);
|
||||
timer.forget(&mPagePrintTimer);
|
||||
|
||||
nsCOMPtr<nsIPrintSession> printSession;
|
||||
nsresult rv =
|
||||
|
|
Загрузка…
Ссылка в новой задаче