Bug 1821144 - remove old windows worker definitions. r=aryx
[gecko.git] / layout / printing / ipc / RemotePrintJobParent.h
blobfc568ab3a619520a658b4ad3f588c9e03e752e70
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/. */
7 #ifndef mozilla_layout_RemotePrintJobParent_h
8 #define mozilla_layout_RemotePrintJobParent_h
10 #include "mozilla/layout/PRemotePrintJobParent.h"
11 #include "mozilla/layout/printing/DrawEventRecorder.h"
13 #include "nsCOMArray.h"
14 #include "nsCOMPtr.h"
15 #include "mozilla/RefPtr.h"
16 #include "mozilla/UniquePtr.h"
17 #include "mozilla/gfx/RecordedEvent.h"
18 #include "mozilla/gfx/CrossProcessPaint.h"
20 class nsDeviceContext;
21 class nsIPrintSettings;
22 class nsIWebProgressListener;
24 namespace mozilla {
25 namespace layout {
27 class PrintTranslator;
29 class RemotePrintJobParent final : public PRemotePrintJobParent {
30 public:
31 NS_INLINE_DECL_REFCOUNTING(RemotePrintJobParent);
33 explicit RemotePrintJobParent(nsIPrintSettings* aPrintSettings);
35 void ActorDestroy(ActorDestroyReason aWhy) final;
37 mozilla::ipc::IPCResult RecvInitializePrint(const nsAString& aDocumentTitle,
38 const int32_t& aStartPage,
39 const int32_t& aEndPage) final;
41 mozilla::ipc::IPCResult RecvProcessPage(nsTArray<uint64_t>&& aDeps) final;
43 mozilla::ipc::IPCResult RecvFinalizePrint() final;
45 mozilla::ipc::IPCResult RecvAbortPrint(const nsresult& aRv) final;
47 mozilla::ipc::IPCResult RecvProgressChange(
48 const long& aCurSelfProgress, const long& aMaxSelfProgress,
49 const long& aCurTotalProgress, const long& aMaxTotalProgress) final;
51 mozilla::ipc::IPCResult RecvStatusChange(const nsresult& aStatus) final;
53 /**
54 * Register a progress listener to receive print progress updates.
56 * @param aListener the progress listener to register. Must not be null.
58 void RegisterListener(nsIWebProgressListener* aListener);
60 /**
61 * @return the print settings for this remote print job.
63 already_AddRefed<nsIPrintSettings> GetPrintSettings();
65 private:
66 ~RemotePrintJobParent() final;
68 nsresult InitializePrintDevice(const nsAString& aDocumentTitle,
69 const int32_t& aStartPage,
70 const int32_t& aEndPage);
72 nsresult PrepareNextPageFD(FileDescriptor* aFd);
74 nsresult PrintPage(
75 PRFileDescStream& aRecording,
76 gfx::CrossProcessPaint::ResolvedFragmentMap* aFragments = nullptr);
77 void FinishProcessingPage(
78 gfx::CrossProcessPaint::ResolvedFragmentMap* aFragments = nullptr);
80 /**
81 * Called to notify our corresponding RemotePrintJobChild once we've
82 * finished printing a page.
84 void PageDone(nsresult aResult);
86 nsCOMPtr<nsIPrintSettings> mPrintSettings;
87 RefPtr<nsDeviceContext> mPrintDeviceContext;
88 UniquePtr<PrintTranslator> mPrintTranslator;
89 nsCOMArray<nsIWebProgressListener> mPrintProgressListeners;
90 PRFileDescStream mCurrentPageStream;
91 bool mIsDoingPrinting;
92 nsresult mStatus;
95 } // namespace layout
96 } // namespace mozilla
98 #endif // mozilla_layout_RemotePrintJobParent_h