Bug 1570369 - Part 15: Use IPDL refcounted for PHttpChannel, r=mayhemer

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-08-16 10:54:23 +00:00
Родитель 696b024d27
Коммит bf4d274ec0
6 изменённых файлов: 5 добавлений и 45 удалений

Просмотреть файл

@ -78,25 +78,6 @@ void NeckoChild::InitNeckoChild() {
}
}
PHttpChannelChild* NeckoChild::AllocPHttpChannelChild(
const PBrowserOrId& browser, const SerializedLoadContext& loadContext,
const HttpChannelCreationArgs& aOpenArgs) {
// We don't allocate here: instead we always use IPDL constructor that takes
// an existing HttpChildChannel
MOZ_ASSERT_UNREACHABLE(
"AllocPHttpChannelChild should not be called on "
"child");
return nullptr;
}
bool NeckoChild::DeallocPHttpChannelChild(PHttpChannelChild* channel) {
MOZ_ASSERT(IsNeckoChild(), "DeallocPHttpChannelChild called by non-child!");
HttpChannelChild* child = static_cast<HttpChannelChild*>(channel);
child->Release();
return true;
}
PStunAddrsRequestChild* NeckoChild::AllocPStunAddrsRequestChild() {
// We don't allocate here: instead we always use IPDL constructor that takes
// an existing object

Просмотреть файл

@ -25,11 +25,6 @@ class NeckoChild : public PNeckoChild {
static void InitNeckoChild();
protected:
PHttpChannelChild* AllocPHttpChannelChild(
const PBrowserOrId&, const SerializedLoadContext&,
const HttpChannelCreationArgs& aOpenArgs);
bool DeallocPHttpChannelChild(PHttpChannelChild*);
PStunAddrsRequestChild* AllocPStunAddrsRequestChild();
bool DeallocPStunAddrsRequestChild(PStunAddrsRequestChild* aActor);

Просмотреть файл

@ -270,7 +270,7 @@ void NeckoParent::ActorDestroy(ActorDestroyReason aWhy) {
// non-refcounted class.
}
PHttpChannelParent* NeckoParent::AllocPHttpChannelParent(
already_AddRefed<PHttpChannelParent> NeckoParent::AllocPHttpChannelParent(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
const HttpChannelCreationArgs& aOpenArgs) {
nsCOMPtr<nsIPrincipal> requestingPrincipal =
@ -288,16 +288,9 @@ PHttpChannelParent* NeckoParent::AllocPHttpChannelParent(
}
PBOverrideStatus overrideStatus =
PBOverrideStatusFromLoadContext(aSerialized);
HttpChannelParent* p =
RefPtr<HttpChannelParent> p =
new HttpChannelParent(aBrowser, loadContext, overrideStatus);
p->AddRef();
return p;
}
bool NeckoParent::DeallocPHttpChannelParent(PHttpChannelParent* channel) {
HttpChannelParent* p = static_cast<HttpChannelParent*>(channel);
p->Release();
return true;
return p.forget();
}
mozilla::ipc::IPCResult NeckoParent::RecvPHttpChannelConstructor(

Просмотреть файл

@ -91,14 +91,13 @@ class NeckoParent : public PNeckoParent {
protected:
bool mSocketProcessBridgeInited;
PHttpChannelParent* AllocPHttpChannelParent(
already_AddRefed<PHttpChannelParent> AllocPHttpChannelParent(
const PBrowserOrId&, const SerializedLoadContext&,
const HttpChannelCreationArgs& aOpenArgs);
virtual mozilla::ipc::IPCResult RecvPHttpChannelConstructor(
PHttpChannelParent* aActor, const PBrowserOrId& aBrowser,
const SerializedLoadContext& aSerialized,
const HttpChannelCreationArgs& aOpenArgs) override;
bool DeallocPHttpChannelParent(PHttpChannelParent*);
PStunAddrsRequestParent* AllocPStunAddrsRequestParent();
bool DeallocPStunAddrsRequestParent(PStunAddrsRequestParent* aActor);

Просмотреть файл

@ -2166,10 +2166,6 @@ HttpChannelChild::ConnectParent(uint32_t registrarId) {
HttpBaseChannel::SetDocshellUserAgentOverride();
// The socket transport in the chrome process now holds a logical ref to us
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
AddRef();
// This must happen before the constructor message is sent. Otherwise messages
// from the parent could arrive quickly and be delivered to the wrong event
// target.
@ -2933,10 +2929,6 @@ nsresult HttpChannelChild::ContinueAsyncOpen() {
// target.
SetEventTarget();
// The socket transport in the chrome process now holds a logical ref to us
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
AddRef();
PBrowserOrId browser = cc->GetBrowserOrId(browserChild);
if (!gNeckoChild->SendPHttpChannelConstructor(
this, browser, IPC::SerializedLoadContext(this), openArgs)) {

Просмотреть файл

@ -25,7 +25,7 @@ namespace mozilla {
namespace net {
//-------------------------------------------------------------------
protocol PHttpChannel
refcounted protocol PHttpChannel
{
manager PNecko;