
When system calls were refactored out of PrintedDocument in https://crrev.com/948253, there were extra calls to PrintingContext NewPage() and PageDone() left in PrintedDocument::RenderPrintedDocument. These had no effect on Windows or Linux, but caused an issue for macOS. This was undetected by tests which use TestPrintingContext, and would only be detectable if a test was capable of using system drivers (which generally does not occur on the bots). Adding a test to detect this is difficult at this time, but should be easier to do once later portions of the out-of-process print drivers commit chains fill in more testing capabilities. At that point it should be easier to fire off a request to have the macOS Preview be the output. https://crbug.com/1284745 has been filed to capture this needed effort. Remove NewPage()/PageDone() as common methods to override from PrintingContext and make these specific to macOS only. Update the various implementations of PrintingContext::PrintDocument() to include the aborted and in-print-job checks that were previously in all NewPage() implementations. The same corresponding checks from PageDone() can be handled by PrintedDocument::RenderPrintedDocument() and PrintedDocumentWin::RenderPrintedPage(). There is no concern about `in_print_job_` having changed during the lifetime of RenderPrintedDocument()/RenderPrintedPage(), so just add extra checks against printing having been asynchronouly aborted before allowing a final successful return. Bug: 1283651 Change-Id: I52992bc7550dd25d4ad9a1dc633c7d9452a27bb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3367333 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Alan Screen <awscreen@chromium.org> Cr-Commit-Position: refs/heads/main@{#955936}
//printing
contains foundational code that is used for printing. It can depend
on other low-level directories like //cc/paint
and //ui
, but not higher
level code like //components
or //content
. Higher level printing code should
live in //components/printing
or the embedder.