1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsPagePrintTimer_h___
6 #define nsPagePrintTimer_h___
11 #include "nsIDocumentViewerPrint.h"
12 #include "nsPrintObject.h"
13 #include "mozilla/Attributes.h"
14 #include "nsThreadUtils.h"
18 //---------------------------------------------------
20 //---------------------------------------------------
21 class nsPagePrintTimer MOZ_FINAL
: public nsRunnable
,
22 public nsITimerCallback
26 NS_DECL_ISUPPORTS_INHERITED
28 nsPagePrintTimer(nsPrintEngine
* aPrintEngine
,
29 nsIDocumentViewerPrint
* aDocViewerPrint
,
31 : mPrintEngine(aPrintEngine
)
32 , mDocViewerPrint(aDocViewerPrint
)
39 mDocViewerPrint
->IncrementDestroyRefCount();
42 NS_DECL_NSITIMERCALLBACK
44 nsresult
Start(nsPrintObject
* aPO
);
46 NS_IMETHOD
Run() MOZ_OVERRIDE
;
53 nsresult
StartTimer(bool aUseDelay
);
54 nsresult
StartWatchDogTimer();
55 void StopWatchDogTimer();
58 nsPrintEngine
* mPrintEngine
;
59 nsCOMPtr
<nsIDocumentViewerPrint
> mDocViewerPrint
;
60 nsCOMPtr
<nsITimer
> mTimer
;
61 nsCOMPtr
<nsITimer
> mWatchDogTimer
;
63 uint32_t mFiringCount
;
64 nsPrintObject
* mPrintObj
;
65 uint32_t mWatchDogCount
;
68 static const uint32_t WATCH_DOG_INTERVAL
= 1000;
69 static const uint32_t WATCH_DOG_MAX_COUNT
= 10;
74 NS_NewPagePrintTimer(nsPagePrintTimer
**aResult
);
76 #endif /* nsPagePrintTimer_h___ */