Bug 1600254 - P2: Implement HttpTransactionParent::SetDomainLookupStart/End r=dragana
authorKershaw Chang <kershaw@mozilla.com>
Thu, 30 Jan 2020 12:54:18 +0000
changeset 512152 f40ebf29f5b4e68217b788fe266d6ff08a66e169
parent 512151 b058bc7547c4ce5bd3b026bdb3febcfdbcfc587b
child 512153 cd6bfcd9ae6e56cc2c6cc213abfd40632329a408
push id106219
push userkjang@mozilla.com
push dateThu, 30 Jan 2020 13:59:40 +0000
treeherderautoland@655675bbf178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1600254
milestone74.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 1600254 - P2: Implement HttpTransactionParent::SetDomainLookupStart/End r=dragana Differential Revision: https://phabricator.services.mozilla.com/D56037
netwerk/protocol/http/HttpTransactionParent.cpp
netwerk/protocol/http/HttpTransactionParent.h
--- a/netwerk/protocol/http/HttpTransactionParent.cpp
+++ b/netwerk/protocol/http/HttpTransactionParent.cpp
@@ -316,21 +316,23 @@ void HttpTransactionParent::SetSecurityC
 }
 
 void HttpTransactionParent::SetPushedStream(Http2PushedStreamWrapper* push) {
   // TODO: will be implemented later in bug 1600254.
 }
 
 void HttpTransactionParent::SetDomainLookupStart(mozilla::TimeStamp timeStamp,
                                                  bool onlyIfNull) {
-  // TODO: will be implemented later in bug 1600254.
+  mDomainLookupStart = timeStamp;
+  mTimings.domainLookupStart = mDomainLookupStart;
 }
 void HttpTransactionParent::SetDomainLookupEnd(mozilla::TimeStamp timeStamp,
                                                bool onlyIfNull) {
-  // TODO: will be implemented later in bug 1600254.
+  mDomainLookupEnd = timeStamp;
+  mTimings.domainLookupEnd = mDomainLookupEnd;
 }
 
 nsHttpTransaction* HttpTransactionParent::AsHttpTransaction() {
   return nullptr;
 }
 
 HttpTransactionParent* HttpTransactionParent::AsHttpTransactionParent() {
   return this;
@@ -358,18 +360,23 @@ mozilla::ipc::IPCResult HttpTransactionP
                                aSecurityInfoSerialization, aProxyConnectFailed,
                                aTimings);
       }));
   return IPC_OK();
 }
 
 static void TimingStructArgsToTimingsStruct(const TimingStructArgs& aArgs,
                                             TimingStruct& aTimings) {
-  aTimings.domainLookupStart = aArgs.domainLookupStart();
-  aTimings.domainLookupEnd = aArgs.domainLookupEnd();
+  // If domainLookupStart/End was set by the channel before, we use these
+  // timestamps instead the ones from the transaction.
+  if (aTimings.domainLookupStart.IsNull() &&
+      aTimings.domainLookupEnd.IsNull()) {
+    aTimings.domainLookupStart = aArgs.domainLookupStart();
+    aTimings.domainLookupEnd = aArgs.domainLookupEnd();
+  }
   aTimings.connectStart = aArgs.connectStart();
   aTimings.tcpConnectEnd = aArgs.tcpConnectEnd();
   aTimings.secureConnectionStart = aArgs.secureConnectionStart();
   aTimings.connectEnd = aArgs.connectEnd();
   aTimings.requestStart = aArgs.requestStart();
   aTimings.responseStart = aArgs.responseStart();
   aTimings.responseEnd = aArgs.responseEnd();
 }
--- a/netwerk/protocol/http/HttpTransactionParent.h
+++ b/netwerk/protocol/http/HttpTransactionParent.h
@@ -98,14 +98,16 @@ class HttpTransactionParent final : publ
   bool mResponseTrailersTaken;
   bool mHasStickyConnection;
   bool mOnStartRequestCalled;
   bool mOnStopRequestCalled;
 
   NetAddr mSelfAddr;
   NetAddr mPeerAddr;
   TimingStruct mTimings;
+  TimeStamp mDomainLookupStart;
+  TimeStamp mDomainLookupEnd;
 };
 
 }  // namespace net
 }  // namespace mozilla
 
 #endif  // nsHttpTransactionParent_h__