Bug 1263235 - part 3 - Move PHttpChannel::OnTransportAndData's data argument last. r=mayhemer, a=ritu
authorAndrew McCreight <continuation@gmail.com>
Thu, 14 Apr 2016 10:41:01 -0700
changeset 324100 177a94ddc4b1dcef2fe0ca972adca94b5ab4497b
parent 324099 bc49e5e68ab31c08db32f09824a7bb2c61b65a7b
child 324101 4e0ea7414288b747eefd0eb0dd7e2bf225774b30
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, ritu
bugs1263235
milestone47.0a2
Bug 1263235 - part 3 - Move PHttpChannel::OnTransportAndData's data argument last. r=mayhemer, a=ritu This will reduce internal memory fragmentation for the IPC::Message used to make this call.
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelChild.h
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/PHttpChannel.ipdl
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -576,17 +576,17 @@ class TransportAndDataEvent : public Cha
   , mProgressMax(progressMax)
   , mData(data)
   , mOffset(offset)
   , mCount(count) {}
 
   void Run()
   {
     mChild->OnTransportAndData(mChannelStatus, mTransportStatus, mProgress,
-                               mProgressMax, mData, mOffset, mCount);
+                               mProgressMax, mOffset, mCount, mData);
   }
  private:
   HttpChannelChild* mChild;
   nsresult mChannelStatus;
   nsresult mTransportStatus;
   uint64_t mProgress;
   uint64_t mProgressMax;
   nsCString mData;
@@ -594,19 +594,19 @@ class TransportAndDataEvent : public Cha
   uint32_t mCount;
 };
 
 bool
 HttpChannelChild::RecvOnTransportAndData(const nsresult& channelStatus,
                                          const nsresult& transportStatus,
                                          const uint64_t& progress,
                                          const uint64_t& progressMax,
-                                         const nsCString& data,
                                          const uint64_t& offset,
-                                         const uint32_t& count)
+                                         const uint32_t& count,
+                                         const nsCString& data)
 {
   LOG(("HttpChannelChild::RecvOnTransportAndData [this=%p]\n", this));
   MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
                      "Should not be receiving any more callbacks from parent!");
 
   mEventQ->RunOrEnqueue(new TransportAndDataEvent(this, channelStatus,
                                                   transportStatus, progress,
                                                   progressMax, data, offset,
@@ -651,19 +651,19 @@ HttpChannelChild::MaybeDivertOnData(cons
   }
 }
 
 void
 HttpChannelChild::OnTransportAndData(const nsresult& channelStatus,
                                      const nsresult& transportStatus,
                                      const uint64_t progress,
                                      const uint64_t& progressMax,
-                                     const nsCString& data,
                                      const uint64_t& offset,
-                                     const uint32_t& count)
+                                     const uint32_t& count,
+                                     const nsCString& data)
 {
   LOG(("HttpChannelChild::OnTransportAndData [this=%p]\n", this));
 
   if (!mCanceled && NS_SUCCEEDED(mStatus)) {
     mStatus = channelStatus;
   }
 
   // For diversion to parent, just SendDivertOnDataAvailable.
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -121,19 +121,19 @@ protected:
                           const NetAddr& selfAddr,
                           const NetAddr& peerAddr,
                           const int16_t& redirectCount,
                           const uint32_t& cacheKey) override;
   bool RecvOnTransportAndData(const nsresult& channelStatus,
                               const nsresult& status,
                               const uint64_t& progress,
                               const uint64_t& progressMax,
-                              const nsCString& data,
                               const uint64_t& offset,
-                              const uint32_t& count) override;
+                              const uint32_t& count,
+                              const nsCString& data) override;
   bool RecvOnStopRequest(const nsresult& statusCode, const ResourceTimingStruct& timing) override;
   bool RecvOnProgress(const int64_t& progress, const int64_t& progressMax) override;
   bool RecvOnStatus(const nsresult& status) override;
   bool RecvFailedAsyncOpen(const nsresult& status) override;
   bool RecvRedirect1Begin(const uint32_t& newChannel,
                           const URIParams& newURI,
                           const uint32_t& redirectFlags,
                           const nsHttpResponseHead& responseHead,
@@ -263,19 +263,19 @@ private:
                       const uint32_t& cacheKey);
   void MaybeDivertOnData(const nsCString& data,
                          const uint64_t& offset,
                          const uint32_t& count);
   void OnTransportAndData(const nsresult& channelStatus,
                           const nsresult& status,
                           const uint64_t progress,
                           const uint64_t& progressMax,
-                          const nsCString& data,
                           const uint64_t& offset,
-                          const uint32_t& count);
+                          const uint32_t& count,
+                          const nsCString& data);
   void OnStopRequest(const nsresult& channelStatus, const ResourceTimingStruct& timing);
   void MaybeDivertOnStop(const nsresult& aChannelStatus);
   void OnProgress(const int64_t& progress, const int64_t& progressMax);
   void OnStatus(const nsresult& status);
   void FailedAsyncOpen(const nsresult& status);
   void HandleAsyncAbort();
   void Redirect1Begin(const uint32_t& newChannelId,
                       const URIParams& newUri,
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1159,17 +1159,17 @@ HttpChannelParent::OnDataAvailable(nsIRe
     }
 
     // OnDataAvailable is always preceded by OnStatus/OnProgress calls that set
     // mStoredStatus/mStoredProgress(Max) to appropriate values, unless
     // LOAD_BACKGROUND set.  In that case, they'll have garbage values, but
     // child doesn't use them.
     if (mIPCClosed || !SendOnTransportAndData(channelStatus, mStoredStatus,
                                               mStoredProgress, mStoredProgressMax,
-                                              data, aOffset, toRead)) {
+                                              aOffset, toRead, data)) {
       return NS_ERROR_UNEXPECTED;
     }
 
     aOffset += toRead;
     aCount -= toRead;
     toRead = std::min<uint32_t>(aCount, kCopyChunkSize);
   }
 
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -102,19 +102,19 @@ child:
                        uint32_t            cacheKey);
 
   // Combines a single OnDataAvailable and its associated OnProgress &
   // OnStatus calls into one IPDL message
   async OnTransportAndData(nsresult  channelStatus,
                            nsresult  transportStatus,
                            uint64_t  progress,
                            uint64_t  progressMax,
-                           nsCString data,
                            uint64_t  offset,
-                           uint32_t  count);
+                           uint32_t  count,
+                           nsCString data);
 
   async OnStopRequest(nsresult channelStatus, ResourceTimingStruct timing);
 
   async OnProgress(int64_t progress, int64_t progressMax);
 
   async OnStatus(nsresult status);
 
   // Used to cancel child channel if we hit errors during creating and