mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Fixes bug 86473 "nsHttpChannel needs to support Suspend/Resume"
r=bbaetz, sr=dougt, a=blizzard
This commit is contained in:
parent
f5f2872199
commit
66e6be63f0
@ -1605,13 +1605,23 @@ nsHttpChannel::Cancel(nsresult status)
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::Suspend()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
LOG(("nsHttpChannel::Suspend [this=%x]\n", this));
|
||||
if (mTransaction)
|
||||
mTransaction->Suspend();
|
||||
else if (mCacheReadRequest)
|
||||
mCacheReadRequest->Suspend();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::Resume()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
LOG(("nsHttpChannel::Resume [this=%x]\n", this));
|
||||
if (mTransaction)
|
||||
mTransaction->Resume();
|
||||
else if (mCacheReadRequest)
|
||||
mCacheReadRequest->Resume();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -225,14 +225,40 @@ nsHttpConnection::OnTransactionComplete(nsHttpTransaction *trans, nsresult statu
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// not called from the socket thread
|
||||
nsresult
|
||||
nsHttpConnection::Suspend()
|
||||
{
|
||||
// we only bother to suspend the read request, since that's the only
|
||||
// one that will effect our consumers.
|
||||
|
||||
nsCOMPtr<nsIRequest> readReq;
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
readReq = mReadRequest;
|
||||
}
|
||||
|
||||
if (readReq)
|
||||
readReq->Suspend();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// not called from the socket thread
|
||||
nsresult
|
||||
nsHttpConnection::Resume()
|
||||
{
|
||||
// XXX may require a lock to ensure thread safety
|
||||
// we only need to worry about resuming the read request, since that's
|
||||
// the only one that can be suspended.
|
||||
|
||||
if (mReadRequest)
|
||||
mReadRequest->Resume();
|
||||
nsCOMPtr<nsIRequest> readReq;
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
readReq = mReadRequest;
|
||||
}
|
||||
|
||||
if (readReq)
|
||||
readReq->Resume();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -76,7 +76,8 @@ public:
|
||||
// called by the transaction to inform the connection that it is done.
|
||||
nsresult OnTransactionComplete(nsHttpTransaction *, nsresult status);
|
||||
|
||||
// called by the transaction to resume a read-in-progress
|
||||
// called by the transaction to suspend/resume a read-in-progress
|
||||
nsresult Suspend();
|
||||
nsresult Resume();
|
||||
|
||||
// called to cause the underlying socket to start speaking SSL
|
||||
|
@ -636,7 +636,10 @@ nsHttpTransaction::Cancel(nsresult status)
|
||||
NS_IMETHODIMP
|
||||
nsHttpTransaction::Suspend()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
LOG(("nsHttpTransaction::Suspend [this=%x]\n", this));
|
||||
if (mConnection && !mTransactionDone)
|
||||
mConnection->Suspend();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// called from the consumer thread, while nothing is happening on the socket thread.
|
||||
@ -644,7 +647,7 @@ NS_IMETHODIMP
|
||||
nsHttpTransaction::Resume()
|
||||
{
|
||||
LOG(("nsHttpTransaction::Resume [this=%x]\n", this));
|
||||
if (mConnection)
|
||||
if (mConnection && !mTransactionDone)
|
||||
mConnection->Resume();
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user