layout/printing/nsPagePrintTimer.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     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___
     8 // Timer Includes
     9 #include "nsITimer.h"
    11 #include "nsIDocumentViewerPrint.h"
    12 #include "nsPrintObject.h"
    13 #include "mozilla/Attributes.h"
    14 #include "nsThreadUtils.h"
    16 class nsPrintEngine;
    18 //---------------------------------------------------
    19 //-- Page Timer Class
    20 //---------------------------------------------------
    21 class nsPagePrintTimer MOZ_FINAL : public nsRunnable,
    22                                    public nsITimerCallback
    23 {
    24 public:
    26   NS_DECL_ISUPPORTS
    28   nsPagePrintTimer(nsPrintEngine* aPrintEngine,
    29                    nsIDocumentViewerPrint* aDocViewerPrint,
    30                    uint32_t aDelay)
    31     : mPrintEngine(aPrintEngine)
    32     , mDocViewerPrint(aDocViewerPrint)
    33     , mDelay(aDelay)
    34     , mFiringCount(0)
    35     , mPrintObj(nullptr)
    36     , mWatchDogCount(0)
    37     , mDone(false)
    38   {
    39     mDocViewerPrint->IncrementDestroyRefCount();
    40   }
    41   ~nsPagePrintTimer();
    43   NS_DECL_NSITIMERCALLBACK
    45   nsresult Start(nsPrintObject* aPO);
    47   NS_IMETHOD Run() MOZ_OVERRIDE;
    49   void Stop();
    51 private:
    52   nsresult StartTimer(bool aUseDelay);
    53   nsresult StartWatchDogTimer();
    54   void     StopWatchDogTimer();
    55   void     Fail();
    57   nsPrintEngine*             mPrintEngine;
    58   nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
    59   nsCOMPtr<nsITimer>         mTimer;
    60   nsCOMPtr<nsITimer>         mWatchDogTimer;
    61   uint32_t                   mDelay;
    62   uint32_t                   mFiringCount;
    63   nsPrintObject *            mPrintObj;
    64   uint32_t                   mWatchDogCount;
    65   bool                       mDone;
    67   static const uint32_t WATCH_DOG_INTERVAL  = 1000;
    68   static const uint32_t WATCH_DOG_MAX_COUNT = 10;
    69 };
    72 nsresult
    73 NS_NewPagePrintTimer(nsPagePrintTimer **aResult);
    75 #endif /* nsPagePrintTimer_h___ */

mercurial