Bug 1641496 - P4: Send request size in OnStopRequest message r=dragana
authorKershaw Chang <kershaw@mozilla.com>
Thu, 04 Jun 2020 22:56:43 +0000
changeset 534141 ca92d90c620d2dc20047ab8e3a1f23861b94c0f7
parent 534140 3b092d1113f7063b7a1c9dde1adcd3fb1ecc5f9e
child 534142 e9f1b3201f692adefa6ded5bd7906eb6276f39a1
push id37483
push userapavel@mozilla.com
push dateFri, 05 Jun 2020 21:40:11 +0000
treeherdermozilla-central@dadc7312128e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1641496
milestone79.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 1641496 - P4: Send request size in OnStopRequest message r=dragana Differential Revision: https://phabricator.services.mozilla.com/D77275
netwerk/protocol/http/HttpTransactionChild.cpp
netwerk/protocol/http/HttpTransactionParent.cpp
netwerk/protocol/http/HttpTransactionParent.h
netwerk/protocol/http/PHttpTransaction.ipdl
--- a/netwerk/protocol/http/HttpTransactionChild.cpp
+++ b/netwerk/protocol/http/HttpTransactionChild.cpp
@@ -470,21 +470,24 @@ HttpTransactionChild::OnStopRequest(nsIR
 
   UniquePtr<nsHttpHeaderArray> headerArray(
       mTransaction->TakeResponseTrailers());
   Maybe<nsHttpHeaderArray> responseTrailers;
   if (headerArray) {
     responseTrailers.emplace(*headerArray);
   }
 
-  Unused << SendOnStopRequest(
-      aStatus, mTransaction->ResponseIsComplete(),
-      mTransaction->GetTransferSize(),
-      ToTimingStructArgs(mTransaction->Timings()), responseTrailers,
-      mTransaction->HasStickyConnection(), mTransactionObserverResult);
+  int64_t requestSize = mTransaction->GetRequestSize();
+
+  Unused << SendOnStopRequest(aStatus, mTransaction->ResponseIsComplete(),
+                              mTransaction->GetTransferSize(),
+                              ToTimingStructArgs(mTransaction->Timings()),
+                              responseTrailers,
+                              mTransaction->HasStickyConnection(),
+                              mTransactionObserverResult, requestSize);
 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // HttpTransactionChild <nsITransportEventSink>
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/http/HttpTransactionParent.cpp
+++ b/netwerk/protocol/http/HttpTransactionParent.cpp
@@ -484,52 +484,56 @@ void HttpTransactionParent::DoOnDataAvai
   }
 }
 
 mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStopRequest(
     const nsresult& aStatus, const bool& aResponseIsComplete,
     const int64_t& aTransferSize, const TimingStructArgs& aTimings,
     const Maybe<nsHttpHeaderArray>& aResponseTrailers,
     const bool& aHasStickyConn,
-    Maybe<TransactionObserverResult>&& aTransactionObserverResult) {
+    Maybe<TransactionObserverResult>&& aTransactionObserverResult,
+    const int64_t& aRequestSize) {
   LOG(("HttpTransactionParent::RecvOnStopRequest [this=%p status=%" PRIx32
        "]\n",
        this, static_cast<uint32_t>(aStatus)));
   mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
       this, [self = UnsafePtr<HttpTransactionParent>(this), aStatus,
              aResponseIsComplete, aTransferSize, aTimings, aResponseTrailers,
              aHasStickyConn,
-             aTransactionObserverResult{
-                 std::move(aTransactionObserverResult)}]() mutable {
+             aTransactionObserverResult{std::move(aTransactionObserverResult)},
+             aRequestSize]() mutable {
         self->DoOnStopRequest(aStatus, aResponseIsComplete, aTransferSize,
                               aTimings, aResponseTrailers, aHasStickyConn,
-                              std::move(aTransactionObserverResult));
+                              std::move(aTransactionObserverResult),
+                              aRequestSize);
       }));
   return IPC_OK();
 }
 
 void HttpTransactionParent::DoOnStopRequest(
     const nsresult& aStatus, const bool& aResponseIsComplete,
     const int64_t& aTransferSize, const TimingStructArgs& aTimings,
     const Maybe<nsHttpHeaderArray>& aResponseTrailers,
     const bool& aHasStickyConn,
-    Maybe<TransactionObserverResult>&& aTransactionObserverResult) {
+    Maybe<TransactionObserverResult>&& aTransactionObserverResult,
+    const int64_t& aRequestSize) {
   LOG(("HttpTransactionParent::DoOnStopRequest [this=%p]\n", this));
   if (mCanceled) {
     return;
   }
 
   MOZ_ASSERT(!mOnStopRequestCalled, "We should not call OnStopRequest twice");
 
   mStatus = aStatus;
 
   nsCOMPtr<nsIRequest> deathGrip = this;
 
   mResponseIsComplete = aResponseIsComplete;
   mTransferSize = aTransferSize;
+  mRequestSize = aRequestSize;
   TimingStructArgsToTimingsStruct(aTimings, mTimings);
 
   if (aResponseTrailers.isSome()) {
     mResponseTrailers = MakeUnique<nsHttpHeaderArray>(aResponseTrailers.ref());
   }
   mHasStickyConnection = aHasStickyConn;
   if (aTransactionObserverResult.isSome()) {
     TransactionObserverFunc obs = nullptr;
--- a/netwerk/protocol/http/HttpTransactionParent.h
+++ b/netwerk/protocol/http/HttpTransactionParent.h
@@ -57,17 +57,18 @@ class HttpTransactionParent final : publ
   mozilla::ipc::IPCResult RecvOnDataAvailable(
       const nsCString& aData, const uint64_t& aOffset, const uint32_t& aCount,
       const bool& aDataSentToChildProcess);
   mozilla::ipc::IPCResult RecvOnStopRequest(
       const nsresult& aStatus, const bool& aResponseIsComplete,
       const int64_t& aTransferSize, const TimingStructArgs& aTimings,
       const Maybe<nsHttpHeaderArray>& responseTrailers,
       const bool& aHasStickyConn,
-      Maybe<TransactionObserverResult>&& aTransactionObserverResult);
+      Maybe<TransactionObserverResult>&& aTransactionObserverResult,
+      const int64_t& aRequestSize);
   mozilla::ipc::IPCResult RecvOnNetAddrUpdate(const NetAddr& aSelfAddr,
                                               const NetAddr& aPeerAddr,
                                               const bool& aResolvedByTRR);
   mozilla::ipc::IPCResult RecvOnInitFailed(const nsresult& aStatus);
 
   mozilla::ipc::IPCResult RecvOnH2PushStream(const uint32_t& aPushedStreamId,
                                              const nsCString& aResourceUrl,
                                              const nsCString& aRequestString);
@@ -95,17 +96,18 @@ class HttpTransactionParent final : publ
   void DoOnDataAvailable(const nsCString& aData, const uint64_t& aOffset,
                          const uint32_t& aCount,
                          const bool& aDataSentToChildProcess);
   void DoOnStopRequest(
       const nsresult& aStatus, const bool& aResponseIsComplete,
       const int64_t& aTransferSize, const TimingStructArgs& aTimings,
       const Maybe<nsHttpHeaderArray>& responseTrailers,
       const bool& aHasStickyConn,
-      Maybe<TransactionObserverResult>&& aTransactionObserverResult);
+      Maybe<TransactionObserverResult>&& aTransactionObserverResult,
+      const int64_t& aRequestSize);
   void DoNotifyListener();
 
   nsCOMPtr<nsITransportEventSink> mEventsink;
   nsCOMPtr<nsIStreamListener> mChannel;
   nsCOMPtr<nsIEventTarget> mTargetThread;
   nsCOMPtr<nsISupports> mSecurityInfo;
   UniquePtr<nsHttpResponseHead> mResponseHead;
   UniquePtr<nsHttpHeaderArray> mResponseTrailers;
--- a/netwerk/protocol/http/PHttpTransaction.ipdl
+++ b/netwerk/protocol/http/PHttpTransaction.ipdl
@@ -46,17 +46,18 @@ parent:
                         uint32_t  count,
                         bool      dataSentToChildProcess);
   async OnStopRequest(nsresult status,
                       bool responseIsComplete,
                       int64_t transferSize,
                       TimingStructArgs timings,
                       nsHttpHeaderArray? responseTrailers,
                       bool hasStickyConn,
-                      TransactionObserverResult? transactionObserverResult);
+                      TransactionObserverResult? transactionObserverResult,
+                      int64_t requestSize);
   async OnNetAddrUpdate(NetAddr selfAddr, NetAddr peerAddr, bool resolvedByTRR);
   async OnInitFailed(nsresult status);
   async OnH2PushStream(uint32_t pushedStreamId,
                        nsCString resourceUrl,
                        nsCString requestString);
 
 child:
   async __delete__();