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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "RemotePrintJobChild.h"
       8             : 
       9             : #include "mozilla/Unused.h"
      10             : #include "nsPagePrintTimer.h"
      11             : #include "nsPrintEngine.h"
      12             : 
      13             : namespace mozilla {
      14             : namespace layout {
      15             : 
      16           0 : NS_IMPL_ISUPPORTS(RemotePrintJobChild,
      17             :                   nsIWebProgressListener)
      18             : 
      19           0 : RemotePrintJobChild::RemotePrintJobChild()
      20             : {
      21           0 : }
      22             : 
      23             : nsresult
      24           0 : RemotePrintJobChild::InitializePrint(const nsString& aDocumentTitle,
      25             :                                      const nsString& aPrintToFile,
      26             :                                      const int32_t& aStartPage,
      27             :                                      const int32_t& aEndPage)
      28             : {
      29             :   // Print initialization can sometimes display a dialog in the parent, so we
      30             :   // need to spin a nested event loop until initialization completes.
      31           0 :   Unused << SendInitializePrint(aDocumentTitle, aPrintToFile, aStartPage,
      32             :                                 aEndPage);
      33           0 :   mozilla::SpinEventLoopUntil([&]() { return mPrintInitialized; });
      34             : 
      35           0 :   return mInitializationResult;
      36             : }
      37             : 
      38             : mozilla::ipc::IPCResult
      39           0 : RemotePrintJobChild::RecvPrintInitializationResult(const nsresult& aRv)
      40             : {
      41           0 :   mPrintInitialized = true;
      42           0 :   mInitializationResult = aRv;
      43           0 :   return IPC_OK();
      44             : }
      45             : 
      46             : void
      47           0 : RemotePrintJobChild::ProcessPage(const nsCString& aPageFileName)
      48             : {
      49           0 :   MOZ_ASSERT(mPagePrintTimer);
      50             : 
      51           0 :   mPagePrintTimer->WaitForRemotePrint();
      52           0 :   Unused << SendProcessPage(aPageFileName);
      53           0 : }
      54             : 
      55             : mozilla::ipc::IPCResult
      56           0 : RemotePrintJobChild::RecvPageProcessed()
      57             : {
      58           0 :   MOZ_ASSERT(mPagePrintTimer);
      59             : 
      60           0 :   mPagePrintTimer->RemotePrintFinished();
      61           0 :   return IPC_OK();
      62             : }
      63             : 
      64             : mozilla::ipc::IPCResult
      65           0 : RemotePrintJobChild::RecvAbortPrint(const nsresult& aRv)
      66             : {
      67           0 :   MOZ_ASSERT(mPrintEngine);
      68             : 
      69           0 :   mPrintEngine->CleanupOnFailure(aRv, true);
      70           0 :   return IPC_OK();
      71             : }
      72             : 
      73             : void
      74           0 : RemotePrintJobChild::SetPagePrintTimer(nsPagePrintTimer* aPagePrintTimer)
      75             : {
      76           0 :   MOZ_ASSERT(aPagePrintTimer);
      77             : 
      78           0 :   mPagePrintTimer = aPagePrintTimer;
      79           0 : }
      80             : 
      81             : void
      82           0 : RemotePrintJobChild::SetPrintEngine(nsPrintEngine* aPrintEngine)
      83             : {
      84           0 :   MOZ_ASSERT(aPrintEngine);
      85             : 
      86           0 :   mPrintEngine = aPrintEngine;
      87           0 : }
      88             : 
      89             : // nsIWebProgressListener
      90             : 
      91             : NS_IMETHODIMP
      92           0 : RemotePrintJobChild::OnStateChange(nsIWebProgress* aProgress,
      93             :                                    nsIRequest* aRequest, uint32_t aStateFlags,
      94             :                                    nsresult aStatus)
      95             : {
      96           0 :   Unused << SendStateChange(aStateFlags, aStatus);
      97           0 :   return NS_OK;
      98             : }
      99             : 
     100             : NS_IMETHODIMP
     101           0 : RemotePrintJobChild::OnProgressChange(nsIWebProgress * aProgress,
     102             :                                       nsIRequest * aRequest,
     103             :                                       int32_t aCurSelfProgress,
     104             :                                       int32_t aMaxSelfProgress,
     105             :                                       int32_t aCurTotalProgress,
     106             :                                       int32_t aMaxTotalProgress)
     107             : {
     108           0 :   Unused << SendProgressChange(aCurSelfProgress, aMaxSelfProgress,
     109             :                                aCurTotalProgress, aMaxTotalProgress);
     110           0 :   return NS_OK;
     111             : }
     112             : 
     113             : NS_IMETHODIMP
     114           0 : RemotePrintJobChild::OnLocationChange(nsIWebProgress* aProgress,
     115             :                                       nsIRequest* aRequest, nsIURI* aURI,
     116             :                                       uint32_t aFlags)
     117             : {
     118           0 :   return NS_OK;
     119             : }
     120             : 
     121             : NS_IMETHODIMP
     122           0 : RemotePrintJobChild::OnStatusChange(nsIWebProgress* aProgress,
     123             :                                     nsIRequest* aRequest, nsresult aStatus,
     124             :                                     const char16_t* aMessage)
     125             : {
     126           0 :   Unused << SendStatusChange(aStatus);
     127           0 :   return NS_OK;
     128             : }
     129             : 
     130             : NS_IMETHODIMP
     131           0 : RemotePrintJobChild::OnSecurityChange(nsIWebProgress* aProgress,
     132             :                                       nsIRequest* aRequest, uint32_t aState)
     133             : {
     134           0 :   return NS_OK;
     135             : }
     136             : 
     137             : // End of nsIWebProgressListener
     138             : 
     139           0 : RemotePrintJobChild::~RemotePrintJobChild()
     140             : {
     141           0 : }
     142             : 
     143             : void
     144           0 : RemotePrintJobChild::ActorDestroy(ActorDestroyReason aWhy)
     145             : {
     146           0 :   mPagePrintTimer = nullptr;
     147           0 :   mPrintEngine = nullptr;
     148           0 : }
     149             : 
     150             : } // namespace layout
     151             : } // namespace mozilla

Generated by: LCOV version 1.13