зеркало из https://github.com/mozilla/gecko-dev.git
Bug 700659 - Slay nsHashSets in netwerk/protocol. r=mcmanus
This commit is contained in:
Родитель
6dd9a94b6b
Коммит
3ae0060106
|
@ -581,12 +581,11 @@ nsHttpConnectionMgr::ReportSpdyAlternateProtocol(nsHttpConnection *conn)
|
|||
if (mAlternateProtocolHash.Contains(hostPortKey))
|
||||
return;
|
||||
|
||||
if (mAlternateProtocolHash.mHashTable.entryCount > 2000)
|
||||
PL_DHashTableEnumerate(&mAlternateProtocolHash.mHashTable,
|
||||
&nsHttpConnectionMgr::TrimAlternateProtocolHash,
|
||||
this);
|
||||
if (mAlternateProtocolHash.Count() > 2000)
|
||||
mAlternateProtocolHash.EnumerateEntries(&TrimAlternateProtocolHash,
|
||||
this);
|
||||
|
||||
mAlternateProtocolHash.Put(hostPortKey);
|
||||
mAlternateProtocolHash.PutEntry(hostPortKey);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -596,18 +595,16 @@ nsHttpConnectionMgr::RemoveSpdyAlternateProtocol(nsACString &hostPortKey)
|
|||
// it is read from both the main and the network thread.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
return mAlternateProtocolHash.Remove(hostPortKey);
|
||||
return mAlternateProtocolHash.RemoveEntry(hostPortKey);
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsHttpConnectionMgr::TrimAlternateProtocolHash(PLDHashTable *table,
|
||||
PLDHashEntryHdr *hdr,
|
||||
PRUint32 number,
|
||||
nsHttpConnectionMgr::TrimAlternateProtocolHash(nsCStringHashKey *entry,
|
||||
void *closure)
|
||||
{
|
||||
nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
|
||||
|
||||
if (self->mAlternateProtocolHash.mHashTable.entryCount > 2000)
|
||||
if (self->mAlternateProtocolHash.Count() > 2000)
|
||||
return PL_DHASH_REMOVE;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsHashSets.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -425,10 +424,9 @@ private:
|
|||
nsClassHashtable<nsCStringHashKey, nsConnectionEntry> mCT;
|
||||
|
||||
// mAlternateProtocolHash is used only for spdy/2 upgrades for now
|
||||
nsCStringHashSet mAlternateProtocolHash; // protected by the monitor
|
||||
static PLDHashOperator TrimAlternateProtocolHash(PLDHashTable *table,
|
||||
PLDHashEntryHdr *hdr,
|
||||
PRUint32 number,
|
||||
// protected by the monitor
|
||||
nsTHashtable<nsCStringHashKey> mAlternateProtocolHash;
|
||||
static PLDHashOperator TrimAlternateProtocolHash(nsCStringHashKey *entry,
|
||||
void *closure);
|
||||
// Read Timeout Tick handlers
|
||||
void ActivateTimeoutTick();
|
||||
|
|
Загрузка…
Ссылка в новой задаче