gecko-dev/layout/printing/nsPagePrintTimer.h
Daniel Holbert 680815cd6e Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK

--HG--
extra : rebase_source : 3356d4b80ff6213935192e87cdbc9103fec6084c
2017-10-27 10:33:53 -07:00

97 lines
2.6 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPagePrintTimer_h___
#define nsPagePrintTimer_h___
// Timer Includes
#include "nsITimer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsPrintObject.h"
#include "mozilla/Attributes.h"
#include "nsThreadUtils.h"
class nsPrintEngine;
class nsIDocument;
//---------------------------------------------------
//-- Page Timer Class
//---------------------------------------------------
class nsPagePrintTimer final : public mozilla::Runnable,
public nsITimerCallback
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsPagePrintTimer(nsPrintEngine* aPrintEngine,
nsIDocumentViewerPrint* aDocViewerPrint,
nsIDocument* aDocument,
uint32_t aDelay)
: Runnable("nsPagePrintTimer")
, mPrintEngine(aPrintEngine)
, mDocViewerPrint(aDocViewerPrint)
, mDocument(aDocument)
, mDelay(aDelay)
, mFiringCount(0)
, mPrintObj(nullptr)
, mWatchDogCount(0)
, mDone(false)
{
MOZ_ASSERT(aDocument);
mDocViewerPrint->IncrementDestroyRefCount();
}
NS_DECL_NSITIMERCALLBACK
nsresult Start(nsPrintObject* aPO);
NS_IMETHOD Run() override;
void Stop();
void WaitForRemotePrint();
void RemotePrintFinished();
void Disconnect()
{
mPrintEngine = nullptr;
mPrintObj = nullptr;
}
private:
~nsPagePrintTimer();
nsresult StartTimer(bool aUseDelay);
nsresult StartWatchDogTimer();
void StopWatchDogTimer();
void Fail();
nsPrintEngine* mPrintEngine;
nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsITimer> mTimer;
nsCOMPtr<nsITimer> mWatchDogTimer;
nsCOMPtr<nsITimer> mWaitingForRemotePrint;
uint32_t mDelay;
uint32_t mFiringCount;
nsPrintObject * mPrintObj;
uint32_t mWatchDogCount;
bool mDone;
static const uint32_t WATCH_DOG_INTERVAL = 1000;
static const uint32_t WATCH_DOG_MAX_COUNT =
#ifdef DEBUG
// Debug builds are very slow (on Mac at least) and can need extra time
30
#else
10
#endif
;
};
#endif /* nsPagePrintTimer_h___ */