mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1399787 - Part 12. Delay dispatching FinalizePrint message until the last page was processed. r=jwatt
For the last page, here is the final three messages sent between the content process, RemotePrintJobChild, and the chrome process, RemotePrintJobParent, for printing: 1. The content process sends *ProcessPage* to the chrome process via SendProcessPrint to request the chrome process print the last page. 2. The content process sends *FinalizePrint* to the chrome process via SendFinalizePrint to notify the chrome that there are no more outstanding print requests, and that the chrome process can release interal resource now. 3. The content process receive PageProcessed message from the chrome process. This calling sequence is fine for sync style PrintTarget (even though the FinalizePrint message is sent out a bit ealy). Since a sync PrintTarget completes its print task right after receiving *ProcessPage* message in #1, sending FinalizePrint before getting PageProcessed response is harmless. But this message dispatching sequence does cause a problem for async style PrintTargetEMF. After getting a message sent in #2, PrintTargetEMF release all resources before getting a EMF conversion response from the PDFium process. So the last page can not be printed correctly. This patch reorder the #2 and #3 message, that is to send FinalizePrint after the content process received PageProcessed message of the last page. MozReview-Commit-ID: 9ZVSrFnuHBU --HG-- extra : rebase_source : 2b4f9efa1352f7255576ae7c688c5a3750b7db42 extra : source : 70ce23becf8840408cd72e7f933a167090519c09
This commit is contained in:
parent
5ea0bb1b75
commit
3e848a98ac
@ -80,12 +80,9 @@ nsPagePrintTimer::Run()
|
|||||||
// donePrinting will be true if it completed successfully or
|
// donePrinting will be true if it completed successfully or
|
||||||
// if the printing was cancelled
|
// if the printing was cancelled
|
||||||
donePrinting = !mPrintEngine || mPrintEngine->PrintPage(mPrintObj, inRange);
|
donePrinting = !mPrintEngine || mPrintEngine->PrintPage(mPrintObj, inRange);
|
||||||
if (donePrinting) {
|
if (mPrintEngine && donePrinting) {
|
||||||
// now clean up print or print the next webshell
|
initNewTimer = false;
|
||||||
if (!mPrintEngine || mPrintEngine->DonePrintingPages(mPrintObj, NS_OK)) {
|
mDone = true;
|
||||||
initNewTimer = false;
|
|
||||||
mDone = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that the Stop() destroys this after the print job finishes
|
// Note that the Stop() destroys this after the print job finishes
|
||||||
@ -181,6 +178,11 @@ nsPagePrintTimer::RemotePrintFinished()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now clean up print or print the next webshell
|
||||||
|
if (mDone && mPrintEngine) {
|
||||||
|
mPrintEngine->DonePrintingPages(mPrintObj, NS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
mWaitingForRemotePrint->SetTarget(
|
mWaitingForRemotePrint->SetTarget(
|
||||||
mDocument->EventTargetFor(mozilla::TaskCategory::Other));
|
mDocument->EventTargetFor(mozilla::TaskCategory::Other));
|
||||||
mozilla::Unused <<
|
mozilla::Unused <<
|
||||||
|
@ -2794,6 +2794,7 @@ nsPrintEngine::PrintPage(nsPrintObject* aPO,
|
|||||||
bool isCancelled = false;
|
bool isCancelled = false;
|
||||||
printData->mPrintSettings->GetIsCancelled(&isCancelled);
|
printData->mPrintSettings->GetIsCancelled(&isCancelled);
|
||||||
if (isCancelled || printData->mIsAborted) {
|
if (isCancelled || printData->mIsAborted) {
|
||||||
|
DonePrintingPages(aPO, NS_OK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user