mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187137 (part 10) - Replace nsBaseHashtable::Enumerate() calls in netwerk/protocol/ with iterators. r=valentin.
This commit is contained in:
parent
be888fc20f
commit
5cdd4e0a25
@ -885,58 +885,6 @@ nsHttpConnectionMgr::PruneNoTrafficCB(const nsACString &key,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::ShutdownPassCB(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
void *closure)
|
||||
{
|
||||
nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
|
||||
|
||||
nsHttpTransaction *trans;
|
||||
nsHttpConnection *conn;
|
||||
|
||||
// close all active connections
|
||||
while (ent->mActiveConns.Length()) {
|
||||
conn = ent->mActiveConns[0];
|
||||
|
||||
ent->mActiveConns.RemoveElementAt(0);
|
||||
self->DecrementActiveConnCount(conn);
|
||||
|
||||
conn->Close(NS_ERROR_ABORT, true);
|
||||
NS_RELEASE(conn);
|
||||
}
|
||||
|
||||
// close all idle connections
|
||||
while (ent->mIdleConns.Length()) {
|
||||
conn = ent->mIdleConns[0];
|
||||
|
||||
ent->mIdleConns.RemoveElementAt(0);
|
||||
self->mNumIdleConns--;
|
||||
|
||||
conn->Close(NS_ERROR_ABORT);
|
||||
NS_RELEASE(conn);
|
||||
}
|
||||
// If all idle connections are removed,
|
||||
// we can stop pruning dead connections.
|
||||
self->ConditionallyStopPruneDeadConnectionsTimer();
|
||||
|
||||
// close all pending transactions
|
||||
while (ent->mPendingQ.Length()) {
|
||||
trans = ent->mPendingQ[0];
|
||||
|
||||
ent->mPendingQ.RemoveElementAt(0);
|
||||
|
||||
trans->Close(NS_ERROR_ABORT);
|
||||
NS_RELEASE(trans);
|
||||
}
|
||||
|
||||
// close all half open tcp connections
|
||||
for (int32_t i = ((int32_t) ent->mHalfOpens.Length()) - 1; i >= 0; i--)
|
||||
ent->mHalfOpens[i]->Abandon();
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
@ -1189,16 +1137,6 @@ nsHttpConnectionMgr::ClosePersistentConnections(nsConnectionEntry *ent)
|
||||
ent->mActiveConns[i]->DontReuse();
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::ClosePersistentConnectionsCB(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
void *closure)
|
||||
{
|
||||
nsHttpConnectionMgr *self = static_cast<nsHttpConnectionMgr *>(closure);
|
||||
self->ClosePersistentConnections(ent);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
bool
|
||||
nsHttpConnectionMgr::RestrictConnections(nsConnectionEntry *ent,
|
||||
bool ignorePossibleSpdyConnections)
|
||||
@ -2214,7 +2152,53 @@ nsHttpConnectionMgr::OnMsgShutdown(int32_t, ARefBase *param)
|
||||
LOG(("nsHttpConnectionMgr::OnMsgShutdown\n"));
|
||||
|
||||
gHttpHandler->StopRequestTokenBucket();
|
||||
mCT.Enumerate(ShutdownPassCB, this);
|
||||
|
||||
for (auto iter = mCT.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsAutoPtr<nsConnectionEntry>& ent = iter.Data();
|
||||
|
||||
// Close all active connections.
|
||||
while (ent->mActiveConns.Length()) {
|
||||
nsHttpConnection* conn = ent->mActiveConns[0];
|
||||
|
||||
ent->mActiveConns.RemoveElementAt(0);
|
||||
DecrementActiveConnCount(conn);
|
||||
|
||||
conn->Close(NS_ERROR_ABORT, true);
|
||||
NS_RELEASE(conn);
|
||||
}
|
||||
|
||||
// Close all idle connections.
|
||||
while (ent->mIdleConns.Length()) {
|
||||
nsHttpConnection* conn = ent->mIdleConns[0];
|
||||
|
||||
ent->mIdleConns.RemoveElementAt(0);
|
||||
mNumIdleConns--;
|
||||
|
||||
conn->Close(NS_ERROR_ABORT);
|
||||
NS_RELEASE(conn);
|
||||
}
|
||||
|
||||
// If all idle connections are removed we can stop pruning dead
|
||||
// connections.
|
||||
ConditionallyStopPruneDeadConnectionsTimer();
|
||||
|
||||
// Close all pending transactions.
|
||||
while (ent->mPendingQ.Length()) {
|
||||
nsHttpTransaction* trans = ent->mPendingQ[0];
|
||||
|
||||
ent->mPendingQ.RemoveElementAt(0);
|
||||
|
||||
trans->Close(NS_ERROR_ABORT);
|
||||
NS_RELEASE(trans);
|
||||
}
|
||||
|
||||
// Close all half open tcp connections.
|
||||
for (int32_t i = int32_t(ent->mHalfOpens.Length()) - 1; i >= 0; i--) {
|
||||
ent->mHalfOpens[i]->Abandon();
|
||||
}
|
||||
|
||||
iter.Remove();
|
||||
}
|
||||
|
||||
if (mTimeoutTick) {
|
||||
mTimeoutTick->Cancel();
|
||||
@ -2555,7 +2539,10 @@ nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup(int32_t, ARefBase *para
|
||||
|
||||
nsHttpConnectionInfo *ci = static_cast<nsHttpConnectionInfo *>(param);
|
||||
|
||||
mCT.Enumerate(ClosePersistentConnectionsCB, this);
|
||||
for (auto iter = mCT.Iter(); !iter.Done(); iter.Next()) {
|
||||
ClosePersistentConnections(iter.Data());
|
||||
}
|
||||
|
||||
if (ci)
|
||||
ResetIPFamilyPreference(ci);
|
||||
}
|
||||
|
@ -513,8 +513,6 @@ private:
|
||||
// NOTE: these members are only accessed on the socket transport thread
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
static PLDHashOperator ShutdownPassCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator ClosePersistentConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator VerifyTrafficCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator PruneNoTrafficCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
bool ProcessPendingQForEntry(nsConnectionEntry *, bool considerAll);
|
||||
|
Loading…
Reference in New Issue
Block a user