From 0d8858e71c06d81f0794ec9fcb66d546d10f41ce Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 7 Nov 2019 19:13:48 +0000 Subject: [PATCH] Bug 1594166 - Don't add a manual ref when constructing FileChannelChild, since it's a refcounted IPDL class. r=nika Differential Revision: https://phabricator.services.mozilla.com/D51904 --HG-- extra : moz-landing-system : lando --- netwerk/protocol/file/FileChannelChild.cpp | 17 ++--------------- netwerk/protocol/file/FileChannelChild.h | 8 -------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/netwerk/protocol/file/FileChannelChild.cpp b/netwerk/protocol/file/FileChannelChild.cpp index 89066b2fb210..c124c9a6c445 100644 --- a/netwerk/protocol/file/FileChannelChild.cpp +++ b/netwerk/protocol/file/FileChannelChild.cpp @@ -15,8 +15,7 @@ namespace net { NS_IMPL_ISUPPORTS_INHERITED(FileChannelChild, nsFileChannel, nsIChildChannel) -FileChannelChild::FileChannelChild(nsIURI* uri) - : nsFileChannel(uri), mIPCOpen(false) {} +FileChannelChild::FileChannelChild(nsIURI* uri) : nsFileChannel(uri) {} NS_IMETHODIMP FileChannelChild::ConnectParent(uint32_t id) { @@ -29,8 +28,6 @@ FileChannelChild::ConnectParent(uint32_t id) { if (!gNeckoChild->SendPFileChannelConstructor(this, id)) { return NS_ERROR_FAILURE; } - - AddIPDLReference(); return NS_OK; } @@ -45,22 +42,12 @@ FileChannelChild::CompleteRedirectSetup(nsIStreamListener* listener, return rv; } - if (mIPCOpen) { + if (CanSend()) { Unused << Send__delete__(this); } return NS_OK; } -void FileChannelChild::AddIPDLReference() { - AddRef(); // Released in NeckoChild::DeallocPFileChannelChild. - mIPCOpen = true; -} - -void FileChannelChild::ActorDestroy(ActorDestroyReason why) { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; -} - } // namespace net } // namespace mozilla diff --git a/netwerk/protocol/file/FileChannelChild.h b/netwerk/protocol/file/FileChannelChild.h index 145316c5ecdb..e6d67b7d1c4a 100644 --- a/netwerk/protocol/file/FileChannelChild.h +++ b/netwerk/protocol/file/FileChannelChild.h @@ -25,16 +25,8 @@ class FileChannelChild : public nsFileChannel, NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSICHILDCHANNEL - protected: - virtual void ActorDestroy(ActorDestroyReason why) override; - private: ~FileChannelChild() = default; - ; - - void AddIPDLReference(); - - bool mIPCOpen; }; } // namespace net