Closed Bug 1776289 Opened 2 years ago Closed 2 years ago

Code-cleanup around nsPrintJob initialization code

Categories

(Core :: Printing: Output, task)

task

Tracking

()

RESOLVED FIXED
103 Branch
Tracking Status
firefox103 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(2 files)

Similar to bug 1776074: nsPrintJob has a fallible Initialize method, which after some analysis, turns out to be actually infallible. Let's make that clearer and then merge it into the constructor.

Depends on: 1776074
See Also: 1776074

This patch doesn't change behavior; it's just collapsing logic from
nsPrintJob's Initialize method (which is now de-facto infallible) into the
constructor.

I'm also removing the "Methods needed by the DocViewer" header-comment since
it's clearly innacurate at this point. It's only surrounding this constructor
and GetSeqFrameAndCountSheets, which is silly since nsDocumentViewer uses more
of our API than that.

(I also placed TODO(dholbert) comments for a few things that looked odd, to
follow up on later. In particular, I noticed that nsDocumentViewer holds a
dedicated stack-owned RefPtr reference to nsPrintJob after creating it, which
superficially looks unnecessary. I don't want to risk changing behvior or
introducing a crash by removing that reference in this refactoring patch, so
I'm leaving that as-is and simply flagging it as suspicious.)

Depends on D150194

Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d3c69c86d287
part 1: Change nsPrintJob::Initialize to take references instead of pointers, to avoid the need for unnecessary null-checks. r=emilio
https://hg.mozilla.org/integration/autoland/rev/c2fa397508dc
part 2: Merge nsPrintJob::Initialize into the constructor. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: