gecko-dev/widget/windows/PDFiumProcessParent.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

57 lines
1.3 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
* 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 PDFIUMPROCESSPARENT_H
#define PDFIUMPROCESSPARENT_H
#include "chrome/common/child_process_host.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
class nsIRunnable;
class nsDeviceContextSpecWin;
#ifdef MOZ_ENABLE_SKIA_PDF
namespace mozilla {
namespace widget {
class PDFiumParent;
}
namespace gfx {
class PrintTargetEMF;
}
}
#endif
namespace mozilla {
namespace widget {
class PDFiumProcessParent final : public mozilla::ipc::GeckoChildProcessHost
{
public:
typedef mozilla::gfx::PrintTargetEMF PrintTargetEMF;
PDFiumProcessParent();
~PDFiumProcessParent();
bool Launch(PrintTargetEMF* aTarget);
void Delete();
bool CanShutdown() override { return true; }
PDFiumParent* GetActor() const { return mPDFiumParentActor; }
private:
DISALLOW_COPY_AND_ASSIGN(PDFiumProcessParent);
RefPtr<PDFiumParent> mPDFiumParentActor;
nsCOMPtr<nsIThread> mLaunchThread;
};
} // namespace widget
} // namespace mozilla
#endif // ifndef PDFIUMPROCESSPARENT_H