RemotePrintJobChild.h (2089B)
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 #ifndef mozilla_layout_RemotePrintJobChild_h 8 #define mozilla_layout_RemotePrintJobChild_h 9 10 #include "mozilla/RefPtr.h" 11 #include "mozilla/gfx/Point.h" 12 #include "mozilla/layout/PRemotePrintJobChild.h" 13 #include "nsIWebProgressListener.h" 14 #include "prio.h" 15 16 class nsPagePrintTimer; 17 class nsPrintJob; 18 19 namespace mozilla { 20 namespace layout { 21 22 class RemotePrintJobChild final : public PRemotePrintJobChild, 23 public nsIWebProgressListener { 24 public: 25 using IntSize = mozilla::gfx::IntSize; 26 27 NS_DECL_ISUPPORTS 28 NS_DECL_NSIWEBPROGRESSLISTENER 29 30 RemotePrintJobChild(); 31 32 void ActorDestroy(ActorDestroyReason aWhy) final; 33 34 nsresult InitializePrint(const nsString& aDocumentTitle, 35 const int32_t& aStartPage, const int32_t& aEndPage); 36 37 mozilla::ipc::IPCResult RecvPrintInitializationResult( 38 const nsresult& aRv, const FileDescriptor& aFd) final; 39 40 void ProcessPage(const IntSize& aSizeInPoints, nsTArray<uint64_t>&& aDeps); 41 42 mozilla::ipc::IPCResult RecvPageProcessed(const FileDescriptor& aFd) final; 43 44 mozilla::ipc::IPCResult RecvAbortPrint(const nsresult& aRv) final; 45 46 void SetPagePrintTimer(nsPagePrintTimer* aPagePrintTimer); 47 48 void SetPrintJob(nsPrintJob* aPrintJob); 49 50 PRFileDesc* GetNextPageFD(); 51 52 [[nodiscard]] bool IsDestroyed() const { return mDestroyed; } 53 54 private: 55 ~RemotePrintJobChild() final; 56 void SetNextPageFD(const mozilla::ipc::FileDescriptor& aFd); 57 58 bool mPrintInitialized = false; 59 bool mDestroyed = false; 60 nsresult mInitializationResult = NS_OK; 61 RefPtr<nsPagePrintTimer> mPagePrintTimer; 62 RefPtr<nsPrintJob> mPrintJob; 63 PRFileDesc* mNextPageFD = nullptr; 64 }; 65 66 } // namespace layout 67 } // namespace mozilla 68 69 #endif // mozilla_layout_RemotePrintJobChild_h