зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1187137 (part 3) - Replace nsBaseHashtable::Enumerate() calls in netwerk/protocol/ with iterators. r=michal.
--HG-- extra : rebase_source : 14445e0a69e5fdff108857b443e1e8fa2829415f
This commit is contained in:
Родитель
1b73f741f6
Коммит
7226cb18c8
|
@ -847,30 +847,6 @@ nsHttpConnectionMgr::ProcessAllTransactionsCB(const nsACString &key,
|
|||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
// If the global number of connections is preventing the opening of
|
||||
// new connections to a host without idle connections, then
|
||||
// close any spdy asap
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::PurgeExcessSpdyConnectionsCB(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
void *closure)
|
||||
{
|
||||
if (!ent->mUsingSpdy)
|
||||
return PL_DHASH_NEXT;
|
||||
|
||||
nsHttpConnectionMgr *self = static_cast<nsHttpConnectionMgr *>(closure);
|
||||
for (uint32_t index = 0; index < ent->mActiveConns.Length(); ++index) {
|
||||
nsHttpConnection *conn = ent->mActiveConns[index];
|
||||
if (conn->UsingSpdy() && conn->CanReuse()) {
|
||||
conn->DontReuse();
|
||||
// stop on <= (particularly =) beacuse this dontreuse causes async close
|
||||
if (self->mNumIdleConns + self->mNumActiveConns + 1 <= self->mMaxConns)
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key,
|
||||
nsAutoPtr<nsConnectionEntry> &ent,
|
||||
|
@ -1467,7 +1443,33 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent,
|
|||
|
||||
if ((mNumIdleConns + mNumActiveConns + 1 >= mMaxConns) &&
|
||||
mNumActiveConns && gHttpHandler->IsSpdyEnabled())
|
||||
mCT.Enumerate(PurgeExcessSpdyConnectionsCB, this);
|
||||
{
|
||||
// If the global number of connections is preventing the opening of new
|
||||
// connections to a host without idle connections, then close any spdy
|
||||
// ASAP.
|
||||
for (auto iter = mCT.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsAutoPtr<nsConnectionEntry> &ent = iter.Data();
|
||||
if (!ent->mUsingSpdy) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32_t index = 0;
|
||||
index < ent->mActiveConns.Length();
|
||||
++index) {
|
||||
nsHttpConnection *conn = ent->mActiveConns[index];
|
||||
if (conn->UsingSpdy() && conn->CanReuse()) {
|
||||
conn->DontReuse();
|
||||
// Stop on <= (particularly =) because this dontreuse
|
||||
// causes async close.
|
||||
if (mNumIdleConns + mNumActiveConns + 1 <= mMaxConns) {
|
||||
goto outerLoopEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outerLoopEnd:
|
||||
;
|
||||
}
|
||||
|
||||
if (AtActiveConnectionLimit(ent, trans->Caps()))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
|
|
@ -514,7 +514,6 @@ private:
|
|||
|
||||
static PLDHashOperator PruneDeadConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator ShutdownPassCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
|
||||
static PLDHashOperator PurgeExcessSpdyConnectionsCB(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 *);
|
||||
|
|
Загрузка…
Ссылка в новой задаче