Bug 1253379 - Cache timings not send to HttpChannelChild. r=mayhemer, a=lizzard
authorValentin Gosu <valentin.gosu@gmail.com>
Fri, 04 Mar 2016 12:14:00 +0100
changeset 337992 bbaf0ef3deea8b2989eb5a23be9861cf3e08720f
parent 337991 3e77fa27460469242dbb09c19270303e84ac844f
child 337993 cfed5bb4e3f66224e5f2c7ca5ee4650f8be5ede2
child 338844 1cc5ec520c00a6b8168162fb2db7299cc1b6f343
child 378777 d644a24703e0df422424ec1fac7612782e0dd8a4
push id12404
push userjlund@mozilla.com
push dateTue, 08 Mar 2016 02:54:16 +0000
reviewersmayhemer, lizzard
bugs1253379
milestone46.0
Bug 1253379 - Cache timings not send to HttpChannelChild. r=mayhemer, a=lizzard MozReview-Commit-ID: D7IWrI25mIB
netwerk/ipc/NeckoMessageUtils.h
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/TimingStruct.h
--- a/netwerk/ipc/NeckoMessageUtils.h
+++ b/netwerk/ipc/NeckoMessageUtils.h
@@ -148,31 +148,36 @@ struct ParamTraits<mozilla::net::Resourc
 
     WriteParam(aMsg, aParam.fetchStart);
     WriteParam(aMsg, aParam.redirectStart);
     WriteParam(aMsg, aParam.redirectEnd);
 
     WriteParam(aMsg, aParam.transferSize);
     WriteParam(aMsg, aParam.encodedBodySize);
     WriteParam(aMsg, aParam.protocolVersion);
+
+    WriteParam(aMsg, aParam.cacheReadStart);
+    WriteParam(aMsg, aParam.cacheReadEnd);
   }
 
   static bool Read(const Message* aMsg, void** aIter, mozilla::net::ResourceTimingStruct* aResult)
   {
     return ReadParam(aMsg, aIter, &aResult->domainLookupStart) &&
            ReadParam(aMsg, aIter, &aResult->domainLookupEnd) &&
            ReadParam(aMsg, aIter, &aResult->connectStart) &&
            ReadParam(aMsg, aIter, &aResult->connectEnd) &&
            ReadParam(aMsg, aIter, &aResult->requestStart) &&
            ReadParam(aMsg, aIter, &aResult->responseStart) &&
            ReadParam(aMsg, aIter, &aResult->responseEnd) &&
            ReadParam(aMsg, aIter, &aResult->fetchStart) &&
            ReadParam(aMsg, aIter, &aResult->redirectStart) &&
            ReadParam(aMsg, aIter, &aResult->redirectEnd) &&
            ReadParam(aMsg, aIter, &aResult->transferSize) &&
            ReadParam(aMsg, aIter, &aResult->encodedBodySize) &&
-           ReadParam(aMsg, aIter, &aResult->protocolVersion);
+           ReadParam(aMsg, aIter, &aResult->protocolVersion) &&
+           ReadParam(aMsg, aIter, &aResult->cacheReadStart) &&
+           ReadParam(aMsg, aIter, &aResult->cacheReadEnd);
   }
 };
 
 } // namespace IPC
 
 #endif // mozilla_net_NeckoMessageUtils_h
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -902,16 +902,19 @@ HttpChannelChild::OnStopRequest(const ns
   mTransactionTimings.responseEnd = timing.responseEnd;
   mAsyncOpenTime = timing.fetchStart;
   mRedirectStartTimeStamp = timing.redirectStart;
   mRedirectEndTimeStamp = timing.redirectEnd;
   mTransferSize = timing.transferSize;
   mEncodedBodySize = timing.encodedBodySize;
   mProtocolVersion = timing.protocolVersion;
 
+  mCacheReadStart = timing.cacheReadStart;
+  mCacheReadEnd = timing.cacheReadEnd;
+
   nsPerformance* documentPerformance = GetPerformance();
   if (documentPerformance) {
       documentPerformance->AddEntry(this, this);
   }
 
   DoPreOnStopRequest(channelStatus);
 
   { // We must flush the queue before we Send__delete__
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1125,16 +1125,19 @@ HttpChannelParent::OnStopRequest(nsIRequ
   mChannel->GetRedirectStart(&timing.redirectStart);
   mChannel->GetRedirectEnd(&timing.redirectEnd);
   mChannel->GetTransferSize(&timing.transferSize);
   mChannel->GetEncodedBodySize(&timing.encodedBodySize);
   // decodedBodySize can be computed in the child process so it doesn't need
   // to be passed down.
   mChannel->GetProtocolVersion(timing.protocolVersion);
 
+  mChannel->GetCacheReadStart(&timing.cacheReadStart);
+  mChannel->GetCacheReadEnd(&timing.cacheReadEnd);
+
   if (mIPCClosed || !SendOnStopRequest(aStatusCode, timing))
     return NS_ERROR_UNEXPECTED;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // HttpChannelParent::nsIStreamListener
 //-----------------------------------------------------------------------------
--- a/netwerk/protocol/http/TimingStruct.h
+++ b/netwerk/protocol/http/TimingStruct.h
@@ -22,14 +22,20 @@ struct TimingStruct {
 
 struct ResourceTimingStruct : TimingStruct {
   TimeStamp fetchStart;
   TimeStamp redirectStart;
   TimeStamp redirectEnd;
   uint64_t transferSize;
   uint64_t encodedBodySize;
   nsCString protocolVersion;
+
+  // Not actually part of resource timing, but not part of the transaction
+  // timings either. These need to be passed to HttpChannelChild along with
+  // the rest of the timings so the timing information in the child is complete.
+  TimeStamp cacheReadStart;
+  TimeStamp cacheReadEnd;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif