Commit eec2793e authored by Kershaw Chang's avatar Kershaw Chang
Browse files

Bug 1754508 - P1: Make PNecko refcounted, r=necko-reviewers,dragana

This is the rebased version of D138486.
This patch is supposed to be landed on nightly and D138486 is for beta.

Differential Revision: https://phabricator.services.mozilla.com/D138755
parent 14a809c1
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@
#include "mozilla/net/CookieServiceChild.h"
#include "mozilla/net/DocumentChannelChild.h"
#include "mozilla/net/HttpChannelChild.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/widget/RemoteLookAndFeel.h"
#include "mozilla/widget/ScreenManager.h"
#include "mozilla/widget/WidgetMessageUtils.h"
@@ -1994,8 +1993,6 @@ mozilla::ipc::IPCResult ContentChild::RecvPScriptCacheConstructor(
  return IPC_OK();
}

PNeckoChild* ContentChild::AllocPNeckoChild() { return new NeckoChild(); }

mozilla::ipc::IPCResult ContentChild::RecvNetworkLinkTypeChange(
    const uint32_t& aType) {
  mNetworkLinkType = aType;
@@ -2007,11 +2004,6 @@ mozilla::ipc::IPCResult ContentChild::RecvNetworkLinkTypeChange(
  return IPC_OK();
}

bool ContentChild::DeallocPNeckoChild(PNeckoChild* necko) {
  delete necko;
  return true;
}

PPrintingChild* ContentChild::AllocPPrintingChild() {
  // The ContentParent should never attempt to allocate the nsPrintingProxy,
  // which implements PPrintingChild. Instead, the nsPrintingProxy service is
+0 −4
Original line number Diff line number Diff line
@@ -239,10 +239,6 @@ class ContentChild final : public PContentChild,
      PScriptCacheChild*, const FileDescOrError& cacheFile,
      const bool& wantCacheData) override;

  PNeckoChild* AllocPNeckoChild();

  bool DeallocPNeckoChild(PNeckoChild*);

  PPrintingChild* AllocPPrintingChild();

  bool DeallocPPrintingChild(PPrintingChild*);
+3 −5
Original line number Diff line number Diff line
@@ -4206,11 +4206,9 @@ bool ContentParent::DeallocPScriptCacheParent(PScriptCacheParent* cache) {
  return true;
}

PNeckoParent* ContentParent::AllocPNeckoParent() { return new NeckoParent(); }

bool ContentParent::DeallocPNeckoParent(PNeckoParent* necko) {
  delete necko;
  return true;
already_AddRefed<PNeckoParent> ContentParent::AllocPNeckoParent() {
  RefPtr<NeckoParent> actor = new NeckoParent();
  return actor.forget();
}

PPrintingParent* ContentParent::AllocPPrintingParent() {
+1 −3
Original line number Diff line number Diff line
@@ -443,7 +443,7 @@ class ContentParent final
  mozilla::ipc::IPCResult RecvInitCrashReporter(
      const NativeThreadId& aThreadId);

  PNeckoParent* AllocPNeckoParent();
  already_AddRefed<PNeckoParent> AllocPNeckoParent();

  virtual mozilla::ipc::IPCResult RecvPNeckoConstructor(
      PNeckoParent* aActor) override {
@@ -966,8 +966,6 @@ class ContentParent final

  bool DeallocPScriptCacheParent(PScriptCacheParent* shell);

  bool DeallocPNeckoParent(PNeckoParent* necko);

  already_AddRefed<PExternalHelperAppParent> AllocPExternalHelperAppParent(
      nsIURI* aUri, const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
      const nsCString& aMimeContentType, const nsCString& aContentDisposition,
+2 −1
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ void NeckoChild::InitNeckoChild() {
    if (NS_WARN_IF(cpc->IsShuttingDown())) {
      return;
    }
    gNeckoChild = cpc->SendPNeckoConstructor();
    RefPtr<NeckoChild> child = new NeckoChild();
    gNeckoChild = cpc->SendPNeckoConstructor(child);
    NS_ASSERTION(gNeckoChild, "PNecko Protocol init failed!");
  }
}
Loading