mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
attemping fix for linux Ts/Txul startup regression, b=189567
This commit is contained in:
parent
436f9566be
commit
8d699694dc
@ -373,13 +373,14 @@ nsInputStreamPump::OnStateTransfer()
|
||||
}
|
||||
else if (NS_SUCCEEDED(rv) && avail) {
|
||||
// figure out how much data to report (XXX detect overflow??)
|
||||
if (avail + mStreamOffset > mStreamLength) {
|
||||
if (avail + mStreamOffset > mStreamLength)
|
||||
avail = mStreamLength - mStreamOffset;
|
||||
if (avail > mSegSize)
|
||||
avail = mSegSize;
|
||||
}
|
||||
|
||||
if (avail) {
|
||||
// XXX need to make max ODA size configurable
|
||||
if (avail > 16384)
|
||||
avail = 16384;
|
||||
|
||||
LOG((" calling OnDataAvailable [offset=%u count=%u]\n", mStreamOffset, avail));
|
||||
|
||||
rv = mListener->OnDataAvailable(this, mListenerContext, mAsyncStream, mStreamOffset, avail);
|
||||
@ -395,8 +396,14 @@ nsInputStreamPump::OnStateTransfer()
|
||||
if (NS_SUCCEEDED(mStatus)) {
|
||||
if (NS_FAILED(rv))
|
||||
mStatus = rv;
|
||||
else if (avail)
|
||||
return STATE_TRANSFER;
|
||||
else if (avail) {
|
||||
// if stream is now closed, advance to STATE_STOP right away.
|
||||
// Available may return 0 bytes available at the moment; that
|
||||
// would not mean that we are done.
|
||||
rv = mAsyncStream->Available(&avail);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return STATE_TRANSFER;
|
||||
}
|
||||
}
|
||||
return STATE_STOP;
|
||||
}
|
||||
|
@ -613,10 +613,9 @@ nsPipeInputStream::Available(PRUint32 *result)
|
||||
{
|
||||
nsAutoMonitor mon(mPipe->Monitor());
|
||||
|
||||
// return error if pipe closed with error.
|
||||
// return error if pipe closed
|
||||
if (!mAvailable && NS_FAILED(mPipe->mStatus))
|
||||
if (mPipe->mStatus != NS_BASE_STREAM_CLOSED)
|
||||
return mPipe->mStatus;
|
||||
return mPipe->mStatus;
|
||||
|
||||
*result = mAvailable;
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user