Bug 1529942 - part 2 - move OptionalLoadInfoArgs consumption into Init; r=qdot
authorNathan Froyd <froydnj@mozilla.com>
Mon, 25 Feb 2019 13:13:43 -0500
changeset 460887 49b2a4c8be018f92d050512f9646cb3004ec1bec
parent 460886 c67d5054674e9ade7a3043cfa44092c1376def4a
child 460991 fb2dc1645fcce3142932eb78daa7cee634c9d3b2
child 461014 2bcc26b5ecf765c47aea275da83a39b3aa8ea4a8
push id35612
push usernerli@mozilla.com
push dateMon, 25 Feb 2019 21:58:23 +0000
treeherdermozilla-central@49b2a4c8be01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1529942
milestone67.0a1
first release with
nightly linux32
49b2a4c8be01 / 67.0a1 / 20190225215823 / files
nightly linux64
49b2a4c8be01 / 67.0a1 / 20190225215823 / files
nightly mac
49b2a4c8be01 / 67.0a1 / 20190225215823 / files
nightly win32
49b2a4c8be01 / 67.0a1 / 20190225215823 / files
nightly win64
49b2a4c8be01 / 67.0a1 / 20190225215823 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529942 - part 2 - move OptionalLoadInfoArgs consumption into Init; r=qdot Init is called from a Recv* method in ContentParent, where we can consume rvalue reference OptionalLoadInfoArgs.
dom/ipc/ContentParent.cpp
uriloader/exthandler/ExternalHelperAppParent.cpp
uriloader/exthandler/ExternalHelperAppParent.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3600,17 +3600,17 @@ PExternalHelperAppParent* ContentParent:
     const OptionalURIParams& uri,
     const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
     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) {
   ExternalHelperAppParent* parent = new ExternalHelperAppParent(
-      uri, aLoadInfoArgs, aContentLength, aWasFileChannel, aContentDisposition,
+      uri, aContentLength, aWasFileChannel, aContentDisposition,
       aContentDispositionHint, aContentDispositionFilename);
   parent->AddRef();
   return parent;
 }
 
 bool ContentParent::DeallocPExternalHelperAppParent(
     PExternalHelperAppParent* aService) {
   ExternalHelperAppParent* parent =
@@ -3621,17 +3621,18 @@ bool ContentParent::DeallocPExternalHelp
 
 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);
+  static_cast<ExternalHelperAppParent*>(actor)->Init(
+      loadInfoArgs, aMimeContentType, aForceSave, aReferrer, aBrowser);
   return IPC_OK();
 }
 
 PHandlerServiceParent* ContentParent::AllocPHandlerServiceParent() {
   HandlerServiceParent* actor = new HandlerServiceParent();
   actor->AddRef();
   return actor;
 }
--- a/uriloader/exthandler/ExternalHelperAppParent.cpp
+++ b/uriloader/exthandler/ExternalHelperAppParent.cpp
@@ -29,17 +29,16 @@ namespace dom {
 
 NS_IMPL_ISUPPORTS_INHERITED(ExternalHelperAppParent, nsHashPropertyBag,
                             nsIRequest, nsIChannel, nsIMultiPartChannel,
                             nsIPrivateBrowsingChannel, nsIResumableChannel,
                             nsIStreamListener, nsIExternalHelperAppParent)
 
 ExternalHelperAppParent::ExternalHelperAppParent(
     const OptionalURIParams& uri,
-    const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
     const int64_t& aContentLength, const bool& aWasFileChannel,
     const nsCString& aContentDispositionHeader,
     const uint32_t& aContentDispositionHint,
     const nsString& aContentDispositionFilename)
     : mURI(DeserializeURI(uri)),
       mPending(false)
 #ifdef DEBUG
       ,
@@ -56,18 +55,16 @@ ExternalHelperAppParent::ExternalHelperA
     NS_GetFilenameFromDisposition(mContentDispositionFilename,
                                   mContentDispositionHeader, mURI);
     mContentDisposition =
         NS_GetContentDispositionFromHeader(mContentDispositionHeader, this);
   } else {
     mContentDisposition = aContentDispositionHint;
     mContentDispositionFilename = aContentDispositionFilename;
   }
-  mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs,
-                                       getter_AddRefs(mLoadInfo));
 }
 
 already_AddRefed<nsIInterfaceRequestor> GetWindowFromTabParent(
     PBrowserParent* aBrowser) {
   if (!aBrowser) {
     return nullptr;
   }
 
@@ -83,20 +80,24 @@ already_AddRefed<nsIInterfaceRequestor> 
 
 void UpdateContentContext(nsIStreamListener* aListener,
                           PBrowserParent* aBrowser) {
   MOZ_ASSERT(aListener);
   nsCOMPtr<nsIInterfaceRequestor> window = GetWindowFromTabParent(aBrowser);
   static_cast<nsExternalAppHandler*>(aListener)->SetContentContext(window);
 }
 
-void ExternalHelperAppParent::Init(const nsCString& aMimeContentType,
+void ExternalHelperAppParent::Init(const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
+                                   const nsCString& aMimeContentType,
                                    const bool& aForceSave,
                                    const OptionalURIParams& aReferrer,
                                    PBrowserParent* aBrowser) {
+  mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs,
+                                       getter_AddRefs(mLoadInfo));
+
   nsCOMPtr<nsIExternalHelperAppService> helperAppService =
       do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID);
   NS_ASSERTION(helperAppService, "No Helper App Service!");
 
   nsCOMPtr<nsIURI> referrer = DeserializeURI(aReferrer);
   if (referrer)
     SetPropertyAsInterface(NS_LITERAL_STRING("docshell.internalReferrer"),
                            referrer);
--- a/uriloader/exthandler/ExternalHelperAppParent.h
+++ b/uriloader/exthandler/ExternalHelperAppParent.h
@@ -81,22 +81,22 @@ class ExternalHelperAppParent
 
   mozilla::ipc::IPCResult RecvDivertToParentUsing(
       PChannelDiverterParent* diverter, PBrowserParent* aBrowser) override;
 
   bool WasFileChannel() override { return mWasFileChannel; }
 
   ExternalHelperAppParent(
       const OptionalURIParams& uri,
-      const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
       const int64_t& contentLength, const bool& wasFileChannel,
       const nsCString& aContentDispositionHeader,
       const uint32_t& aContentDispositionHint,
       const nsString& aContentDispositionFilename);
-  void Init(const nsCString& aMimeContentType, const bool& aForceSave,
+  void Init(const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
+            const nsCString& aMimeContentType, const bool& aForceSave,
             const OptionalURIParams& aReferrer, PBrowserParent* aBrowser);
 
  protected:
   virtual ~ExternalHelperAppParent();
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
   void Delete();