gecko-dev/widget/windows/PDFiumParent.h

39 строки
1.0 KiB
C
Исходник Обычный вид История

Bug 1399787 - Part 3. Create a top level protocol for the PDFium process. r=jwatt Define ipdl and actor classes. Implementation of actors is added in subsequent patches. Control flow: 1. A user starts a printing job. 2. We create a PrintTarget to print web content page by page. 3. When printing pages: a. PrintTarget, who lives in the chrome process, create a new FileDescriptor and pass that FD to the content process. b. The content process renders page contents into the given FD. c. PrintTarget render that FD, which contains only one page, into a PDF file. d. PrintTaget asks PDFium process to convert that PDF file into EMF contents by *ConvertToEMF* e. The PDFium process converts the given PDF into EMF contents and send back EMF contents by *ConvertToEMFDone* f. PrintTaget playbacks that EMF onto a printer DC. One page is printed! f. If all pages are printed, then finalize print job; Otherwise, loop back to #a. The control flow that we landed in bug 1370488 does not work like the flow I described above. In [1], we paint all pages into one single PDF file. After all pages are rendered into this PDF file, we finalize the current print job, which means the printing progress dialog is close. *Then* we start to convert that PDF into EMF and print each EMF page onto printer DC. We can not cancel this conversion task since the printing dialog is close, there is no UI allow us to do that. One more serious problem is: since the printing progress dialog is close, people think that printing is done, but actually it's not. Except move EMF conversion to a dedicated process, named PDFium process, I will also fix the behavior we landed in bug 1370488. [1] https://hg.mozilla.org/mozilla-central/rev/b611ec2a42bf MozReview-Commit-ID: JAnmNc3gAVK --HG-- extra : rebase_source : c64c4d39ccca16271959ade57edc2a8a087141b8 extra : intermediate-source : 6d6cff8961fa14160b624b2879d231b32c61a8f5 extra : source : b172d78e8c1d801e1e28afd8fedb9fcfff77d113
2017-10-13 11:58:07 +03:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef PDFIUMPARENT_H_
#define PDFIUMPARENT_H_
#include "mozilla/widget/PPDFiumParent.h"
namespace mozilla {
namespace widget {
class PDFiumParent final : public PPDFiumParent {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDFiumParent)
explicit PDFiumParent();
bool Init(IPC::Channel* aChannel, base::ProcessId aPid);
private:
~PDFiumParent() {}
// PPDFiumParent functions.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvConvertToEMFDone(const nsresult& aResult,
mozilla::ipc::Shmem&& aEMFContents) override;
void OnChannelConnected(int32_t pid) override;
void DeallocPPDFiumParent() override;
};
} // namespace widget
} // namespace mozilla
#endif // PDFIUMPARENT_H_