bug 738812 timer serviced after thread exit nsHttpConnectionMgr::ReadTimeoutTick r=honzab

This commit is contained in:
Patrick McManus 2012-04-11 13:11:09 -04:00
Родитель 07cedf73d6
Коммит c222fd8c31
2 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -254,6 +254,24 @@ nsHttpConnectionMgr::ConditionallyStopPruneDeadConnectionsTimer()
}
}
void
nsHttpConnectionMgr::ConditionallyStopReadTimeoutTick()
{
LOG(("nsHttpConnectionMgr::ConditionallyStopReadTimeoutTick "
"armed=%d active=%d\n", mReadTimeoutTickArmed, mNumActiveConns));
if (!mReadTimeoutTickArmed)
return;
if (mNumActiveConns)
return;
LOG(("nsHttpConnectionMgr::ConditionallyStopReadTimeoutTick stop==true\n"));
mReadTimeoutTick->Cancel();
mReadTimeoutTickArmed = false;
}
//-----------------------------------------------------------------------------
// nsHttpConnectionMgr::nsIObserver
//-----------------------------------------------------------------------------
@ -1458,6 +1476,8 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
if (conn == ent->mYellowConnection)
ent->OnYellowComplete();
mNumActiveConns--;
ConditionallyStopReadTimeoutTick();
// sever back references to connection, and do so without triggering
// a call to ReclaimConnection ;-)
pipeline->SetConnection(nsnull);
@ -1589,6 +1609,7 @@ void
nsHttpConnectionMgr::RecvdConnect()
{
mNumActiveConns--;
ConditionallyStopReadTimeoutTick();
}
nsresult
@ -1868,6 +1889,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(PRInt32, void *param)
nsHttpConnection *temp = conn;
NS_RELEASE(temp);
mNumActiveConns--;
ConditionallyStopReadTimeoutTick();
}
if (conn->CanReuse()) {
@ -2001,12 +2023,6 @@ nsHttpConnectionMgr::ReadTimeoutTick()
LOG(("nsHttpConnectionMgr::ReadTimeoutTick active=%d\n",
mNumActiveConns));
if (!mNumActiveConns && mReadTimeoutTickArmed) {
mReadTimeoutTick->Cancel();
mReadTimeoutTickArmed = false;
return;
}
mCT.Enumerate(ReadTimeoutTickCB, this);
}

Просмотреть файл

@ -105,6 +105,10 @@ public:
// there are no more idle connections or active spdy ones
void ConditionallyStopPruneDeadConnectionsTimer();
// Stops timer used for the read timeout tick if there are no currently
// active connections.
void ConditionallyStopReadTimeoutTick();
// adds a transaction to the list of managed transactions.
nsresult AddTransaction(nsHttpTransaction *, PRInt32 priority);