Bug 1570369 - Part 12: Use IPDL refcounted for PDataChannel, r=mayhemer

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-08-16 10:45:57 +00:00
parent d678a3d0da
commit cac925ef9d
7 changed files with 6 additions and 32 deletions

View File

@ -220,17 +220,6 @@ bool NeckoChild::DeallocPWebSocketEventListenerChild(
return true;
}
PDataChannelChild* NeckoChild::AllocPDataChannelChild(
const uint32_t& channelId) {
MOZ_ASSERT_UNREACHABLE("Should never get here");
return nullptr;
}
bool NeckoChild::DeallocPDataChannelChild(PDataChannelChild* child) {
static_cast<DataChannelChild*>(child)->Release();
return true;
}
PFileChannelChild* NeckoChild::AllocPFileChannelChild(
const uint32_t& channelId) {
MOZ_ASSERT_UNREACHABLE("Should never get here");

View File

@ -65,8 +65,6 @@ class NeckoChild : public PNeckoChild {
const nsCString& aHost, const OriginAttributes& aOriginAttributes,
const uint32_t& aFlags);
bool DeallocPDNSRequestChild(PDNSRequestChild*);
PDataChannelChild* AllocPDataChannelChild(const uint32_t& channelId);
bool DeallocPDataChannelChild(PDataChannelChild* child);
PFileChannelChild* AllocPFileChannelChild(const uint32_t& channelId);
bool DeallocPFileChannelChild(PFileChannelChild* child);
PSimpleChannelChild* AllocPSimpleChannelChild(const uint32_t& channelId);

View File

@ -468,16 +468,10 @@ bool NeckoParent::DeallocPWebSocketEventListenerParent(
return true;
}
PDataChannelParent* NeckoParent::AllocPDataChannelParent(
already_AddRefed<PDataChannelParent> NeckoParent::AllocPDataChannelParent(
const uint32_t& channelId) {
RefPtr<DataChannelParent> p = new DataChannelParent();
return p.forget().take();
}
bool NeckoParent::DeallocPDataChannelParent(PDataChannelParent* actor) {
RefPtr<DataChannelParent> p =
dont_AddRef(static_cast<DataChannelParent*>(actor));
return true;
return p.forget();
}
mozilla::ipc::IPCResult NeckoParent::RecvPDataChannelConstructor(

View File

@ -164,8 +164,8 @@ class NeckoParent : public PNeckoParent {
const uint64_t& aInnerWindowID);
bool DeallocPWebSocketEventListenerParent(PWebSocketEventListenerParent*);
PDataChannelParent* AllocPDataChannelParent(const uint32_t& channelId);
bool DeallocPDataChannelParent(PDataChannelParent* parent);
already_AddRefed<PDataChannelParent> AllocPDataChannelParent(
const uint32_t& channelId);
virtual mozilla::ipc::IPCResult RecvPDataChannelConstructor(
PDataChannelParent* aActor, const uint32_t& channelId) override;

View File

@ -11,7 +11,7 @@ include URIParams;
namespace mozilla {
namespace net {
async protocol PDataChannel
async refcounted protocol PDataChannel
{
manager PNecko;

View File

@ -31,7 +31,7 @@ DataChannelChild::ConnectParent(uint32_t aId) {
}
// IPC now has a ref to us.
AddIPDLReference();
mIPCOpen = true;
return NS_OK;
}
@ -51,11 +51,6 @@ DataChannelChild::CompleteRedirectSetup(nsIStreamListener* aListener,
return NS_OK;
}
void DataChannelChild::AddIPDLReference() {
AddRef(); // Released in NeckoChild::DeallocPDataChannelChild.
mIPCOpen = true;
}
void DataChannelChild::ActorDestroy(ActorDestroyReason why) {
MOZ_ASSERT(mIPCOpen);
mIPCOpen = false;

View File

@ -31,8 +31,6 @@ class DataChannelChild : public nsDataChannel,
private:
~DataChannelChild() = default;
void AddIPDLReference();
bool mIPCOpen;
};