Bug 662555 - Race condition when measuring responseEnd; r=jduell.mcbugs
authorHonza Bambas <honzab.moz@firemni.cz>
Sun, 21 Aug 2011 09:27:29 +0100
changeset 76927 95996d0763a6b739ac9db4e472aa031ce7961f40
parent 76926 13010f8b9fe1d2920b5d77d305ae66983cd053d8
child 76928 c3679628bee56a99d714920dd17359bfa747190a
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs662555
milestone9.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 662555 - Race condition when measuring responseEnd; r=jduell.mcbugs
netwerk/protocol/http/nsHttpTransaction.cpp
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -587,18 +587,16 @@ nsHttpTransaction::Close(nsresult reason
 
     NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
 
     if (mClosed) {
         LOG(("  already closed\n"));
         return;
     }
 
-    mTimings.responseEnd = mozilla::TimeStamp::Now();
-
     if (mActivityDistributor) {
         // report the reponse is complete if not already reported
         if (!mResponseIsComplete)
             mActivityDistributor->ObserveActivity(
                 mChannel,
                 NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
                 NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE,
                 PR_Now(),
@@ -1116,16 +1114,19 @@ nsHttpTransaction::HandleContent(char *b
 
     // check for end-of-file
     if ((mContentRead == mContentLength) ||
         (mChunkedDecoder && mChunkedDecoder->ReachedEOF())) {
         // the transaction is done with a complete response.
         mTransactionDone = PR_TRUE;
         mResponseIsComplete = PR_TRUE;
 
+        if (TimingEnabled())
+            mTimings.responseEnd = mozilla::TimeStamp::Now();
+
         // report the entire response has arrived
         if (mActivityDistributor)
             mActivityDistributor->ObserveActivity(
                 mChannel,
                 NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
                 NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE,
                 PR_Now(),
                 static_cast<PRUint64>(mContentRead),