Bug 1570369 - Part 6: Use IPDL refcounted for PExternalHelperApp, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D40258

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-08-08 16:46:35 +00:00
parent 24f3c996f7
commit 4825c16f54
8 changed files with 13 additions and 58 deletions

View File

@ -2219,27 +2219,6 @@ bool ContentChild::DeallocPPSMContentDownloaderChild(
return true; return true;
} }
PExternalHelperAppChild* ContentChild::AllocPExternalHelperAppChild(
const Maybe<URIParams>& uri,
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition,
const uint32_t& aContentDispositionHint,
const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer, PBrowserChild* aBrowser) {
auto* child = new ExternalHelperAppChild();
child->AddRef();
return child;
}
bool ContentChild::DeallocPExternalHelperAppChild(
PExternalHelperAppChild* aService) {
ExternalHelperAppChild* child =
static_cast<ExternalHelperAppChild*>(aService);
child->Release();
return true;
}
PHandlerServiceChild* ContentChild::AllocPHandlerServiceChild() { PHandlerServiceChild* ContentChild::AllocPHandlerServiceChild() {
auto* actor = new HandlerServiceChild(); auto* actor = new HandlerServiceChild();
actor->AddRef(); actor->AddRef();

View File

@ -272,17 +272,6 @@ class ContentChild final : public PContentChild,
bool DeallocPPSMContentDownloaderChild( bool DeallocPPSMContentDownloaderChild(
PPSMContentDownloaderChild* aDownloader); PPSMContentDownloaderChild* aDownloader);
PExternalHelperAppChild* AllocPExternalHelperAppChild(
const Maybe<URIParams>& uri,
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition,
const uint32_t& aContentDispositionHint,
const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer, PBrowserChild* aBrowser);
bool DeallocPExternalHelperAppChild(PExternalHelperAppChild* aService);
PHandlerServiceChild* AllocPHandlerServiceChild(); PHandlerServiceChild* AllocPHandlerServiceChild();
bool DeallocPHandlerServiceChild(PHandlerServiceChild*); bool DeallocPHandlerServiceChild(PHandlerServiceChild*);

View File

@ -3689,7 +3689,8 @@ bool ContentParent::DeallocPPSMContentDownloaderParent(
return true; return true;
} }
PExternalHelperAppParent* ContentParent::AllocPExternalHelperAppParent( already_AddRefed<PExternalHelperAppParent>
ContentParent::AllocPExternalHelperAppParent(
const Maybe<URIParams>& uri, const Maybe<URIParams>& uri,
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs, const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition, const nsCString& aMimeContentType, const nsCString& aContentDisposition,
@ -3697,19 +3698,10 @@ PExternalHelperAppParent* ContentParent::AllocPExternalHelperAppParent(
const nsString& aContentDispositionFilename, const bool& aForceSave, const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel, const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser) { const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser) {
ExternalHelperAppParent* parent = new ExternalHelperAppParent( RefPtr<ExternalHelperAppParent> parent = new ExternalHelperAppParent(
uri, aContentLength, aWasFileChannel, aContentDisposition, uri, aContentLength, aWasFileChannel, aContentDisposition,
aContentDispositionHint, aContentDispositionFilename); aContentDispositionHint, aContentDispositionFilename);
parent->AddRef(); return parent.forget();
return parent;
}
bool ContentParent::DeallocPExternalHelperAppParent(
PExternalHelperAppParent* aService) {
ExternalHelperAppParent* parent =
static_cast<ExternalHelperAppParent*>(aService);
parent->Release();
return true;
} }
mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor( mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor(

View File

@ -871,7 +871,7 @@ class ContentParent final : public PContentParent,
bool DeallocPPSMContentDownloaderParent( bool DeallocPPSMContentDownloaderParent(
PPSMContentDownloaderParent* aDownloader); PPSMContentDownloaderParent* aDownloader);
PExternalHelperAppParent* AllocPExternalHelperAppParent( already_AddRefed<PExternalHelperAppParent> AllocPExternalHelperAppParent(
const Maybe<URIParams>& aUri, const Maybe<URIParams>& aUri,
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs, const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition, const nsCString& aMimeContentType, const nsCString& aContentDisposition,
@ -880,8 +880,6 @@ class ContentParent final : public PContentParent,
const int64_t& aContentLength, const bool& aWasFileChannel, const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser); const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser);
bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService);
mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor( mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor(
PExternalHelperAppParent* actor, const Maybe<URIParams>& uri, PExternalHelperAppParent* actor, const Maybe<URIParams>& uri,
const Maybe<LoadInfoArgs>& loadInfoArgs, const Maybe<LoadInfoArgs>& loadInfoArgs,

View File

@ -13,7 +13,7 @@ namespace mozilla {
class HandlerServiceChild final : public mozilla::dom::PHandlerServiceChild { class HandlerServiceChild final : public mozilla::dom::PHandlerServiceChild {
public: public:
NS_INLINE_DECL_REFCOUNTING(HandlerServiceChild) NS_INLINE_DECL_REFCOUNTING(HandlerServiceChild, final)
HandlerServiceChild() {} HandlerServiceChild() {}
private: private:

View File

@ -15,7 +15,7 @@ class nsIHandlerApp;
class HandlerServiceParent final : public mozilla::dom::PHandlerServiceParent { class HandlerServiceParent final : public mozilla::dom::PHandlerServiceParent {
public: public:
HandlerServiceParent(); HandlerServiceParent();
NS_INLINE_DECL_REFCOUNTING(HandlerServiceParent) NS_INLINE_DECL_REFCOUNTING(HandlerServiceParent, final)
private: private:
virtual ~HandlerServiceParent(); virtual ~HandlerServiceParent();

View File

@ -10,7 +10,7 @@ include protocol PChannelDiverter;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
protocol PExternalHelperApp refcounted protocol PExternalHelperApp
{ {
manager PContent; manager PContent;

View File

@ -674,14 +674,11 @@ nsresult nsExternalHelperAppService::DoContentContentProcessHelper(
// protocol will act as a listener on the child-side and create a "real" // protocol will act as a listener on the child-side and create a "real"
// helperAppService listener on the parent-side, via another call to // helperAppService listener on the parent-side, via another call to
// DoContent. // DoContent.
mozilla::dom::PExternalHelperAppChild* pc = RefPtr<ExternalHelperAppChild> childListener = new ExternalHelperAppChild();
child->SendPExternalHelperAppConstructor( MOZ_ALWAYS_TRUE(child->SendPExternalHelperAppConstructor(
uriParams, loadInfoArgs, nsCString(aMimeContentType), disp, childListener, uriParams, loadInfoArgs, nsCString(aMimeContentType), disp,
contentDisposition, fileName, aForceSave, contentLength, contentDisposition, fileName, aForceSave, contentLength, wasFileChannel,
wasFileChannel, referrerParams, referrerParams, mozilla::dom::BrowserChild::GetFrom(window)));
mozilla::dom::BrowserChild::GetFrom(window));
ExternalHelperAppChild* childListener =
static_cast<ExternalHelperAppChild*>(pc);
NS_ADDREF(*aStreamListener = childListener); NS_ADDREF(*aStreamListener = childListener);