gecko-dev/widget/windows/PDFiumParent.h
cku 5a90745685 Bug 1424922 - Prevent calling PDFiumParent::Close twice. r=dvander
We call PDFiumParent::Close twice under certain conditions. Once in
PDFiumProcessParent::Delete, and once in PDFiumProcessParent's dtor. So we may
hit MOZ_ABORT which tell us that we are trying to close a closed channel.

This patch prevents hitting this abort by:
1. Only close the channel in PDFiumProcessParent::Delete, remove another call
   in PDFiumProcessParent's dtor. (Please see the change in
   PDFiumProcessParent.cpp).
2. Remove PDFiumParent::AbortConversion and relative code. We can just use
   PDFiumParent::EndConversion instead. When calling PDFiumParent::Close, we
   actually close the IPC channel *synchronously*, which means there is no need
   to register a callback by PDFiumParent::AbortConversion to receive
   actor-destroy callback.

MozReview-Commit-ID: 9i5j6t54J3h

--HG--
extra : rebase_source : 5f74ebc1ecc29e9983c30ca2dd63e0b49bd24a50
2017-12-13 12:42:59 +08:00

52 lines
1.3 KiB
C++

/* -*- 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 gfx {
class PrintTargetEMF;
}
}
namespace mozilla {
namespace widget {
class PDFiumParent final : public PPDFiumParent,
public mozilla::ipc::IShmemAllocator
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDFiumParent)
typedef mozilla::gfx::PrintTargetEMF PrintTargetEMF;
explicit PDFiumParent(PrintTargetEMF* aTarget);
bool Init(IPC::Channel* aChannel, base::ProcessId aPid);
void EndConversion();
FORWARD_SHMEM_ALLOCATOR_TO(PPDFiumParent)
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;
PrintTargetEMF* mTarget;
};
} // namespace widget
} // namespace mozilla
#endif // PDFIUMPARENT_H_