Bug 1754111 part 1: Move nsPagePrintTimer constructor definition (and its nsPrintObject.h include) to the .cpp file. r=emilio

This fixes a non-unified build error for nsPagePrintTimer's mDocument
member-var being initializated (and getting AddRef'ed) in the constructor's
init list, without its type being defined yet.  The .cpp file has the type
definition, so let's just move the constructor definition over there and leave
the header file relatively clean.

While I'm here, I'm also moving nsPagePrintTimer's include for nsPrintObject.h
into its .cpp file, since the header file only needs a forward declaration.

Differential Revision: https://phabricator.services.mozilla.com/D138096
This commit is contained in:
Daniel Holbert 2022-02-08 05:17:30 +00:00
Родитель f6d46e3717
Коммит 0793f3c7b0
2 изменённых файлов: 24 добавлений и 14 удалений

Просмотреть файл

@ -9,12 +9,30 @@
#include "mozilla/dom/Document.h"
#include "mozilla/Unused.h"
#include "nsPrintJob.h"
#include "nsPrintObject.h"
using namespace mozilla;
NS_IMPL_ISUPPORTS_INHERITED(nsPagePrintTimer, mozilla::Runnable,
nsITimerCallback)
nsPagePrintTimer::nsPagePrintTimer(nsPrintJob* aPrintJob,
nsIDocumentViewerPrint* aDocViewerPrint,
mozilla::dom::Document* aDocument,
uint32_t aDelay)
: Runnable("nsPagePrintTimer"),
mPrintJob(aPrintJob),
mDocViewerPrint(aDocViewerPrint),
mDocument(aDocument),
mDelay(aDelay),
mFiringCount(0),
mPrintObj(nullptr),
mWatchDogCount(0),
mDone(false) {
MOZ_ASSERT(aDocViewerPrint && aDocument);
mDocViewerPrint->IncrementDestroyBlockedCount();
}
nsPagePrintTimer::~nsPagePrintTimer() { Disconnect(); }
void nsPagePrintTimer::Disconnect() {

Просмотреть файл

@ -10,12 +10,16 @@
#include "nsITimer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsPrintObject.h"
#include "mozilla/Attributes.h"
#include "mozilla/OwningNonNull.h"
#include "nsThreadUtils.h"
class nsPrintJob;
class nsPrintObject;
namespace mozilla::dom {
class Document;
}
//---------------------------------------------------
//-- Page Timer Class
@ -31,19 +35,7 @@ class nsPagePrintTimer final : public mozilla::Runnable,
nsPagePrintTimer(nsPrintJob* aPrintJob,
nsIDocumentViewerPrint* aDocViewerPrint,
mozilla::dom::Document* aDocument, uint32_t aDelay)
: Runnable("nsPagePrintTimer"),
mPrintJob(aPrintJob),
mDocViewerPrint(aDocViewerPrint),
mDocument(aDocument),
mDelay(aDelay),
mFiringCount(0),
mPrintObj(nullptr),
mWatchDogCount(0),
mDone(false) {
MOZ_ASSERT(aDocViewerPrint && aDocument);
mDocViewerPrint->IncrementDestroyBlockedCount();
}
mozilla::dom::Document* aDocument, uint32_t aDelay);
NS_DECL_NSITIMERCALLBACK