зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset dd249f45dc3d
Clearly I don't know hg well enough, didn't mean to commit all this. a=I-messed-up
This commit is contained in:
Родитель
6f6cd3b97a
Коммит
88ff626760
|
@ -113,7 +113,6 @@ XPIDLSRCS = \
|
|||
nsIStreamLoader.idl \
|
||||
nsISyncStreamListener.idl \
|
||||
nsISystemProxySettings.idl \
|
||||
nsITimedChannel.idl \
|
||||
nsIUnicharStreamLoader.idl \
|
||||
nsIUploadChannel2.idl \
|
||||
nsIStandardURL.idl \
|
||||
|
|
|
@ -129,7 +129,6 @@ interface nsISocketTransport : nsITransport
|
|||
* of this interface may choose not to generate.
|
||||
*/
|
||||
const unsigned long STATUS_RESOLVING = 0x804b0003;
|
||||
const unsigned long STATUS_RESOLVED = 0x804b000b;
|
||||
const unsigned long STATUS_CONNECTING_TO = 0x804b0007;
|
||||
const unsigned long STATUS_CONNECTED_TO = 0x804b0004;
|
||||
const unsigned long STATUS_SENDING_TO = 0x804b0005;
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla networking code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Christian Biesinger <cbiesinger@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
// All properties return zero if the value is not available
|
||||
[scriptable, uuid(c259b593-a9bf-4d08-8149-ef89e1977dc4)]
|
||||
interface nsITimedChannel : nsISupports {
|
||||
// Set this attribute to true to enable collection of timing data.
|
||||
// channelCreationTime will be available even with this attribute set to
|
||||
// false.
|
||||
attribute boolean timingEnabled;
|
||||
|
||||
readonly attribute unsigned long long channelCreationTime;
|
||||
readonly attribute unsigned long long asyncOpenTime;
|
||||
|
||||
// The following are only set when the document is not (only) read from the
|
||||
// cache
|
||||
readonly attribute unsigned long long domainLookupStart;
|
||||
readonly attribute unsigned long long domainLookupEnd;
|
||||
readonly attribute unsigned long long connectStart;
|
||||
readonly attribute unsigned long long connectEnd;
|
||||
readonly attribute unsigned long long requestStart;
|
||||
readonly attribute unsigned long long responseStart;
|
||||
readonly attribute unsigned long long responseEnd;
|
||||
|
||||
// The following are only set if the document is (partially) read from the
|
||||
// cache
|
||||
readonly attribute unsigned long long cacheReadStart;
|
||||
readonly attribute unsigned long long cacheReadEnd;
|
||||
};
|
|
@ -1431,9 +1431,6 @@ nsSocketTransport::OnSocketEvent(PRUint32 type, nsresult status, nsISupports *pa
|
|||
break;
|
||||
|
||||
case MSG_DNS_LOOKUP_COMPLETE:
|
||||
if (mDNSRequest) // only send this if we actually resolved anything
|
||||
SendStatus(STATUS_RESOLVED);
|
||||
|
||||
SOCKET_LOG((" MSG_DNS_LOOKUP_COMPLETE\n"));
|
||||
mDNSRequest = 0;
|
||||
if (param) {
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
8=Read %1$S
|
||||
9=Wrote %1$S
|
||||
10=Waiting for %1$S…
|
||||
11=Looked up %1$S…
|
||||
|
||||
27=Beginning FTP transaction…
|
||||
28=Finished FTP transaction
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla networking code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Christian Biesinger <cbiesinger@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#ifndef TimingStruct_h_
|
||||
#define TimingStruct_h_
|
||||
|
||||
struct TimingStruct {
|
||||
TimingStruct() {
|
||||
memset(this, 0, sizeof(TimingStruct));
|
||||
}
|
||||
|
||||
PRTime channelCreation;
|
||||
PRTime asyncOpen;
|
||||
|
||||
PRTime domainLookupStart;
|
||||
PRTime domainLookupEnd;
|
||||
PRTime connectStart;
|
||||
PRTime connectEnd;
|
||||
PRTime requestStart;
|
||||
PRTime responseStart;
|
||||
PRTime responseEnd;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -135,13 +135,8 @@ nsHttpChannel::nsHttpChannel()
|
|||
, mFallingBack(PR_FALSE)
|
||||
, mWaitingForRedirectCallback(PR_FALSE)
|
||||
, mRequestTimeInitialized(PR_FALSE)
|
||||
, mTimingEnabled(PR_FALSE)
|
||||
, mAsyncOpenTime(0)
|
||||
, mCacheReadStart(0)
|
||||
, mCacheReadEnd(0)
|
||||
{
|
||||
LOG(("Creating nsHttpChannel [this=%p]\n", this));
|
||||
mChannelCreationTime = PR_Now();
|
||||
}
|
||||
|
||||
nsHttpChannel::~nsHttpChannel()
|
||||
|
@ -2823,9 +2818,6 @@ nsHttpChannel::ReadFromCache()
|
|||
rv = mCachePump->AsyncRead(this, mListenerContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mTimingEnabled)
|
||||
mCacheReadStart = PR_Now();
|
||||
|
||||
PRUint32 suspendCount = mSuspendCount;
|
||||
while (suspendCount--)
|
||||
mCachePump->Suspend();
|
||||
|
@ -3611,9 +3603,6 @@ nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
|
|||
if (mCanceled)
|
||||
return mStatus;
|
||||
|
||||
if (mTimingEnabled)
|
||||
mAsyncOpenTime = PR_Now();
|
||||
|
||||
rv = NS_CheckPortSafety(mURI);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -3757,109 +3746,6 @@ nsHttpChannel::GetProxyInfo(nsIProxyInfo **result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpChannel::nsITimedChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::SetTimingEnabled(PRBool enabled) {
|
||||
mTimingEnabled = enabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetTimingEnabled(PRBool* _retval) {
|
||||
*_retval = mTimingEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetChannelCreationTime(PRUint64* _retval) {
|
||||
*_retval = mChannelCreationTime;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetAsyncOpenTime(PRUint64* _retval) {
|
||||
*_retval = mAsyncOpenTime;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetDomainLookupStart(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().domainLookupStart;
|
||||
else
|
||||
*_retval = mTransactionTimings.domainLookupStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetDomainLookupEnd(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().domainLookupEnd;
|
||||
else
|
||||
*_retval = mTransactionTimings.domainLookupEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetConnectStart(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().connectStart;
|
||||
else
|
||||
*_retval = mTransactionTimings.connectStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetConnectEnd(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().connectEnd;
|
||||
else
|
||||
*_retval = mTransactionTimings.connectEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetRequestStart(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().requestStart;
|
||||
else
|
||||
*_retval = mTransactionTimings.requestStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetResponseStart(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().responseStart;
|
||||
else
|
||||
*_retval = mTransactionTimings.responseStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetResponseEnd(PRUint64* _retval) {
|
||||
if (mTransaction)
|
||||
*_retval = mTransaction->Timings().responseEnd;
|
||||
else
|
||||
*_retval = mTransactionTimings.responseEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCacheReadStart(PRUint64* _retval) {
|
||||
*_retval = mCacheReadStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCacheReadEnd(PRUint64* _retval) {
|
||||
*_retval = mCacheReadEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpChannel::nsIHttpAuthenticableChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -4055,10 +3941,6 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
|
|||
LOG(("nsHttpChannel::OnStopRequest [this=%p request=%p status=%x]\n",
|
||||
this, request, status));
|
||||
|
||||
if (mTimingEnabled && request == mCachePump) {
|
||||
mCacheReadEnd = PR_Now();
|
||||
}
|
||||
|
||||
// honor the cancelation status even if the underlying transaction completed.
|
||||
if (mCanceled || NS_FAILED(mStatus))
|
||||
status = mStatus;
|
||||
|
@ -4109,7 +3991,6 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
|
|||
}
|
||||
|
||||
// at this point, we're done with the transaction
|
||||
mTransactionTimings = mTransaction->Timings();
|
||||
mTransaction = nsnull;
|
||||
mTransactionPump = 0;
|
||||
|
||||
|
|
|
@ -64,8 +64,6 @@
|
|||
#include "nsIHttpChannelAuthProvider.h"
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsICryptoHash.h"
|
||||
#include "nsITimedChannel.h"
|
||||
#include "TimingStruct.h"
|
||||
|
||||
class nsAHttpConnection;
|
||||
class AutoRedirectVetoNotifier;
|
||||
|
@ -86,7 +84,6 @@ class nsHttpChannel : public HttpBaseChannel
|
|||
, public nsITraceableChannel
|
||||
, public nsIApplicationCacheChannel
|
||||
, public nsIAsyncVerifyRedirectCallback
|
||||
, public nsITimedChannel
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -102,7 +99,6 @@ public:
|
|||
NS_DECL_NSIAPPLICATIONCACHECONTAINER
|
||||
NS_DECL_NSIAPPLICATIONCACHECHANNEL
|
||||
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
||||
NS_DECL_NSITIMEDCHANNEL
|
||||
|
||||
// nsIHttpAuthenticableChannel. We can't use
|
||||
// NS_DECL_NSIHTTPAUTHENTICABLECHANNEL because it duplicates cancel() and
|
||||
|
@ -350,21 +346,11 @@ private:
|
|||
// True if mRequestTime has been set. In such a case it is safe to update
|
||||
// the cache entry's expiration time. Otherwise, it is not(see bug 567360).
|
||||
PRUint32 mRequestTimeInitialized : 1;
|
||||
// True if timing collection is enabled
|
||||
PRUint32 mTimingEnabled : 1;
|
||||
|
||||
nsTArray<nsContinueRedirectionFunc> mRedirectFuncStack;
|
||||
|
||||
nsCOMPtr<nsICryptoHash> mHasher;
|
||||
|
||||
PRTime mChannelCreationTime;
|
||||
PRTime mAsyncOpenTime;
|
||||
PRTime mCacheReadStart;
|
||||
PRTime mCacheReadEnd;
|
||||
// copied from the transaction before we null out mTransaction
|
||||
// so that the timing can still be queried from OnStopRequest
|
||||
TimingStruct mTransactionTimings;
|
||||
|
||||
nsresult WaitForRedirectCallback();
|
||||
void PushRedirectAsyncFunc(nsContinueRedirectionFunc func);
|
||||
void PopRedirectAsyncFunc(nsContinueRedirectionFunc func);
|
||||
|
|
|
@ -357,18 +357,6 @@ nsHttpTransaction::OnTransportStatus(nsresult status, PRUint64 progress)
|
|||
LOG(("nsHttpTransaction::OnSocketStatus [this=%x status=%x progress=%llu]\n",
|
||||
this, status, progress));
|
||||
|
||||
if (TimingEnabled()) {
|
||||
if (status == nsISocketTransport::STATUS_RESOLVING) {
|
||||
mTimings.domainLookupStart = PR_Now();
|
||||
} else if (status == nsISocketTransport::STATUS_RESOLVED) {
|
||||
mTimings.domainLookupEnd = PR_Now();
|
||||
} else if (status == nsISocketTransport::STATUS_CONNECTING_TO) {
|
||||
mTimings.connectStart = PR_Now();
|
||||
} else if (status == nsISocketTransport::STATUS_CONNECTED_TO) {
|
||||
mTimings.connectEnd = PR_Now();
|
||||
}
|
||||
}
|
||||
|
||||
if (!mTransportSink)
|
||||
return;
|
||||
|
||||
|
@ -459,10 +447,6 @@ nsHttpTransaction::ReadRequestSegment(nsIInputStream *stream,
|
|||
nsresult rv = trans->mReader->OnReadSegment(buf, count, countRead);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (trans->TimingEnabled() && !trans->mTimings.requestStart) {
|
||||
// First data we're sending -> this is requestStart
|
||||
trans->mTimings.requestStart = PR_Now();
|
||||
}
|
||||
trans->mSentData = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -522,10 +506,6 @@ nsHttpTransaction::WritePipeSegment(nsIOutputStream *stream,
|
|||
if (trans->mTransactionDone)
|
||||
return NS_BASE_STREAM_CLOSED; // stop iterating
|
||||
|
||||
if (trans->TimingEnabled() && !trans->mTimings.responseStart) {
|
||||
trans->mTimings.responseStart = PR_Now();
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
//
|
||||
// OK, now let the caller fill this segment with data.
|
||||
|
@ -588,8 +568,6 @@ nsHttpTransaction::Close(nsresult reason)
|
|||
return;
|
||||
}
|
||||
|
||||
mTimings.responseEnd = PR_Now();
|
||||
|
||||
if (mActivityDistributor) {
|
||||
// report the reponse is complete if not already reported
|
||||
if (!mResponseIsComplete)
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "nsISocketTransportService.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "TimingStruct.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -138,8 +137,6 @@ public:
|
|||
void SetPriority(PRInt32 priority) { mPriority = priority; }
|
||||
PRInt32 Priority() { return mPriority; }
|
||||
|
||||
const TimingStruct& Timings() const { return mTimings; }
|
||||
|
||||
private:
|
||||
nsresult Restart();
|
||||
void ParseLine(char *line);
|
||||
|
@ -155,8 +152,6 @@ private:
|
|||
static NS_METHOD WritePipeSegment(nsIOutputStream *, void *, char *,
|
||||
PRUint32, PRUint32, PRUint32 *);
|
||||
|
||||
PRBool TimingEnabled() const { return PR_TRUE; }
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsITransportEventSink> mTransportSink;
|
||||
|
@ -187,8 +182,6 @@ private:
|
|||
|
||||
nsHttpChunkedDecoder *mChunkedDecoder;
|
||||
|
||||
TimingStruct mTimings;
|
||||
|
||||
nsresult mStatus;
|
||||
|
||||
PRInt16 mPriority;
|
||||
|
|
|
@ -16,23 +16,10 @@ function change_content_type() {
|
|||
function TestListener() {
|
||||
}
|
||||
TestListener.prototype.onStartRequest = function(request, context) {
|
||||
try {
|
||||
// request might be different from channel
|
||||
channel = request.QueryInterface(Components.interfaces.nsIChannel);
|
||||
|
||||
change_content_type();
|
||||
} catch (ex) {
|
||||
print(ex);
|
||||
throw ex;
|
||||
}
|
||||
change_content_type();
|
||||
}
|
||||
TestListener.prototype.onStopRequest = function(request, context, status) {
|
||||
try {
|
||||
change_content_type();
|
||||
} catch (ex) {
|
||||
print(ex);
|
||||
// don't re-throw ex to avoid hanging the test
|
||||
}
|
||||
change_content_type();
|
||||
|
||||
do_timeout(0, after_channel_closed);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче