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;
}
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() {
auto* actor = new HandlerServiceChild();
actor->AddRef();

View File

@ -272,17 +272,6 @@ class ContentChild final : public PContentChild,
bool DeallocPPSMContentDownloaderChild(
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();
bool DeallocPHandlerServiceChild(PHandlerServiceChild*);

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ include protocol PChannelDiverter;
namespace mozilla {
namespace dom {
protocol PExternalHelperApp
refcounted protocol PExternalHelperApp
{
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"
// helperAppService listener on the parent-side, via another call to
// DoContent.
mozilla::dom::PExternalHelperAppChild* pc =
child->SendPExternalHelperAppConstructor(
uriParams, loadInfoArgs, nsCString(aMimeContentType), disp,
contentDisposition, fileName, aForceSave, contentLength,
wasFileChannel, referrerParams,
mozilla::dom::BrowserChild::GetFrom(window));
ExternalHelperAppChild* childListener =
static_cast<ExternalHelperAppChild*>(pc);
RefPtr<ExternalHelperAppChild> childListener = new ExternalHelperAppChild();
MOZ_ALWAYS_TRUE(child->SendPExternalHelperAppConstructor(
childListener, uriParams, loadInfoArgs, nsCString(aMimeContentType), disp,
contentDisposition, fileName, aForceSave, contentLength, wasFileChannel,
referrerParams, mozilla::dom::BrowserChild::GetFrom(window)));
NS_ADDREF(*aStreamListener = childListener);