Bug 1529942 - part 1 - move initialization of ExternalHelperAppParent into Recv*; r=qdot
authorNathan Froyd <froydnj@mozilla.com>
Mon, 25 Feb 2019 13:13:43 -0500
changeset 518768 c67d5054674e9ade7a3043cfa44092c1376def4a
parent 518767 a0429623a0a56e2d6e93eb03ae5ad616f558333d
child 518769 49b2a4c8be018f92d050512f9646cb3004ec1bec
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1529942
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529942 - part 1 - move initialization of ExternalHelperAppParent into Recv*; r=qdot Alloc methods can't take arguments by move reference, whereas Recv methods can, and we'd like to take OptionalLoadInfoArgs (at least) by move reference. Since Init is infallible anyway, it doesn't really matter where we do it, so move it to this separate method to pave the way for rvalue reference OptionalLoadInfoArgs.
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3603,28 +3603,38 @@ PExternalHelperAppParent* ContentParent:
     const uint32_t& aContentDispositionHint,
     const nsString& aContentDispositionFilename, const bool& aForceSave,
     const int64_t& aContentLength, const bool& aWasFileChannel,
     const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) {
   ExternalHelperAppParent* parent = new ExternalHelperAppParent(
       uri, aLoadInfoArgs, aContentLength, aWasFileChannel, aContentDisposition,
       aContentDispositionHint, aContentDispositionFilename);
   parent->AddRef();
-  parent->Init(aMimeContentType, aForceSave, aReferrer, aBrowser);
   return parent;
 }
 
 bool ContentParent::DeallocPExternalHelperAppParent(
     PExternalHelperAppParent* aService) {
   ExternalHelperAppParent* parent =
       static_cast<ExternalHelperAppParent*>(aService);
   parent->Release();
   return true;
 }
 
+mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor(
+    PExternalHelperAppParent* actor, const OptionalURIParams& uri,
+    const OptionalLoadInfoArgs& loadInfoArgs, const nsCString& aMimeContentType,
+    const nsCString& aContentDisposition, const uint32_t& aContentDispositionHint,
+    const nsString& aContentDispositionFilename, const bool& aForceSave,
+    const int64_t& aContentLength, const bool& aWasFileChannel,
+    const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) {
+  actor->Init(aMimeContentType, aForceSave, aReferrer, aBrowser);
+  return IPC_OK();
+}
+
 PHandlerServiceParent* ContentParent::AllocPHandlerServiceParent() {
   HandlerServiceParent* actor = new HandlerServiceParent();
   actor->AddRef();
   return actor;
 }
 
 bool ContentParent::DeallocPHandlerServiceParent(
     PHandlerServiceParent* aHandlerServiceParent) {
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -904,16 +904,24 @@ class ContentParent final : public PCont
       const nsCString& aMimeContentType, const nsCString& aContentDisposition,
       const uint32_t& aContentDispositionHint,
       const nsString& aContentDispositionFilename, const bool& aForceSave,
       const int64_t& aContentLength, const bool& aWasFileChannel,
       const OptionalURIParams& aReferrer, PBrowserParent* aBrowser);
 
   bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService);
 
+  mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor(
+      PExternalHelperAppParent* actor, const OptionalURIParams& uri,
+      const OptionalLoadInfoArgs& loadInfoArgs, const nsCString& aMimeContentType,
+      const nsCString& aContentDisposition, const uint32_t& aContentDispositionHint,
+      const nsString& aContentDispositionFilename, const bool& aForceSave,
+      const int64_t& aContentLength, const bool& aWasFileChannel,
+      const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) override;
+
   PHandlerServiceParent* AllocPHandlerServiceParent();
 
   bool DeallocPHandlerServiceParent(PHandlerServiceParent*);
 
   PMediaParent* AllocPMediaParent();
 
   bool DeallocPMediaParent(PMediaParent* aActor);