зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ee20d9c4b63c (bug 1342872) for crash if printing from print preview.
This commit is contained in:
Родитель
cf8bee36b5
Коммит
400c5650b3
|
@ -10,8 +10,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsPrintEngine.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsPagePrintTimer, mozilla::Runnable, nsITimerCallback)
|
||||
|
||||
nsPagePrintTimer::~nsPagePrintTimer()
|
||||
|
@ -26,7 +24,7 @@ nsPagePrintTimer::~nsPagePrintTimer()
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPagePrintTimer::StartTimer(bool aUseDelay)
|
||||
{
|
||||
nsresult result;
|
||||
|
@ -43,7 +41,6 @@ nsPagePrintTimer::StartTimer(bool aUseDelay)
|
|||
delay = mDelay;
|
||||
}
|
||||
}
|
||||
mTimer->SetTarget(mDocument->EventTargetFor(TaskCategory::Other));
|
||||
mTimer->InitWithCallback(this, delay, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
return result;
|
||||
|
@ -62,7 +59,6 @@ nsPagePrintTimer::StartWatchDogTimer()
|
|||
} else {
|
||||
// Instead of just doing one timer for a long period do multiple so we
|
||||
// can check if the user cancelled the printing.
|
||||
mWatchDogTimer->SetTarget(mDocument->EventTargetFor(TaskCategory::Other));
|
||||
mWatchDogTimer->InitWithCallback(this, WATCH_DOG_INTERVAL,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
@ -162,8 +158,7 @@ nsPagePrintTimer::Notify(nsITimer *timer)
|
|||
|
||||
if (donePrePrint && !mWaitingForRemotePrint) {
|
||||
StopWatchDogTimer();
|
||||
// Pass nullptr here since name already was set in constructor.
|
||||
mDocument->Dispatch(nullptr, TaskCategory::Other, do_AddRef(this));
|
||||
NS_DispatchToMainThread(this);
|
||||
} else {
|
||||
// Start the watch dog if we're waiting for preprint to ensure that if any
|
||||
// mozPrintCallbacks take to long we error out.
|
||||
|
@ -193,13 +188,11 @@ nsPagePrintTimer::RemotePrintFinished()
|
|||
return;
|
||||
}
|
||||
|
||||
mWaitingForRemotePrint->SetTarget(
|
||||
mDocument->EventTargetFor(mozilla::TaskCategory::Other));
|
||||
mozilla::Unused <<
|
||||
mWaitingForRemotePrint->InitWithCallback(this, 0, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPagePrintTimer::Start(nsPrintObject* aPO)
|
||||
{
|
||||
mPrintObj = aPO;
|
||||
|
@ -208,7 +201,7 @@ nsPagePrintTimer::Start(nsPrintObject* aPO)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
nsPagePrintTimer::Stop()
|
||||
{
|
||||
if (mTimer) {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsThreadUtils.h"
|
||||
|
||||
class nsPrintEngine;
|
||||
class nsIDocument;
|
||||
|
||||
//---------------------------------------------------
|
||||
//-- Page Timer Class
|
||||
|
@ -28,19 +27,15 @@ public:
|
|||
|
||||
nsPagePrintTimer(nsPrintEngine* aPrintEngine,
|
||||
nsIDocumentViewerPrint* aDocViewerPrint,
|
||||
nsIDocument* aDocument,
|
||||
uint32_t aDelay)
|
||||
: Runnable("nsPagePrintTimer")
|
||||
, mPrintEngine(aPrintEngine)
|
||||
: mPrintEngine(aPrintEngine)
|
||||
, mDocViewerPrint(aDocViewerPrint)
|
||||
, mDocument(aDocument)
|
||||
, mDelay(aDelay)
|
||||
, mFiringCount(0)
|
||||
, mPrintObj(nullptr)
|
||||
, mWatchDogCount(0)
|
||||
, mDone(false)
|
||||
{
|
||||
MOZ_ASSERT(aDocument);
|
||||
mDocViewerPrint->IncrementDestroyRefCount();
|
||||
}
|
||||
|
||||
|
@ -67,7 +62,6 @@ private:
|
|||
|
||||
nsPrintEngine* mPrintEngine;
|
||||
nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsITimer> mWatchDogTimer;
|
||||
nsCOMPtr<nsITimer> mWaitingForRemotePrint;
|
||||
|
|
|
@ -3495,15 +3495,11 @@ nsPrintEngine::StartPagePrintTimer(const UniquePtr<nsPrintObject>& aPO)
|
|||
if (!mPagePrintTimer) {
|
||||
// Get the delay time in between the printing of each page
|
||||
// this gives the user more time to press cancel
|
||||
if (!mDocument) {
|
||||
MOZ_LOG(gPrintingLog, LogLevel::Error,("Error! mDocument is NULL"));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
int32_t printPageDelay = 50;
|
||||
mPrt->mPrintSettings->GetPrintPageDelay(&printPageDelay);
|
||||
|
||||
RefPtr<nsPagePrintTimer> timer =
|
||||
new nsPagePrintTimer(this, mDocViewerPrint, mDocument, printPageDelay);
|
||||
new nsPagePrintTimer(this, mDocViewerPrint, printPageDelay);
|
||||
timer.forget(&mPagePrintTimer);
|
||||
|
||||
nsCOMPtr<nsIPrintSession> printSession;
|
||||
|
|
Загрузка…
Ссылка в новой задаче