LCOV - code coverage report
Current view: top level - layout/printing - nsPagePrintTimer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 10 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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___
       7             : 
       8             : // Timer Includes
       9             : #include "nsITimer.h"
      10             : 
      11             : #include "nsIDocumentViewerPrint.h"
      12             : #include "nsPrintObject.h"
      13             : #include "mozilla/Attributes.h"
      14             : #include "nsThreadUtils.h"
      15             : 
      16             : class nsPrintEngine;
      17             : class nsIDocument;
      18             : 
      19             : //---------------------------------------------------
      20             : //-- Page Timer Class
      21             : //---------------------------------------------------
      22             : class nsPagePrintTimer final : public mozilla::Runnable,
      23             :                                public nsITimerCallback
      24             : {
      25             : public:
      26             : 
      27             :   NS_DECL_ISUPPORTS_INHERITED
      28             : 
      29           0 :   nsPagePrintTimer(nsPrintEngine* aPrintEngine,
      30             :                    nsIDocumentViewerPrint* aDocViewerPrint,
      31             :                    nsIDocument* aDocument,
      32             :                    uint32_t aDelay)
      33           0 :     : Runnable("nsPagePrintTimer")
      34             :     , mPrintEngine(aPrintEngine)
      35             :     , mDocViewerPrint(aDocViewerPrint)
      36             :     , mDocument(aDocument)
      37             :     , mDelay(aDelay)
      38             :     , mFiringCount(0)
      39             :     , mPrintObj(nullptr)
      40             :     , mWatchDogCount(0)
      41           0 :     , mDone(false)
      42             :   {
      43           0 :     MOZ_ASSERT(aDocument);
      44           0 :     mDocViewerPrint->IncrementDestroyRefCount();
      45           0 :   }
      46             : 
      47             :   NS_DECL_NSITIMERCALLBACK
      48             : 
      49             :   nsresult Start(nsPrintObject* aPO);
      50             : 
      51             :   NS_IMETHOD Run() override;
      52             : 
      53             :   void Stop();
      54             : 
      55             :   void WaitForRemotePrint();
      56             :   void RemotePrintFinished();
      57             : 
      58           0 :   void Disconnect()
      59             :   {
      60           0 :     mPrintEngine = nullptr;
      61           0 :     mPrintObj = nullptr;
      62           0 :   }
      63             : 
      64             : private:
      65             :   ~nsPagePrintTimer();
      66             : 
      67             :   nsresult StartTimer(bool aUseDelay);
      68             :   nsresult StartWatchDogTimer();
      69             :   void     StopWatchDogTimer();
      70             :   void     Fail();
      71             : 
      72             :   nsPrintEngine*             mPrintEngine;
      73             :   nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
      74             :   nsCOMPtr<nsIDocument>      mDocument;
      75             :   nsCOMPtr<nsITimer>         mTimer;
      76             :   nsCOMPtr<nsITimer>         mWatchDogTimer;
      77             :   nsCOMPtr<nsITimer>         mWaitingForRemotePrint;
      78             :   uint32_t                   mDelay;
      79             :   uint32_t                   mFiringCount;
      80             :   nsPrintObject *            mPrintObj;
      81             :   uint32_t                   mWatchDogCount;
      82             :   bool                       mDone;
      83             : 
      84             :   static const uint32_t WATCH_DOG_INTERVAL  = 1000;
      85             :   static const uint32_t WATCH_DOG_MAX_COUNT =
      86             : #ifdef DEBUG
      87             :     // Debug builds are very slow (on Mac at least) and can need extra time
      88             :                                               30
      89             : #else
      90             :                                               10
      91             : #endif
      92             :   ;
      93             : };
      94             : 
      95             : #endif /* nsPagePrintTimer_h___ */

Generated by: LCOV version 1.13