mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1050009 - Initialize pldhash tables with a length, not a capacity. r=roc.
* * * imported patch rm-dummy-params --HG-- extra : rebase_source : c25987eb11bae197218d5fc53b77def19afa36ac
This commit is contained in:
parent
afda080009
commit
8c60d14a1a
@ -37,7 +37,7 @@ using namespace mozilla::dom;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DocManager::DocManager()
|
||||
: mDocAccessibleCache(4)
|
||||
: mDocAccessibleCache(2)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ DocAccessible::
|
||||
nsIPresShell* aPresShell) :
|
||||
HyperTextAccessibleWrap(aRootContent, this),
|
||||
// XXX aaronl should we use an algorithm for the initial cache size?
|
||||
mAccessibleCache(kDefaultCacheSize),
|
||||
mNodeToAccessibleMap(kDefaultCacheSize),
|
||||
mAccessibleCache(kDefaultCacheLength),
|
||||
mNodeToAccessibleMap(kDefaultCacheLength),
|
||||
mDocumentNode(aDocument),
|
||||
mScrollPositionChangedTicks(0),
|
||||
mLoadState(eTreeConstructionPending), mDocFlags(0), mLoadEventType(0),
|
||||
|
@ -26,7 +26,7 @@ class nsAccessiblePivot;
|
||||
|
||||
class nsIScrollableView;
|
||||
|
||||
const uint32_t kDefaultCacheSize = 256;
|
||||
const uint32_t kDefaultCacheLength = 128;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
@ -61,7 +61,7 @@ nsWinUtils::MaybeStartWindowEmulation()
|
||||
Compatibility::IsDolphin() ||
|
||||
XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
RegisterNativeWindow(kClassNameTabContent);
|
||||
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(4);
|
||||
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(2);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ XULTreeAccessible::
|
||||
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
||||
nsTreeBodyFrame* aTreeFrame) :
|
||||
AccessibleWrap(aContent, aDoc),
|
||||
mAccessibleCache(kDefaultTreeCacheSize)
|
||||
mAccessibleCache(kDefaultTreeCacheLength)
|
||||
{
|
||||
mType = eXULTreeType;
|
||||
mGenericTypes |= eSelect;
|
||||
|
@ -20,7 +20,7 @@ namespace a11y {
|
||||
* A class the represents the XUL Tree widget.
|
||||
*/
|
||||
const uint32_t kMaxTreeColumns = 100;
|
||||
const uint32_t kDefaultTreeCacheSize = 256;
|
||||
const uint32_t kDefaultTreeCacheLength = 128;
|
||||
|
||||
/**
|
||||
* Accessible class for XUL tree element.
|
||||
|
@ -261,7 +261,7 @@ XULTreeGridRowAccessible::
|
||||
Accessible* aTreeAcc, nsITreeBoxObject* aTree,
|
||||
nsITreeView* aTreeView, int32_t aRow) :
|
||||
XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow),
|
||||
mAccessibleCache(kDefaultTreeCacheSize)
|
||||
mAccessibleCache(kDefaultTreeCacheLength)
|
||||
{
|
||||
mGenericTypes |= eTableRow;
|
||||
}
|
||||
|
@ -124,8 +124,7 @@ nsChromeRegistryChrome::Init()
|
||||
mSelectedLocale = NS_LITERAL_CSTRING("en-US");
|
||||
mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
|
||||
|
||||
PL_DHashTableInit(&mPackagesHash, &kTableOps,
|
||||
nullptr, sizeof(PackageEntry), 16);
|
||||
PL_DHashTableInit(&mPackagesHash, &kTableOps, nullptr, sizeof(PackageEntry));
|
||||
|
||||
bool safeMode = false;
|
||||
nsCOMPtr<nsIXULRuntime> xulrun (do_GetService(XULAPPINFO_SERVICE_CONTRACTID));
|
||||
|
@ -219,10 +219,8 @@ NS_GetContentList(nsINode* aRootNode,
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gContentListHashTable.ops) {
|
||||
PL_DHashTableInit(&gContentListHashTable,
|
||||
&hash_table_ops, nullptr,
|
||||
sizeof(ContentListHashEntry),
|
||||
16);
|
||||
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops, nullptr,
|
||||
sizeof(ContentListHashEntry));
|
||||
}
|
||||
|
||||
ContentListHashEntry *entry = nullptr;
|
||||
@ -336,10 +334,8 @@ GetFuncStringContentList(nsINode* aRootNode,
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gFuncStringContentListHashTable.ops) {
|
||||
PL_DHashTableInit(&gFuncStringContentListHashTable,
|
||||
&hash_table_ops, nullptr,
|
||||
sizeof(FuncStringContentListHashEntry),
|
||||
16);
|
||||
PL_DHashTableInit(&gFuncStringContentListHashTable, &hash_table_ops,
|
||||
nullptr, sizeof(FuncStringContentListHashEntry));
|
||||
}
|
||||
|
||||
FuncStringContentListHashEntry *entry = nullptr;
|
||||
|
@ -486,7 +486,7 @@ nsContentUtils::Init()
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
|
||||
nullptr, sizeof(EventListenerManagerMapEntry), 16);
|
||||
nullptr, sizeof(EventListenerManagerMapEntry));
|
||||
|
||||
RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
|
||||
}
|
||||
@ -637,9 +637,9 @@ nsContentUtils::InitializeEventTable() {
|
||||
};
|
||||
|
||||
sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>(
|
||||
int(ArrayLength(eventArray) / 0.75) + 1);
|
||||
ArrayLength(eventArray));
|
||||
sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>(
|
||||
int(ArrayLength(eventArray) / 0.75) + 1);
|
||||
ArrayLength(eventArray));
|
||||
sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
|
||||
|
||||
// Subtract one from the length because of the trailing null
|
||||
|
@ -3741,7 +3741,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
||||
};
|
||||
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, nullptr,
|
||||
sizeof(SubDocMapEntry), 16);
|
||||
sizeof(SubDocMapEntry));
|
||||
if (!mSubDocuments) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -6818,7 +6818,7 @@ nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
if (!mBoxObjectTable) {
|
||||
mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>(12);
|
||||
mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>(6);
|
||||
} else {
|
||||
nsCOMPtr<nsPIBoxObject> boxObject = mBoxObjectTable->Get(aElement);
|
||||
if (boxObject) {
|
||||
|
@ -294,7 +294,7 @@ nsPropertyTable::PropertyList::PropertyList(nsIAtom *aName,
|
||||
mNext(nullptr)
|
||||
{
|
||||
PL_DHashTableInit(&mObjectValueMap, PL_DHashGetStubOps(), this,
|
||||
sizeof(PropertyListMapEntry), 16);
|
||||
sizeof(PropertyListMapEntry));
|
||||
}
|
||||
|
||||
nsPropertyTable::PropertyList::~PropertyList()
|
||||
|
@ -74,7 +74,7 @@ HTMLFormControlsCollection::HTMLFormControlsCollection(HTMLFormElement* aForm)
|
||||
// Initialize the elements list to have an initial capacity
|
||||
// of 8 to reduce allocations on small forms.
|
||||
, mElements(8)
|
||||
, mNameLookupTable(HTMLFormElement::FORM_CONTROL_LIST_HASHTABLE_SIZE)
|
||||
, mNameLookupTable(HTMLFormElement::FORM_CONTROL_LIST_HASHTABLE_LENGTH)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ bool HTMLFormElement::gPasswordManagerInitialized = false;
|
||||
HTMLFormElement::HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mControls(new HTMLFormControlsCollection(MOZ_THIS_IN_INITIALIZER_LIST())),
|
||||
mSelectedRadioButtons(4),
|
||||
mRequiredRadioButtonCounts(4),
|
||||
mValueMissingRadioGroups(4),
|
||||
mSelectedRadioButtons(2),
|
||||
mRequiredRadioButtonCounts(2),
|
||||
mValueMissingRadioGroups(2),
|
||||
mGeneratingSubmit(false),
|
||||
mGeneratingReset(false),
|
||||
mIsSubmitting(false),
|
||||
@ -102,8 +102,8 @@ HTMLFormElement::HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNode
|
||||
mDefaultSubmitElement(nullptr),
|
||||
mFirstSubmitInElements(nullptr),
|
||||
mFirstSubmitNotInElements(nullptr),
|
||||
mImageNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_SIZE),
|
||||
mPastNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_SIZE),
|
||||
mImageNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_LENGTH),
|
||||
mPastNameLookupTable(FORM_CONTROL_LIST_HASHTABLE_LENGTH),
|
||||
mInvalidElementsCount(0),
|
||||
mEverTriedInvalidSubmit(false)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
|
||||
enum {
|
||||
FORM_CONTROL_LIST_HASHTABLE_SIZE = 16
|
||||
FORM_CONTROL_LIST_HASHTABLE_LENGTH = 8
|
||||
};
|
||||
|
||||
// nsISupports
|
||||
|
@ -797,8 +797,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
|
||||
|
||||
if (! mBroadcasterMap) {
|
||||
mBroadcasterMap =
|
||||
PL_NewDHashTable(&gOps, nullptr, sizeof(BroadcasterMapEntry),
|
||||
PL_DHASH_MIN_SIZE);
|
||||
PL_NewDHashTable(&gOps, nullptr, sizeof(BroadcasterMapEntry));
|
||||
|
||||
if (! mBroadcasterMap) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -9,8 +9,7 @@
|
||||
void
|
||||
nsContentSupportMap::Init()
|
||||
{
|
||||
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), PL_DHASH_MIN_SIZE);
|
||||
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr, sizeof(Entry));
|
||||
}
|
||||
|
||||
void
|
||||
@ -26,7 +25,7 @@ nsContentSupportMap::Remove(nsIContent* aElement)
|
||||
if (!mMap.ops)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsIContent* child = aElement;
|
||||
nsIContent* child = aElement;
|
||||
do {
|
||||
PL_DHashTableOperate(&mMap, child, PL_DHASH_REMOVE);
|
||||
child = child->GetNextNode(aElement);
|
||||
|
@ -20,7 +20,11 @@ protected:
|
||||
PLDHashTable mTable;
|
||||
|
||||
void
|
||||
Init() { PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), nullptr, sizeof(Entry), PL_DHASH_MIN_SIZE); }
|
||||
Init()
|
||||
{
|
||||
PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry));
|
||||
}
|
||||
|
||||
void
|
||||
Finish() { PL_DHashTableFinish(&mTable); }
|
||||
|
@ -1612,7 +1612,7 @@ nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
|
||||
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
|
||||
}
|
||||
|
||||
nsTHashtable<nsPtrHashKey<nsIContent>> translationNodesHash(1000);
|
||||
nsTHashtable<nsPtrHashKey<nsIContent>> translationNodesHash(500);
|
||||
nsRefPtr<nsTranslationNodeList> list = new nsTranslationNodeList;
|
||||
|
||||
uint32_t limit = 15000;
|
||||
|
@ -314,7 +314,7 @@ nsScriptNameSpaceManager::RegisterInterface(const char* aIfName,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define GLOBALNAME_HASHTABLE_INITIAL_SIZE 1024
|
||||
#define GLOBALNAME_HASHTABLE_INITIAL_LENGTH 512
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::Init()
|
||||
@ -333,14 +333,14 @@ nsScriptNameSpaceManager::Init()
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE,
|
||||
fallible_t());
|
||||
fallible_t(),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mNavigatorNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE,
|
||||
fallible_t());
|
||||
fallible_t(),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
|
||||
if (!mIsInitialized) {
|
||||
PL_DHashTableFinish(&mGlobalNames);
|
||||
|
||||
|
@ -61,7 +61,7 @@ Client::InitOrigin(PersistenceType aPersistenceType, const nsACString& aGroup,
|
||||
// and also get the usage.
|
||||
|
||||
nsAutoTArray<nsString, 20> subdirsToProcess;
|
||||
nsAutoTArray<nsCOMPtr<nsIFile> , 20> unknownFiles;
|
||||
nsAutoTArray<nsCOMPtr<nsIFile>, 20> unknownFiles;
|
||||
nsTHashtable<nsStringHashKey> validSubdirs(20);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> entries;
|
||||
|
@ -1725,7 +1725,7 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
|
||||
if (!sNPObjWrappers.ops) {
|
||||
// No hash yet (or any more), initialize it.
|
||||
PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(NPObjWrapperHashEntry), 16);
|
||||
sizeof(NPObjWrapperHashEntry));
|
||||
}
|
||||
|
||||
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
|
||||
|
@ -98,7 +98,7 @@ NS_IMPL_ISUPPORTS(DOMStorageManager,
|
||||
nsIDOMStorageManager)
|
||||
|
||||
DOMStorageManager::DOMStorageManager(DOMStorage::StorageType aType)
|
||||
: mCaches(10)
|
||||
: mCaches(8)
|
||||
, mType(aType)
|
||||
, mLowDiskSpace(false)
|
||||
{
|
||||
|
@ -490,7 +490,7 @@ nsBindingManager::PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
|
||||
NS_PRECONDITION(aDocumentInfo, "Must have a non-null documentinfo!");
|
||||
|
||||
if (!mDocumentTable) {
|
||||
mDocumentTable = new nsRefPtrHashtable<nsURIHashKey,nsXBLDocumentInfo>(16);
|
||||
mDocumentTable = new nsRefPtrHashtable<nsURIHashKey,nsXBLDocumentInfo>();
|
||||
}
|
||||
|
||||
mDocumentTable->Put(aDocumentInfo->DocumentURI(), aDocumentInfo);
|
||||
@ -521,7 +521,8 @@ nsBindingManager::PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListen
|
||||
NS_PRECONDITION(aListener, "Must have a non-null listener!");
|
||||
|
||||
if (!mLoadingDocTable) {
|
||||
mLoadingDocTable = new nsInterfaceHashtable<nsURIHashKey,nsIStreamListener>(16);
|
||||
mLoadingDocTable =
|
||||
new nsInterfaceHashtable<nsURIHashKey,nsIStreamListener>();
|
||||
}
|
||||
mLoadingDocTable->Put(aURL, aListener);
|
||||
|
||||
|
@ -598,7 +598,8 @@ void
|
||||
nsXBLPrototypeBinding::EnsureAttributeTable()
|
||||
{
|
||||
if (!mAttributeTable) {
|
||||
mAttributeTable = new nsClassHashtable<nsUint32HashKey, InnerAttributeTable>(4);
|
||||
mAttributeTable =
|
||||
new nsClassHashtable<nsUint32HashKey, InnerAttributeTable>(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,7 +610,7 @@ nsXBLPrototypeBinding::AddToAttributeTable(int32_t aSourceNamespaceID, nsIAtom*
|
||||
{
|
||||
InnerAttributeTable* attributesNS = mAttributeTable->Get(aSourceNamespaceID);
|
||||
if (!attributesNS) {
|
||||
attributesNS = new InnerAttributeTable(4);
|
||||
attributesNS = new InnerAttributeTable(2);
|
||||
mAttributeTable->Put(aSourceNamespaceID, attributesNS);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class txLoadedDocumentsHash : public nsTHashtable<txLoadedDocumentEntry>
|
||||
{
|
||||
public:
|
||||
txLoadedDocumentsHash()
|
||||
: nsTHashtable<txLoadedDocumentEntry>(8),
|
||||
: nsTHashtable<txLoadedDocumentEntry>(4),
|
||||
mSourceDocument(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ class txKeyHash
|
||||
{
|
||||
public:
|
||||
txKeyHash(const txOwningExpandedNameMap<txXSLKey>& aKeys)
|
||||
: mKeyValues(8)
|
||||
: mKeyValues(4)
|
||||
, mIndexedKeys(1)
|
||||
, mKeys(aKeys)
|
||||
{
|
||||
|
@ -42,8 +42,8 @@ nsCommandParams::~nsCommandParams()
|
||||
nsresult
|
||||
nsCommandParams::Init()
|
||||
{
|
||||
PL_DHashTableInit(&mValuesHash, &sHashOps, (void *)this, sizeof(HashEntry), 4);
|
||||
|
||||
PL_DHashTableInit(&mValuesHash, &sHashOps, (void *)this,
|
||||
sizeof(HashEntry), 2);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -263,17 +263,16 @@ nsCommandParams::HashEntry*
|
||||
nsCommandParams::GetIndexedEntry(int32_t index)
|
||||
{
|
||||
HashEntry* entry = reinterpret_cast<HashEntry*>(mValuesHash.entryStore);
|
||||
HashEntry* limit = entry + PL_DHASH_TABLE_SIZE(&mValuesHash);
|
||||
HashEntry* limit = entry + PL_DHASH_TABLE_CAPACITY(&mValuesHash);
|
||||
uint32_t entryCount = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
do {
|
||||
if (!PL_DHASH_ENTRY_IS_LIVE(entry))
|
||||
continue;
|
||||
|
||||
if ((int32_t)entryCount == index)
|
||||
return entry;
|
||||
|
||||
|
||||
entryCount ++;
|
||||
} while (++entry < limit);
|
||||
|
||||
@ -285,11 +284,10 @@ uint32_t
|
||||
nsCommandParams::GetNumEntries()
|
||||
{
|
||||
HashEntry* entry = reinterpret_cast<HashEntry*>(mValuesHash.entryStore);
|
||||
HashEntry* limit = entry + PL_DHASH_TABLE_SIZE(&mValuesHash);
|
||||
HashEntry* limit = entry + PL_DHASH_TABLE_CAPACITY(&mValuesHash);
|
||||
uint32_t entryCount = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
do {
|
||||
if (PL_DHASH_ENTRY_IS_LIVE(entry))
|
||||
entryCount ++;
|
||||
} while (++entry < limit);
|
||||
|
@ -13,11 +13,11 @@ NS_NewControllerCommandTable(nsIControllerCommandTable** aResult);
|
||||
|
||||
|
||||
// this value is used to size the hash table. Just a sensible upper bound
|
||||
#define NUM_COMMANDS_BOUNDS 64
|
||||
#define NUM_COMMANDS_LENGTH 32
|
||||
|
||||
|
||||
nsControllerCommandTable::nsControllerCommandTable()
|
||||
: mCommandsTable(NUM_COMMANDS_BOUNDS)
|
||||
: mCommandsTable(NUM_COMMANDS_LENGTH)
|
||||
, mMutable(true)
|
||||
{
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ int32_t
|
||||
gfxDWriteFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
|
||||
{
|
||||
if (!mGlyphWidths) {
|
||||
mGlyphWidths = new nsDataHashtable<nsUint32HashKey,int32_t>(200);
|
||||
mGlyphWidths = new nsDataHashtable<nsUint32HashKey,int32_t>(128);
|
||||
}
|
||||
|
||||
int32_t width = -1;
|
||||
|
@ -162,7 +162,7 @@ gfxFT2Font::gfxFT2Font(cairo_scaled_font_t *aCairoFont,
|
||||
const gfxFontStyle *aFontStyle,
|
||||
bool aNeedsBold)
|
||||
: gfxFT2FontBase(aCairoFont, aFontEntry, aFontStyle)
|
||||
, mCharGlyphCache(64)
|
||||
, mCharGlyphCache(32)
|
||||
{
|
||||
NS_ASSERTION(mFontEntry, "Unable to find font entry for font. Something is whack.");
|
||||
mApplySyntheticBold = aNeedsBold;
|
||||
|
@ -673,7 +673,7 @@ gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t **aBlob)
|
||||
if (!mFontTableCache) {
|
||||
// we do this here rather than on fontEntry construction
|
||||
// because not all shapers will access the table cache at all
|
||||
mFontTableCache = new nsTHashtable<FontTableHashEntry>(10);
|
||||
mFontTableCache = new nsTHashtable<FontTableHashEntry>(8);
|
||||
}
|
||||
|
||||
FontTableHashEntry *entry = mFontTableCache->GetEntry(aTag);
|
||||
@ -692,7 +692,7 @@ gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
||||
if (MOZ_UNLIKELY(!mFontTableCache)) {
|
||||
// we do this here rather than on fontEntry construction
|
||||
// because not all shapers will access the table cache at all
|
||||
mFontTableCache = new nsTHashtable<FontTableHashEntry>(10);
|
||||
mFontTableCache = new nsTHashtable<FontTableHashEntry>(8);
|
||||
}
|
||||
|
||||
FontTableHashEntry *entry = mFontTableCache->PutEntry(aTag);
|
||||
|
@ -10,7 +10,7 @@
|
||||
using namespace mozilla;
|
||||
|
||||
gfxFontFeatureValueSet::gfxFontFeatureValueSet()
|
||||
: mFontFeatureValues(10)
|
||||
: mFontFeatureValues(8)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -313,9 +313,9 @@ gfxFontconfigUtils::NewPattern(const nsTArray<nsString>& aFamilies,
|
||||
}
|
||||
|
||||
gfxFontconfigUtils::gfxFontconfigUtils()
|
||||
: mFontsByFamily(50)
|
||||
, mFontsByFullname(50)
|
||||
, mLangSupportTable(50)
|
||||
: mFontsByFamily(32)
|
||||
, mFontsByFullname(32)
|
||||
, mLangSupportTable(32)
|
||||
, mLastConfig(nullptr)
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
, mBundledFontsInitialized(false)
|
||||
|
@ -431,7 +431,7 @@ gfxGDIFont::GetGlyph(uint32_t aUnicode, uint32_t aVarSelector)
|
||||
}
|
||||
|
||||
if (!mGlyphIDs) {
|
||||
mGlyphIDs = new nsDataHashtable<nsUint32HashKey,uint32_t>(128);
|
||||
mGlyphIDs = new nsDataHashtable<nsUint32HashKey,uint32_t>(64);
|
||||
}
|
||||
|
||||
uint32_t gid;
|
||||
@ -459,7 +459,7 @@ int32_t
|
||||
gfxGDIFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
|
||||
{
|
||||
if (!mGlyphWidths) {
|
||||
mGlyphWidths = new nsDataHashtable<nsUint32HashKey,int32_t>(200);
|
||||
mGlyphWidths = new nsDataHashtable<nsUint32HashKey,int32_t>(128);
|
||||
}
|
||||
|
||||
int32_t width;
|
||||
|
@ -572,7 +572,7 @@ GDIFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
|
||||
*/
|
||||
|
||||
gfxGDIFontList::gfxGDIFontList()
|
||||
: mFontSubstitutes(50)
|
||||
: mFontSubstitutes(32)
|
||||
{
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
ActivateBundledFonts();
|
||||
|
@ -915,7 +915,7 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont)
|
||||
double requestedSize = -1.0;
|
||||
FcPatternGetDouble(mSortPattern, FC_PIXEL_SIZE, 0, &requestedSize);
|
||||
|
||||
nsTHashtable<gfxFontconfigUtils::DepFcStrEntry> existingFamilies(50);
|
||||
nsTHashtable<gfxFontconfigUtils::DepFcStrEntry> existingFamilies(32);
|
||||
FcChar8 *family;
|
||||
for (int v = 0;
|
||||
FcPatternGetString(mSortPattern,
|
||||
|
@ -167,8 +167,8 @@ gfxPlatformFontList::MemoryReporter::CollectReports(
|
||||
}
|
||||
|
||||
gfxPlatformFontList::gfxPlatformFontList(bool aNeedFullnamePostscriptNames)
|
||||
: mFontFamilies(100), mOtherFamilyNames(30),
|
||||
mPrefFonts(10), mBadUnderlineFamilyNames(10), mSharedCmaps(16),
|
||||
: mFontFamilies(64), mOtherFamilyNames(16),
|
||||
mPrefFonts(8), mBadUnderlineFamilyNames(8), mSharedCmaps(8),
|
||||
mStartIndex(0), mIncrement(1), mNumFamilies(0)
|
||||
{
|
||||
mOtherFamilyNamesInitialized = false;
|
||||
@ -397,7 +397,7 @@ gfxPlatformFontList::LookupInFaceNameLists(const nsAString& aFaceName)
|
||||
// names not completely initialized, so keep track of lookup misses
|
||||
if (!mFaceNameListsInitialized) {
|
||||
if (!mFaceNamesMissed) {
|
||||
mFaceNamesMissed = new nsTHashtable<nsStringHashKey>(4);
|
||||
mFaceNamesMissed = new nsTHashtable<nsStringHashKey>(2);
|
||||
}
|
||||
mFaceNamesMissed->PutEntry(aFaceName);
|
||||
}
|
||||
@ -416,7 +416,7 @@ gfxPlatformFontList::PreloadNamesList()
|
||||
for (uint32_t i = 0; i < numFonts; i++) {
|
||||
nsAutoString key;
|
||||
GenerateFontListKey(preloadFonts[i], key);
|
||||
|
||||
|
||||
// only search canonical names!
|
||||
gfxFontFamily *familyEntry = mFontFamilies.GetWeak(key);
|
||||
if (familyEntry) {
|
||||
@ -760,7 +760,7 @@ gfxPlatformFontList::FindFamily(const nsAString& aFamily)
|
||||
// localized family names load timed out, add name to list of
|
||||
// names to check after localized names are loaded
|
||||
if (!mOtherNamesMissed) {
|
||||
mOtherNamesMissed = new nsTHashtable<nsStringHashKey>(4);
|
||||
mOtherNamesMissed = new nsTHashtable<nsStringHashKey>(2);
|
||||
}
|
||||
mOtherNamesMissed->PutEntry(key);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ protected:
|
||||
bool mFaceNameListsInitialized;
|
||||
|
||||
struct ExtraNames {
|
||||
ExtraNames() : mFullnames(100), mPostscriptNames(100) {}
|
||||
ExtraNames() : mFullnames(64), mPostscriptNames(64) {}
|
||||
// fullname ==> font entry (unique, one name per font entry)
|
||||
nsRefPtrHashtable<nsStringHashKey, gfxFontEntry> mFullnames;
|
||||
// Postscript name ==> font entry (unique, one name per font entry)
|
||||
|
@ -565,7 +565,7 @@ gfxProxyFontEntry::LoadFont(gfxMixedFontFamily *aFamily,
|
||||
}
|
||||
|
||||
gfxUserFontSet::gfxUserFontSet()
|
||||
: mFontFamilies(5), mLocalRulesUsed(false)
|
||||
: mFontFamilies(4), mLocalRulesUsed(false)
|
||||
{
|
||||
IncrementGeneration();
|
||||
gfxPlatformFontList *fp = gfxPlatformFontList::PlatformFontList();
|
||||
|
@ -292,7 +292,7 @@ NS_IMPL_ISUPPORTS(GPUAdapterReporter, nsIMemoryReporter)
|
||||
|
||||
gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
: mD3D11DeviceInitialized(false)
|
||||
, mPrefFonts(50)
|
||||
, mPrefFonts(32)
|
||||
{
|
||||
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
|
||||
mUseClearTypeAlways = UNINITIALIZED_VALUE;
|
||||
|
@ -309,9 +309,9 @@ ReportOnCaller(JSCLContextHelper &helper,
|
||||
mozJSComponentLoader::mozJSComponentLoader()
|
||||
: mRuntime(nullptr),
|
||||
mContext(nullptr),
|
||||
mModules(32),
|
||||
mImports(32),
|
||||
mInProgressImports(32),
|
||||
mModules(16),
|
||||
mImports(16),
|
||||
mInProgressImports(16),
|
||||
mInitialized(false),
|
||||
mReuseLoaderGlobal(false)
|
||||
{
|
||||
|
@ -3114,15 +3114,15 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
||||
mAutoRoots(nullptr),
|
||||
mResolveName(JSID_VOID),
|
||||
mResolvingWrapper(nullptr),
|
||||
mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_SIZE)),
|
||||
mWrappedJSClassMap(IID2WrappedJSClassMap::newMap(XPC_JS_CLASS_MAP_SIZE)),
|
||||
mIID2NativeInterfaceMap(IID2NativeInterfaceMap::newMap(XPC_NATIVE_INTERFACE_MAP_SIZE)),
|
||||
mClassInfo2NativeSetMap(ClassInfo2NativeSetMap::newMap(XPC_NATIVE_SET_MAP_SIZE)),
|
||||
mNativeSetMap(NativeSetMap::newMap(XPC_NATIVE_SET_MAP_SIZE)),
|
||||
mThisTranslatorMap(IID2ThisTranslatorMap::newMap(XPC_THIS_TRANSLATOR_MAP_SIZE)),
|
||||
mNativeScriptableSharedMap(XPCNativeScriptableSharedMap::newMap(XPC_NATIVE_JSCLASS_MAP_SIZE)),
|
||||
mDyingWrappedNativeProtoMap(XPCWrappedNativeProtoMap::newMap(XPC_DYING_NATIVE_PROTO_MAP_SIZE)),
|
||||
mDetachedWrappedNativeProtoMap(XPCWrappedNativeProtoMap::newMap(XPC_DETACHED_NATIVE_PROTO_MAP_SIZE)),
|
||||
mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_LENGTH)),
|
||||
mWrappedJSClassMap(IID2WrappedJSClassMap::newMap(XPC_JS_CLASS_MAP_LENGTH)),
|
||||
mIID2NativeInterfaceMap(IID2NativeInterfaceMap::newMap(XPC_NATIVE_INTERFACE_MAP_LENGTH)),
|
||||
mClassInfo2NativeSetMap(ClassInfo2NativeSetMap::newMap(XPC_NATIVE_SET_MAP_LENGTH)),
|
||||
mNativeSetMap(NativeSetMap::newMap(XPC_NATIVE_SET_MAP_LENGTH)),
|
||||
mThisTranslatorMap(IID2ThisTranslatorMap::newMap(XPC_THIS_TRANSLATOR_MAP_LENGTH)),
|
||||
mNativeScriptableSharedMap(XPCNativeScriptableSharedMap::newMap(XPC_NATIVE_JSCLASS_MAP_LENGTH)),
|
||||
mDyingWrappedNativeProtoMap(XPCWrappedNativeProtoMap::newMap(XPC_DYING_NATIVE_PROTO_MAP_LENGTH)),
|
||||
mDetachedWrappedNativeProtoMap(XPCWrappedNativeProtoMap::newMap(XPC_DETACHED_NATIVE_PROTO_MAP_LENGTH)),
|
||||
mGCIsRunning(false),
|
||||
mWrappedJSToReleaseArray(),
|
||||
mNativesToReleaseArray(),
|
||||
|
@ -116,9 +116,9 @@ JSObject2WrappedJSMap::ShutdownMarker()
|
||||
|
||||
// static
|
||||
Native2WrappedNativeMap*
|
||||
Native2WrappedNativeMap::newMap(int size)
|
||||
Native2WrappedNativeMap::newMap(int length)
|
||||
{
|
||||
Native2WrappedNativeMap* map = new Native2WrappedNativeMap(size);
|
||||
Native2WrappedNativeMap* map = new Native2WrappedNativeMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
// Allocation of the map or the creation of its hash table has
|
||||
@ -129,10 +129,10 @@ Native2WrappedNativeMap::newMap(int size)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Native2WrappedNativeMap::Native2WrappedNativeMap(int size)
|
||||
Native2WrappedNativeMap::Native2WrappedNativeMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), size);
|
||||
sizeof(Entry), length);
|
||||
}
|
||||
|
||||
Native2WrappedNativeMap::~Native2WrappedNativeMap()
|
||||
@ -173,18 +173,18 @@ const struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
|
||||
|
||||
// static
|
||||
IID2WrappedJSClassMap*
|
||||
IID2WrappedJSClassMap::newMap(int size)
|
||||
IID2WrappedJSClassMap::newMap(int length)
|
||||
{
|
||||
IID2WrappedJSClassMap* map = new IID2WrappedJSClassMap(size);
|
||||
IID2WrappedJSClassMap* map = new IID2WrappedJSClassMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IID2WrappedJSClassMap::IID2WrappedJSClassMap(int size)
|
||||
IID2WrappedJSClassMap::IID2WrappedJSClassMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), size);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2WrappedJSClassMap::~IID2WrappedJSClassMap()
|
||||
@ -210,18 +210,18 @@ const struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps =
|
||||
|
||||
// static
|
||||
IID2NativeInterfaceMap*
|
||||
IID2NativeInterfaceMap::newMap(int size)
|
||||
IID2NativeInterfaceMap::newMap(int length)
|
||||
{
|
||||
IID2NativeInterfaceMap* map = new IID2NativeInterfaceMap(size);
|
||||
IID2NativeInterfaceMap* map = new IID2NativeInterfaceMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IID2NativeInterfaceMap::IID2NativeInterfaceMap(int size)
|
||||
IID2NativeInterfaceMap::IID2NativeInterfaceMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), size);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2NativeInterfaceMap::~IID2NativeInterfaceMap()
|
||||
@ -252,19 +252,19 @@ IID2NativeInterfaceMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr,
|
||||
|
||||
// static
|
||||
ClassInfo2NativeSetMap*
|
||||
ClassInfo2NativeSetMap::newMap(int size)
|
||||
ClassInfo2NativeSetMap::newMap(int length)
|
||||
{
|
||||
ClassInfo2NativeSetMap* map = new ClassInfo2NativeSetMap(size);
|
||||
ClassInfo2NativeSetMap* map = new ClassInfo2NativeSetMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassInfo2NativeSetMap::ClassInfo2NativeSetMap(int size)
|
||||
ClassInfo2NativeSetMap::ClassInfo2NativeSetMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), size);
|
||||
sizeof(Entry), length);
|
||||
}
|
||||
|
||||
ClassInfo2NativeSetMap::~ClassInfo2NativeSetMap()
|
||||
@ -288,9 +288,9 @@ ClassInfo2NativeSetMap::ShallowSizeOfIncludingThis(mozilla::MallocSizeOf mallocS
|
||||
|
||||
// static
|
||||
ClassInfo2WrappedNativeProtoMap*
|
||||
ClassInfo2WrappedNativeProtoMap::newMap(int size)
|
||||
ClassInfo2WrappedNativeProtoMap::newMap(int length)
|
||||
{
|
||||
ClassInfo2WrappedNativeProtoMap* map = new ClassInfo2WrappedNativeProtoMap(size);
|
||||
ClassInfo2WrappedNativeProtoMap* map = new ClassInfo2WrappedNativeProtoMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
// Allocation of the map or the creation of its hash table has
|
||||
@ -301,10 +301,10 @@ ClassInfo2WrappedNativeProtoMap::newMap(int size)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassInfo2WrappedNativeProtoMap::ClassInfo2WrappedNativeProtoMap(int size)
|
||||
ClassInfo2WrappedNativeProtoMap::ClassInfo2WrappedNativeProtoMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), size);
|
||||
sizeof(Entry), length);
|
||||
}
|
||||
|
||||
ClassInfo2WrappedNativeProtoMap::~ClassInfo2WrappedNativeProtoMap()
|
||||
@ -417,18 +417,18 @@ const struct PLDHashTableOps NativeSetMap::Entry::sOps =
|
||||
|
||||
// static
|
||||
NativeSetMap*
|
||||
NativeSetMap::newMap(int size)
|
||||
NativeSetMap::newMap(int length)
|
||||
{
|
||||
NativeSetMap* map = new NativeSetMap(size);
|
||||
NativeSetMap* map = new NativeSetMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NativeSetMap::NativeSetMap(int size)
|
||||
NativeSetMap::NativeSetMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), size);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
NativeSetMap::~NativeSetMap()
|
||||
@ -484,18 +484,18 @@ const struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps =
|
||||
|
||||
// static
|
||||
IID2ThisTranslatorMap*
|
||||
IID2ThisTranslatorMap::newMap(int size)
|
||||
IID2ThisTranslatorMap::newMap(int length)
|
||||
{
|
||||
IID2ThisTranslatorMap* map = new IID2ThisTranslatorMap(size);
|
||||
IID2ThisTranslatorMap* map = new IID2ThisTranslatorMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IID2ThisTranslatorMap::IID2ThisTranslatorMap(int size)
|
||||
IID2ThisTranslatorMap::IID2ThisTranslatorMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), size);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2ThisTranslatorMap::~IID2ThisTranslatorMap()
|
||||
@ -564,19 +564,19 @@ const struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps =
|
||||
|
||||
// static
|
||||
XPCNativeScriptableSharedMap*
|
||||
XPCNativeScriptableSharedMap::newMap(int size)
|
||||
XPCNativeScriptableSharedMap::newMap(int length)
|
||||
{
|
||||
XPCNativeScriptableSharedMap* map =
|
||||
new XPCNativeScriptableSharedMap(size);
|
||||
new XPCNativeScriptableSharedMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
XPCNativeScriptableSharedMap::XPCNativeScriptableSharedMap(int size)
|
||||
XPCNativeScriptableSharedMap::XPCNativeScriptableSharedMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), size);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
XPCNativeScriptableSharedMap::~XPCNativeScriptableSharedMap()
|
||||
@ -619,19 +619,19 @@ XPCNativeScriptableSharedMap::GetNewOrUsed(uint32_t flags,
|
||||
|
||||
// static
|
||||
XPCWrappedNativeProtoMap*
|
||||
XPCWrappedNativeProtoMap::newMap(int size)
|
||||
XPCWrappedNativeProtoMap::newMap(int length)
|
||||
{
|
||||
XPCWrappedNativeProtoMap* map = new XPCWrappedNativeProtoMap(size);
|
||||
XPCWrappedNativeProtoMap* map = new XPCWrappedNativeProtoMap(length);
|
||||
if (map && map->mTable)
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
XPCWrappedNativeProtoMap::XPCWrappedNativeProtoMap(int size)
|
||||
XPCWrappedNativeProtoMap::XPCWrappedNativeProtoMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(PLDHashEntryStub), size);
|
||||
sizeof(PLDHashEntryStub), length);
|
||||
}
|
||||
|
||||
XPCWrappedNativeProtoMap::~XPCWrappedNativeProtoMap()
|
||||
|
@ -30,9 +30,9 @@ class JSObject2WrappedJSMap
|
||||
js::SystemAllocPolicy> Map;
|
||||
|
||||
public:
|
||||
static JSObject2WrappedJSMap* newMap(int size) {
|
||||
static JSObject2WrappedJSMap* newMap(int length) {
|
||||
JSObject2WrappedJSMap* map = new JSObject2WrappedJSMap();
|
||||
if (map && map->mTable.init(size))
|
||||
if (map && map->mTable.init(length))
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
@ -106,7 +106,7 @@ public:
|
||||
XPCWrappedNative* value;
|
||||
};
|
||||
|
||||
static Native2WrappedNativeMap* newMap(int size);
|
||||
static Native2WrappedNativeMap* newMap(int length);
|
||||
|
||||
inline XPCWrappedNative* Find(nsISupports* Obj)
|
||||
{
|
||||
@ -177,7 +177,7 @@ public:
|
||||
static const struct PLDHashTableOps sOps;
|
||||
};
|
||||
|
||||
static IID2WrappedJSClassMap* newMap(int size);
|
||||
static IID2WrappedJSClassMap* newMap(int length);
|
||||
|
||||
inline nsXPCWrappedJSClass* Find(REFNSIID iid)
|
||||
{
|
||||
@ -234,7 +234,7 @@ public:
|
||||
static const struct PLDHashTableOps sOps;
|
||||
};
|
||||
|
||||
static IID2NativeInterfaceMap* newMap(int size);
|
||||
static IID2NativeInterfaceMap* newMap(int length);
|
||||
|
||||
inline XPCNativeInterface* Find(REFNSIID iid)
|
||||
{
|
||||
@ -294,7 +294,7 @@ public:
|
||||
XPCNativeSet* value;
|
||||
};
|
||||
|
||||
static ClassInfo2NativeSetMap* newMap(int size);
|
||||
static ClassInfo2NativeSetMap* newMap(int length);
|
||||
|
||||
inline XPCNativeSet* Find(nsIClassInfo* info)
|
||||
{
|
||||
@ -354,7 +354,7 @@ public:
|
||||
XPCWrappedNativeProto* value;
|
||||
};
|
||||
|
||||
static ClassInfo2WrappedNativeProtoMap* newMap(int size);
|
||||
static ClassInfo2WrappedNativeProtoMap* newMap(int length);
|
||||
|
||||
inline XPCWrappedNativeProto* Find(nsIClassInfo* info)
|
||||
{
|
||||
@ -419,7 +419,7 @@ public:
|
||||
static const struct PLDHashTableOps sOps;
|
||||
};
|
||||
|
||||
static NativeSetMap* newMap(int size);
|
||||
static NativeSetMap* newMap(int length);
|
||||
|
||||
inline XPCNativeSet* Find(XPCNativeSetKey* key)
|
||||
{
|
||||
@ -496,7 +496,7 @@ public:
|
||||
static const struct PLDHashTableOps sOps;
|
||||
};
|
||||
|
||||
static IID2ThisTranslatorMap* newMap(int size);
|
||||
static IID2ThisTranslatorMap* newMap(int length);
|
||||
|
||||
inline nsIXPCFunctionThisTranslator* Find(REFNSIID iid)
|
||||
{
|
||||
@ -557,7 +557,7 @@ public:
|
||||
static const struct PLDHashTableOps sOps;
|
||||
};
|
||||
|
||||
static XPCNativeScriptableSharedMap* newMap(int size);
|
||||
static XPCNativeScriptableSharedMap* newMap(int length);
|
||||
|
||||
bool GetNewOrUsed(uint32_t flags, char* name, uint32_t interfacesBitmap,
|
||||
XPCNativeScriptableInfo* si);
|
||||
@ -579,7 +579,7 @@ private:
|
||||
class XPCWrappedNativeProtoMap
|
||||
{
|
||||
public:
|
||||
static XPCWrappedNativeProtoMap* newMap(int size);
|
||||
static XPCWrappedNativeProtoMap* newMap(int length);
|
||||
|
||||
inline XPCWrappedNativeProto* Add(XPCWrappedNativeProto* proto)
|
||||
{
|
||||
@ -620,9 +620,9 @@ class JSObject2JSObjectMap
|
||||
js::SystemAllocPolicy> Map;
|
||||
|
||||
public:
|
||||
static JSObject2JSObjectMap* newMap(int size) {
|
||||
static JSObject2JSObjectMap* newMap(int length) {
|
||||
JSObject2JSObjectMap* map = new JSObject2JSObjectMap();
|
||||
if (map && map->mTable.init(size))
|
||||
if (map && map->mTable.init(length))
|
||||
return map;
|
||||
delete map;
|
||||
return nullptr;
|
||||
|
@ -77,8 +77,8 @@ RemoteXULForbidsXBLScope(nsIPrincipal *aPrincipal, HandleObject aGlobal)
|
||||
|
||||
XPCWrappedNativeScope::XPCWrappedNativeScope(JSContext *cx,
|
||||
JS::HandleObject aGlobal)
|
||||
: mWrappedNativeMap(Native2WrappedNativeMap::newMap(XPC_NATIVE_MAP_SIZE)),
|
||||
mWrappedNativeProtoMap(ClassInfo2WrappedNativeProtoMap::newMap(XPC_NATIVE_PROTO_MAP_SIZE)),
|
||||
: mWrappedNativeMap(Native2WrappedNativeMap::newMap(XPC_NATIVE_MAP_LENGTH)),
|
||||
mWrappedNativeProtoMap(ClassInfo2WrappedNativeProtoMap::newMap(XPC_NATIVE_PROTO_MAP_LENGTH)),
|
||||
mComponents(nullptr),
|
||||
mNext(nullptr),
|
||||
mGlobalJSObject(aGlobal),
|
||||
|
@ -175,20 +175,20 @@
|
||||
/***************************************************************************/
|
||||
// default initial sizes for maps (hashtables)
|
||||
|
||||
#define XPC_CONTEXT_MAP_SIZE 16
|
||||
#define XPC_JS_MAP_SIZE 64
|
||||
#define XPC_JS_CLASS_MAP_SIZE 64
|
||||
#define XPC_CONTEXT_MAP_LENGTH 8
|
||||
#define XPC_JS_MAP_LENGTH 32
|
||||
#define XPC_JS_CLASS_MAP_LENGTH 32
|
||||
|
||||
#define XPC_NATIVE_MAP_SIZE 64
|
||||
#define XPC_NATIVE_PROTO_MAP_SIZE 16
|
||||
#define XPC_DYING_NATIVE_PROTO_MAP_SIZE 16
|
||||
#define XPC_DETACHED_NATIVE_PROTO_MAP_SIZE 32
|
||||
#define XPC_NATIVE_INTERFACE_MAP_SIZE 64
|
||||
#define XPC_NATIVE_SET_MAP_SIZE 64
|
||||
#define XPC_NATIVE_JSCLASS_MAP_SIZE 32
|
||||
#define XPC_THIS_TRANSLATOR_MAP_SIZE 8
|
||||
#define XPC_NATIVE_WRAPPER_MAP_SIZE 16
|
||||
#define XPC_WRAPPER_MAP_SIZE 16
|
||||
#define XPC_NATIVE_MAP_LENGTH 32
|
||||
#define XPC_NATIVE_PROTO_MAP_LENGTH 8
|
||||
#define XPC_DYING_NATIVE_PROTO_MAP_LENGTH 8
|
||||
#define XPC_DETACHED_NATIVE_PROTO_MAP_LENGTH 16
|
||||
#define XPC_NATIVE_INTERFACE_MAP_LENGTH 32
|
||||
#define XPC_NATIVE_SET_MAP_LENGTH 32
|
||||
#define XPC_NATIVE_JSCLASS_MAP_LENGTH 16
|
||||
#define XPC_THIS_TRANSLATOR_MAP_LENGTH 4
|
||||
#define XPC_NATIVE_WRAPPER_MAP_LENGTH 8
|
||||
#define XPC_WRAPPER_MAP_LENGTH 8
|
||||
|
||||
/***************************************************************************/
|
||||
// data declarations...
|
||||
|
@ -86,7 +86,7 @@ WrapperFactory::CreateXrayWaiver(JSContext *cx, HandleObject obj)
|
||||
// one waiver for the lifetime of the target object.
|
||||
if (!scope->mWaiverWrapperMap) {
|
||||
scope->mWaiverWrapperMap =
|
||||
JSObject2JSObjectMap::newMap(XPC_WRAPPER_MAP_SIZE);
|
||||
JSObject2JSObjectMap::newMap(XPC_WRAPPER_MAP_LENGTH);
|
||||
MOZ_ASSERT(scope->mWaiverWrapperMap);
|
||||
}
|
||||
if (!scope->mWaiverWrapperMap->Add(cx, obj, waiver))
|
||||
|
@ -199,7 +199,7 @@ nsCounterList::RecalcAll()
|
||||
}
|
||||
|
||||
nsCounterManager::nsCounterManager()
|
||||
: mNames(16)
|
||||
: mNames()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ nsFrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame)
|
||||
"unexpected frame type");
|
||||
if (!mPlaceholderMap.ops) {
|
||||
PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps, nullptr,
|
||||
sizeof(PlaceholderMapEntry), 16);
|
||||
sizeof(PlaceholderMapEntry));
|
||||
}
|
||||
PlaceholderMapEntry *entry = static_cast<PlaceholderMapEntry*>(PL_DHashTableOperate(&mPlaceholderMap,
|
||||
aPlaceholderFrame->GetOutOfFlowFrame(),
|
||||
|
@ -573,8 +573,8 @@ TextOverflow::ProcessLine(const nsDisplayListSet& aLists,
|
||||
mLeft.mActive = mLeft.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP;
|
||||
mRight.Reset();
|
||||
mRight.mActive = mRight.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP;
|
||||
|
||||
FrameHashtable framesToHide(100);
|
||||
|
||||
FrameHashtable framesToHide(64);
|
||||
AlignmentEdges alignmentEdges;
|
||||
ExamineLineFrames(aLine, &framesToHide, &alignmentEdges);
|
||||
bool needLeft = mLeft.IsNeeded();
|
||||
|
@ -342,9 +342,9 @@ private:
|
||||
MOZ_ASSERT(!mFlags.mHasHashedFrames);
|
||||
uint32_t count = GetChildCount();
|
||||
mFlags.mHasHashedFrames = 1;
|
||||
uint32_t minSize =
|
||||
std::max(kMinChildCountForHashtable, uint32_t(PL_DHASH_MIN_SIZE));
|
||||
mFrames = new nsTHashtable< nsPtrHashKey<nsIFrame> >(std::max(count, minSize));
|
||||
uint32_t minLength = std::max(kMinChildCountForHashtable,
|
||||
uint32_t(PL_DHASH_DEFAULT_INITIAL_LENGTH));
|
||||
mFrames = new nsTHashtable< nsPtrHashKey<nsIFrame> >(std::max(count, minLength));
|
||||
for (nsIFrame* f = mFirstChild; count-- > 0; f = f->GetNextSibling()) {
|
||||
mFrames->PutEntry(f);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ struct KeyframeDataComparator {
|
||||
|
||||
class ResolvedStyleCache {
|
||||
public:
|
||||
ResolvedStyleCache() : mCache(16) {}
|
||||
ResolvedStyleCache() : mCache() {}
|
||||
nsStyleContext* Get(nsPresContext *aPresContext,
|
||||
nsStyleContext *aParentStyleContext,
|
||||
nsCSSKeyframeRule *aKeyframe);
|
||||
|
@ -115,13 +115,13 @@ static nsCSSProperty gAliases[eCSSAliasCount != 0 ? eCSSAliasCount : 1] = {
|
||||
};
|
||||
|
||||
nsStaticCaseInsensitiveNameTable*
|
||||
CreateStaticTable(const char* const aRawTable[], int32_t aSize)
|
||||
CreateStaticTable(const char* const aRawTable[], int32_t aLength)
|
||||
{
|
||||
auto table = new nsStaticCaseInsensitiveNameTable();
|
||||
if (table) {
|
||||
#ifdef DEBUG
|
||||
// let's verify the table...
|
||||
for (int32_t index = 0; index < aSize; ++index) {
|
||||
for (int32_t index = 0; index < aLength; ++index) {
|
||||
nsAutoCString temp1(aRawTable[index]);
|
||||
nsAutoCString temp2(aRawTable[index]);
|
||||
ToLowerCase(temp1);
|
||||
@ -131,7 +131,7 @@ CreateStaticTable(const char* const aRawTable[], int32_t aSize)
|
||||
"underscore char in case insensitive name table");
|
||||
}
|
||||
#endif
|
||||
table->Init(aRawTable, aSize);
|
||||
table->Init(aRawTable, aLength);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
PL_DHashTableInit(&mIdTable,
|
||||
mQuirksMode ? &RuleHash_IdTable_CIOps.ops
|
||||
: &RuleHash_IdTable_CSOps.ops,
|
||||
nullptr, sizeof(RuleHashTableEntry), 16);
|
||||
nullptr, sizeof(RuleHashTableEntry));
|
||||
}
|
||||
AppendRuleToTable(&mIdTable, selector->mIDList->mAtom, aRuleInfo);
|
||||
RULE_HASH_STAT_INCREMENT(mIdSelectors);
|
||||
@ -641,7 +641,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
PL_DHashTableInit(&mClassTable,
|
||||
mQuirksMode ? &RuleHash_ClassTable_CIOps.ops
|
||||
: &RuleHash_ClassTable_CSOps.ops,
|
||||
nullptr, sizeof(RuleHashTableEntry), 16);
|
||||
nullptr, sizeof(RuleHashTableEntry));
|
||||
}
|
||||
AppendRuleToTable(&mClassTable, selector->mClassList->mAtom, aRuleInfo);
|
||||
RULE_HASH_STAT_INCREMENT(mClassSelectors);
|
||||
@ -650,7 +650,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
RuleValue ruleValue(aRuleInfo, mRuleCount++, mQuirksMode);
|
||||
if (!mTagTable.ops) {
|
||||
PL_DHashTableInit(&mTagTable, &RuleHash_TagTable_Ops, nullptr,
|
||||
sizeof(RuleHashTagTableEntry), 16);
|
||||
sizeof(RuleHashTagTableEntry));
|
||||
}
|
||||
AppendRuleToTagTable(&mTagTable, selector->mLowercaseTag, ruleValue);
|
||||
RULE_HASH_STAT_INCREMENT(mTagSelectors);
|
||||
@ -663,7 +663,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
else if (kNameSpaceID_Unknown != selector->mNameSpace) {
|
||||
if (!mNameSpaceTable.ops) {
|
||||
PL_DHashTableInit(&mNameSpaceTable, &RuleHash_NameSpaceTable_Ops, nullptr,
|
||||
sizeof(RuleHashTableEntry), 16);
|
||||
sizeof(RuleHashTableEntry));
|
||||
}
|
||||
AppendRuleToTable(&mNameSpaceTable,
|
||||
NS_INT32_TO_PTR(selector->mNameSpace), aRuleInfo);
|
||||
@ -925,8 +925,8 @@ struct RuleCascadeData {
|
||||
: mRuleHash(aQuirksMode),
|
||||
mStateSelectors(),
|
||||
mSelectorDocumentStates(0),
|
||||
mKeyframesRuleTable(16),
|
||||
mCounterStyleRuleTable(16),
|
||||
mKeyframesRuleTable(),
|
||||
mCounterStyleRuleTable(),
|
||||
mCacheKey(aMedium),
|
||||
mNext(nullptr),
|
||||
mQuirksMode(aQuirksMode)
|
||||
@ -934,21 +934,21 @@ struct RuleCascadeData {
|
||||
// mAttributeSelectors is matching on the attribute _name_, not the value,
|
||||
// and we case-fold names at parse-time, so this is a case-sensitive match.
|
||||
PL_DHashTableInit(&mAttributeSelectors, &AtomSelector_CSOps, nullptr,
|
||||
sizeof(AtomSelectorEntry), 16);
|
||||
sizeof(AtomSelectorEntry));
|
||||
PL_DHashTableInit(&mAnonBoxRules, &RuleHash_TagTable_Ops, nullptr,
|
||||
sizeof(RuleHashTagTableEntry), 16);
|
||||
sizeof(RuleHashTagTableEntry));
|
||||
PL_DHashTableInit(&mIdSelectors,
|
||||
aQuirksMode ? &AtomSelector_CIOps.ops :
|
||||
&AtomSelector_CSOps,
|
||||
nullptr, sizeof(AtomSelectorEntry), 16);
|
||||
nullptr, sizeof(AtomSelectorEntry));
|
||||
PL_DHashTableInit(&mClassSelectors,
|
||||
aQuirksMode ? &AtomSelector_CIOps.ops :
|
||||
&AtomSelector_CSOps,
|
||||
nullptr, sizeof(AtomSelectorEntry), 16);
|
||||
nullptr, sizeof(AtomSelectorEntry));
|
||||
memset(mPseudoElementRuleHashes, 0, sizeof(mPseudoElementRuleHashes));
|
||||
#ifdef MOZ_XUL
|
||||
PL_DHashTableInit(&mXULTreeRules, &RuleHash_TagTable_Ops, nullptr,
|
||||
sizeof(RuleHashTagTableEntry), 16);
|
||||
sizeof(RuleHashTagTableEntry));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3280,7 +3280,7 @@ struct CascadeEnumData {
|
||||
mSheetType(aSheetType)
|
||||
{
|
||||
if (!PL_DHashTableInit(&mRulesByWeight, &gRulesByWeightOps, nullptr,
|
||||
sizeof(RuleByWeightEntry), 64, fallible_t()))
|
||||
sizeof(RuleByWeightEntry), fallible_t(), 32))
|
||||
mRulesByWeight.ops = nullptr;
|
||||
|
||||
// Initialize our arena
|
||||
|
@ -479,7 +479,7 @@ nsHTMLStyleSheet::UniqueMappedAttributes(nsMappedAttributes* aMapped)
|
||||
{
|
||||
if (!mMappedAttrTable.ops) {
|
||||
PL_DHashTableInit(&mMappedAttrTable, &MappedAttrTable_Ops,
|
||||
nullptr, sizeof(MappedAttrTableEntry), 16);
|
||||
nullptr, sizeof(MappedAttrTableEntry));
|
||||
}
|
||||
MappedAttrTableEntry *entry = static_cast<MappedAttrTableEntry*>
|
||||
(PL_DHashTableOperate(&mMappedAttrTable, aMapped, PL_DHASH_ADD));
|
||||
@ -513,7 +513,7 @@ nsHTMLStyleSheet::LangRuleFor(const nsString& aLanguage)
|
||||
{
|
||||
if (!mLangRuleTable.ops) {
|
||||
PL_DHashTableInit(&mLangRuleTable, &LangRuleTable_Ops,
|
||||
nullptr, sizeof(LangRuleTableEntry), 16);
|
||||
nullptr, sizeof(LangRuleTableEntry));
|
||||
}
|
||||
LangRuleTableEntry *entry = static_cast<LangRuleTableEntry*>
|
||||
(PL_DHashTableOperate(&mLangRuleTable, &aLanguage, PL_DHASH_ADD));
|
||||
|
@ -1511,7 +1511,7 @@ nsRuleNode::Transition(nsIStyleRule* aRule, uint8_t aLevel,
|
||||
if (curr)
|
||||
next = curr;
|
||||
else if (numKids >= kMaxChildrenInList)
|
||||
ConvertChildrenToHash();
|
||||
ConvertChildrenToHash(numKids);
|
||||
}
|
||||
|
||||
if (ChildrenAreHashed()) {
|
||||
@ -1572,13 +1572,13 @@ void nsRuleNode::SetUsedDirectly()
|
||||
}
|
||||
|
||||
void
|
||||
nsRuleNode::ConvertChildrenToHash()
|
||||
nsRuleNode::ConvertChildrenToHash(int32_t aNumKids)
|
||||
{
|
||||
NS_ASSERTION(!ChildrenAreHashed() && HaveChildren(),
|
||||
"must have a non-empty list of children");
|
||||
PLDHashTable *hash = PL_NewDHashTable(&ChildrenHashOps, nullptr,
|
||||
sizeof(ChildrenHashEntry),
|
||||
kMaxChildrenInList * 4);
|
||||
aNumKids);
|
||||
if (!hash)
|
||||
return;
|
||||
for (nsRuleNode* curr = ChildrenList(); curr; curr = curr->mNextSibling) {
|
||||
|
@ -373,7 +373,7 @@ private:
|
||||
"pointer not 2-byte aligned");
|
||||
mChildren.asHash = (PLDHashTable*)(intptr_t(aHashtable) | kHashType);
|
||||
}
|
||||
void ConvertChildrenToHash();
|
||||
void ConvertChildrenToHash(int32_t aNumKids);
|
||||
|
||||
nsCachedStyleData mStyleData; // Any data we cached on the rule node.
|
||||
|
||||
|
@ -279,7 +279,7 @@ protected:
|
||||
class nsSVGRenderingObserverList {
|
||||
public:
|
||||
nsSVGRenderingObserverList()
|
||||
: mObservers(5)
|
||||
: mObservers(4)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsSVGRenderingObserverList);
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ nsSVGFilterInstance::BuildPrimitives(nsTArray<FilterPrimitiveDescription>& aPrim
|
||||
}
|
||||
|
||||
// Maps source image name to source index.
|
||||
nsDataHashtable<nsStringHashKey, int32_t> imageTable(10);
|
||||
nsDataHashtable<nsStringHashKey, int32_t> imageTable(8);
|
||||
|
||||
// The principal that we check principals of any loaded images against.
|
||||
nsCOMPtr<nsIPrincipal> principal = mTargetFrame->GetContent()->NodePrincipal();
|
||||
|
@ -77,7 +77,7 @@ SpanningCellSorter::AddCell(int32_t aColSpan, int32_t aRow, int32_t aCol)
|
||||
} else {
|
||||
if (!mHashTable.entryCount) {
|
||||
PL_DHashTableInit(&mHashTable, &HashTableOps, nullptr,
|
||||
sizeof(HashTableEntry), PL_DHASH_MIN_SIZE);
|
||||
sizeof(HashTableEntry));
|
||||
}
|
||||
HashTableEntry *entry = static_cast<HashTableEntry*>
|
||||
(PL_DHashTableOperate(&mHashTable, NS_INT32_TO_PTR(aColSpan),
|
||||
|
@ -271,9 +271,9 @@ nsBoxObject::GetScreenX(int32_t *_retval)
|
||||
nsIntPoint position;
|
||||
nsresult rv = GetScreenPosition(position);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
*_retval = position.x;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -283,9 +283,9 @@ nsBoxObject::GetScreenY(int32_t *_retval)
|
||||
nsIntPoint position;
|
||||
nsresult rv = GetScreenPosition(position);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
*_retval = position.y;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -306,9 +306,9 @@ NS_IMETHODIMP
|
||||
nsBoxObject::SetPropertyAsSupports(const char16_t* aPropertyName, nsISupports* aValue)
|
||||
{
|
||||
NS_ENSURE_ARG(aPropertyName && *aPropertyName);
|
||||
|
||||
if (!mPropertyTable) {
|
||||
mPropertyTable = new nsInterfaceHashtable<nsStringHashKey,nsISupports>(8);
|
||||
|
||||
if (!mPropertyTable) {
|
||||
mPropertyTable = new nsInterfaceHashtable<nsStringHashKey,nsISupports>(4);
|
||||
}
|
||||
|
||||
nsDependentString propertyName(aPropertyName);
|
||||
@ -329,9 +329,9 @@ nsBoxObject::GetProperty(const char16_t* aPropertyName, char16_t** aResult)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsString> supportsStr = do_QueryInterface(data);
|
||||
if (!supportsStr)
|
||||
if (!supportsStr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
return supportsStr->ToString(aResult);
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ nsBoxObject::SetProperty(const char16_t* aPropertyName, const char16_t* aPropert
|
||||
} else {
|
||||
propertyValue.SetIsVoid(true);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsISupportsString> supportsStr(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
NS_ENSURE_TRUE(supportsStr, NS_ERROR_OUT_OF_MEMORY);
|
||||
supportsStr->SetData(propertyValue);
|
||||
|
@ -111,7 +111,7 @@ NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxFrame)
|
||||
nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
:nsLeafBoxFrame(aPresShell, aContext),
|
||||
mSlots(nullptr),
|
||||
mImageCache(16),
|
||||
mImageCache(),
|
||||
mTopRowIndex(0),
|
||||
mPageLength(0),
|
||||
mHorzPosition(0),
|
||||
|
@ -77,7 +77,7 @@ nsJARManifestItem::~nsJARManifestItem()
|
||||
|
||||
// The following initialization makes a guess of 10 entries per jarfile.
|
||||
nsJAR::nsJAR(): mZip(new nsZipArchive()),
|
||||
mManifestData(10),
|
||||
mManifestData(8),
|
||||
mParsedManifest(false),
|
||||
mGlobalStatus(JAR_MANIFEST_NOT_PARSED),
|
||||
mReleaseTime(PR_INTERVAL_NO_TIMEOUT),
|
||||
@ -1028,7 +1028,7 @@ NS_IMPL_ISUPPORTS(nsZipReaderCache, nsIZipReaderCache, nsIObserver, nsISupportsW
|
||||
|
||||
nsZipReaderCache::nsZipReaderCache()
|
||||
: mLock("nsZipReaderCache.mLock")
|
||||
, mZips(16)
|
||||
, mZips()
|
||||
, mMustCacheFd(false)
|
||||
#ifdef ZIP_CACHE_HIT_RATE
|
||||
,
|
||||
|
@ -745,7 +745,7 @@ Preferences::GetPreference(PrefSetting* aPref)
|
||||
void
|
||||
Preferences::GetPreferences(InfallibleTArray<PrefSetting>* aPrefs)
|
||||
{
|
||||
aPrefs->SetCapacity(PL_DHASH_TABLE_SIZE(&gHashTable));
|
||||
aPrefs->SetCapacity(PL_DHASH_TABLE_CAPACITY(&gHashTable));
|
||||
PL_DHashTableEnumerate(&gHashTable, pref_GetPrefs, aPrefs);
|
||||
}
|
||||
|
||||
|
@ -144,14 +144,14 @@ enum {
|
||||
};
|
||||
static nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t flags);
|
||||
|
||||
#define PREF_HASHTABLE_INITIAL_SIZE 2048
|
||||
#define PREF_HASHTABLE_INITIAL_LENGTH 1024
|
||||
|
||||
nsresult PREF_Init()
|
||||
{
|
||||
if (!gHashTable.ops) {
|
||||
if (!PL_DHashTableInit(&gHashTable, &pref_HashTableOps, nullptr,
|
||||
sizeof(PrefHashEntry), PREF_HASHTABLE_INITIAL_SIZE,
|
||||
fallible_t())) {
|
||||
sizeof(PrefHashEntry), fallible_t(),
|
||||
PREF_HASHTABLE_INITIAL_LENGTH)) {
|
||||
gHashTable.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ namespace net {
|
||||
NS_IMPL_ISUPPORTS(RedirectChannelRegistrar, nsIRedirectChannelRegistrar)
|
||||
|
||||
RedirectChannelRegistrar::RedirectChannelRegistrar()
|
||||
: mRealChannels(64)
|
||||
, mParentChannels(64)
|
||||
: mRealChannels(32)
|
||||
, mParentChannels(32)
|
||||
, mId(1)
|
||||
{
|
||||
}
|
||||
|
@ -1171,7 +1171,7 @@ nsresult nsLoadGroup::Init()
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&mRequests, &hash_table_ops, nullptr,
|
||||
sizeof(RequestMapEntry), 16);
|
||||
sizeof(RequestMapEntry));
|
||||
|
||||
mConnectionInfo = new nsLoadGroupConnectionInfo();
|
||||
|
||||
|
2
netwerk/cache/nsCacheEntry.cpp
vendored
2
netwerk/cache/nsCacheEntry.cpp
vendored
@ -408,7 +408,7 @@ nsCacheEntryHashTable::Init()
|
||||
nsresult rv = NS_OK;
|
||||
initialized = PL_DHashTableInit(&table, &ops, nullptr,
|
||||
sizeof(nsCacheEntryHashTableEntry),
|
||||
512, fallible_t());
|
||||
fallible_t(), 256);
|
||||
|
||||
if (!initialized) rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
4
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
4
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
@ -893,8 +893,8 @@ nsOfflineCacheDevice::nsOfflineCacheDevice()
|
||||
, mDeltaCounter(0)
|
||||
, mAutoShutdown(false)
|
||||
, mLock("nsOfflineCacheDevice.lock")
|
||||
, mActiveCaches(5)
|
||||
, mLockedEntries(64)
|
||||
, mActiveCaches(4)
|
||||
, mLockedEntries(32)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,6 @@ nsDomainEntry::FuncForStaticAsserts(void)
|
||||
static nsEffectiveTLDService *gService = nullptr;
|
||||
|
||||
nsEffectiveTLDService::nsEffectiveTLDService()
|
||||
// We'll probably have to rehash at least once, since nsTHashtable doesn't
|
||||
// use a perfect hash, but at least we'll save a few rehashes along the way.
|
||||
// Next optimization here is to precompute the hash using something like
|
||||
// gperf, but one step at a time. :-)
|
||||
: mHash(ArrayLength(nsDomainEntry::entries))
|
||||
{
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf,
|
||||
// even though we are parsing the actual text stream because
|
||||
// it is legit to append headers.
|
||||
nsClassHashtable<nsCStringHashKey, nsCString>
|
||||
hdrHash(1 + (mTransaction->RequestHead()->Headers().Count() * 2));
|
||||
hdrHash(mTransaction->RequestHead()->Headers().Count());
|
||||
|
||||
const char *beginBuffer = mFlatHttpRequestHeaders.BeginReading();
|
||||
|
||||
|
@ -406,7 +406,7 @@ SpdyStream31::ParseHttpRequestHeaders(const char *buf,
|
||||
// even though we are parsing the actual text stream because
|
||||
// it is legit to append headers.
|
||||
nsClassHashtable<nsCStringHashKey, nsCString>
|
||||
hdrHash(1 + (mTransaction->RequestHead()->Headers().Count() * 2));
|
||||
hdrHash(mTransaction->RequestHead()->Headers().Count());
|
||||
|
||||
const char *beginBuffer = mFlatHttpRequestHeaders.BeginReading();
|
||||
|
||||
|
@ -105,12 +105,12 @@ nsHttp::CreateAtomTable()
|
||||
sLock = new Mutex("nsHttp.sLock");
|
||||
}
|
||||
|
||||
// The capacity for this table is initialized to a value greater than the
|
||||
// number of known atoms (NUM_HTTP_ATOMS) because we expect to encounter a
|
||||
// few random headers right off the bat.
|
||||
// The initial length for this table is a value greater than the number of
|
||||
// known atoms (NUM_HTTP_ATOMS) because we expect to encounter a few random
|
||||
// headers right off the bat.
|
||||
if (!PL_DHashTableInit(&sAtomTable, &ops, nullptr,
|
||||
sizeof(PLDHashEntryStub),
|
||||
NUM_HTTP_ATOMS + 10, fallible_t())) {
|
||||
fallible_t(), NUM_HTTP_ATOMS + 10)) {
|
||||
sAtomTable.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ nsResURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
nsResProtocolHandler::nsResProtocolHandler()
|
||||
: mSubstitutions(32)
|
||||
: mSubstitutions(16)
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
gResLog = PR_NewLogModule("nsResProtocol");
|
||||
|
@ -33,7 +33,7 @@
|
||||
using namespace mozilla;
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHtml5TreeOpExecutor)
|
||||
NS_INTERFACE_TABLE_INHERITED(nsHtml5TreeOpExecutor,
|
||||
NS_INTERFACE_TABLE_INHERITED(nsHtml5TreeOpExecutor,
|
||||
nsIContentSink)
|
||||
NS_INTERFACE_TABLE_TAIL_INHERITING(nsHtml5DocumentBuilder)
|
||||
|
||||
|
@ -86,20 +86,18 @@ static const EntityNode gEntityArray[] = {
|
||||
#define NS_HTML_ENTITY_COUNT ((int32_t)ArrayLength(gEntityArray))
|
||||
|
||||
nsresult
|
||||
nsHTMLEntities::AddRefTable(void)
|
||||
nsHTMLEntities::AddRefTable(void)
|
||||
{
|
||||
if (!gTableRefCnt) {
|
||||
if (!PL_DHashTableInit(&gEntityToUnicode, &EntityToUnicodeOps,
|
||||
nullptr, sizeof(EntityNodeEntry),
|
||||
uint32_t(NS_HTML_ENTITY_COUNT / 0.75),
|
||||
fallible_t())) {
|
||||
fallible_t(), NS_HTML_ENTITY_COUNT)) {
|
||||
gEntityToUnicode.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&gUnicodeToEntity, &UnicodeToEntityOps,
|
||||
nullptr, sizeof(EntityNodeEntry),
|
||||
uint32_t(NS_HTML_ENTITY_COUNT / 0.75),
|
||||
fallible_t())) {
|
||||
fallible_t(), NS_HTML_ENTITY_COUNT)) {
|
||||
PL_DHashTableFinish(&gEntityToUnicode);
|
||||
gEntityToUnicode.ops = gUnicodeToEntity.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -163,8 +163,8 @@ Assertion::Assertion(nsIRDFResource* aSource)
|
||||
|
||||
NS_ADDREF(mSource);
|
||||
|
||||
u.hash.mPropertyHash = PL_NewDHashTable(PL_DHashGetStubOps(),
|
||||
nullptr, sizeof(Entry), PL_DHASH_MIN_SIZE);
|
||||
u.hash.mPropertyHash =
|
||||
PL_NewDHashTable(PL_DHashGetStubOps(), nullptr, sizeof(Entry));
|
||||
}
|
||||
|
||||
Assertion::Assertion(nsIRDFResource* aSource,
|
||||
@ -785,14 +785,12 @@ InMemoryDataSource::Init()
|
||||
PL_DHashTableInit(&mForwardArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry),
|
||||
PL_DHASH_MIN_SIZE);
|
||||
sizeof(Entry));
|
||||
|
||||
PL_DHashTableInit(&mReverseArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry),
|
||||
PL_DHASH_MIN_SIZE);
|
||||
sizeof(Entry));
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (! gLog)
|
||||
|
@ -761,19 +761,19 @@ RDFServiceImpl::Init()
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PL_DHashTableInit(&mResources, &gResourceTableOps, nullptr,
|
||||
sizeof(ResourceHashEntry), PL_DHASH_MIN_SIZE);
|
||||
sizeof(ResourceHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mLiterals, &gLiteralTableOps, nullptr,
|
||||
sizeof(LiteralHashEntry), PL_DHASH_MIN_SIZE);
|
||||
sizeof(LiteralHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mInts, &gIntTableOps, nullptr,
|
||||
sizeof(IntHashEntry), PL_DHASH_MIN_SIZE);
|
||||
sizeof(IntHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mDates, &gDateTableOps, nullptr,
|
||||
sizeof(DateHashEntry), PL_DHASH_MIN_SIZE);
|
||||
sizeof(DateHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mBlobs, &gBlobTableOps, nullptr,
|
||||
sizeof(BlobHashEntry), PL_DHASH_MIN_SIZE);
|
||||
sizeof(BlobHashEntry));
|
||||
|
||||
mDefaultResourceFactory = do_GetClassObject(kRDFDefaultResourceCID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory");
|
||||
|
@ -457,7 +457,7 @@ void nsSecureBrowserUIImpl::ResetStateTracking()
|
||||
mTransferringRequests.ops = nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&mTransferringRequests, &gMapOps, nullptr,
|
||||
sizeof(RequestHashEntry), 16);
|
||||
sizeof(RequestHashEntry));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -956,7 +956,7 @@ formatOverridableCertErrorMessage(nsISSLStatus & sslStatus,
|
||||
RememberCertErrorsTable::sInstance = nullptr;
|
||||
|
||||
RememberCertErrorsTable::RememberCertErrorsTable()
|
||||
: mErrorHosts(16)
|
||||
: mErrorHosts()
|
||||
, mMutex("RememberCertErrorsTable::mMutex")
|
||||
{
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ nsresult nsCertTree::InitCompareHash()
|
||||
{
|
||||
ClearCompareHash();
|
||||
if (!PL_DHashTableInit(&mCompareCache, &gMapOps, nullptr,
|
||||
sizeof(CompareCacheHashEntryPtr), 128, fallible_t())) {
|
||||
sizeof(CompareCacheHashEntryPtr), fallible_t(), 64)) {
|
||||
mCompareCache.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -1213,7 +1213,7 @@ nsSSLIOLayerHelpers::nsSSLIOLayerHelpers()
|
||||
: mRenegoUnrestrictedSites(nullptr)
|
||||
, mTreatUnsafeNegotiationAsBroken(false)
|
||||
, mWarnLevelMissingRFC5746(1)
|
||||
, mTLSIntoleranceInfo(16)
|
||||
, mTLSIntoleranceInfo()
|
||||
, mFalseStartRequireNPN(true)
|
||||
, mFalseStartRequireForwardSecrecy(false)
|
||||
, mutex("nsSSLIOLayerHelpers.mutex")
|
||||
@ -1518,7 +1518,7 @@ nsSSLIOLayerHelpers::Init()
|
||||
nsSSLPlaintextLayerMethods.recv = PlaintextRecv;
|
||||
}
|
||||
|
||||
mRenegoUnrestrictedSites = new nsTHashtable<nsCStringHashKey>(16);
|
||||
mRenegoUnrestrictedSites = new nsTHashtable<nsCStringHashKey>();
|
||||
|
||||
nsCString unrestricted_hosts;
|
||||
Preferences::GetCString("security.ssl.renego_unrestricted_hosts", &unrestricted_hosts);
|
||||
|
@ -52,9 +52,9 @@ nsNSSShutDownList::nsNSSShutDownList()
|
||||
mPK11LogoutCancelObjects.ops = nullptr;
|
||||
mObjects.ops = nullptr;
|
||||
PL_DHashTableInit(&mObjects, &gSetOps, nullptr,
|
||||
sizeof(ObjectHashEntry), 16);
|
||||
sizeof(ObjectHashEntry));
|
||||
PL_DHashTableInit(&mPK11LogoutCancelObjects, &gSetOps, nullptr,
|
||||
sizeof(ObjectHashEntry), 16);
|
||||
sizeof(ObjectHashEntry));
|
||||
}
|
||||
|
||||
nsNSSShutDownList::~nsNSSShutDownList()
|
||||
|
@ -38,10 +38,10 @@
|
||||
#include "jsapi.h"
|
||||
|
||||
// Initial size for the cache holding visited status observers.
|
||||
#define VISIT_OBSERVERS_INITIAL_CACHE_SIZE 128
|
||||
#define VISIT_OBSERVERS_INITIAL_CACHE_LENGTH 64
|
||||
|
||||
// Initial size for the visits removal hash.
|
||||
#define VISITS_REMOVAL_INITIAL_HASH_SIZE 128
|
||||
// Initial length for the visits removal hash.
|
||||
#define VISITS_REMOVAL_INITIAL_HASH_LENGTH 64
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
@ -1586,7 +1586,7 @@ class NotifyRemoveVisits : public nsRunnable
|
||||
public:
|
||||
|
||||
NotifyRemoveVisits(nsTHashtable<PlaceHashKey>& aPlaces)
|
||||
: mPlaces(VISITS_REMOVAL_INITIAL_HASH_SIZE)
|
||||
: mPlaces(VISITS_REMOVAL_INITIAL_HASH_LENGTH)
|
||||
, mHistory(History::GetService())
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread(),
|
||||
@ -1693,7 +1693,7 @@ public:
|
||||
|
||||
// Find all the visits relative to the current filters and whether their
|
||||
// pages will be removed or not.
|
||||
nsTHashtable<PlaceHashKey> places(VISITS_REMOVAL_INITIAL_HASH_SIZE);
|
||||
nsTHashtable<PlaceHashKey> places(VISITS_REMOVAL_INITIAL_HASH_LENGTH);
|
||||
nsresult rv = FindRemovableVisits(places);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1925,7 +1925,7 @@ History* History::gService = nullptr;
|
||||
History::History()
|
||||
: mShuttingDown(false)
|
||||
, mShutdownMutex("History::mShutdownMutex")
|
||||
, mObservers(VISIT_OBSERVERS_INITIAL_CACHE_SIZE)
|
||||
, mObservers(VISIT_OBSERVERS_INITIAL_CACHE_LENGTH)
|
||||
, mRecentlyVisitedURIsNextIndex(0)
|
||||
{
|
||||
NS_ASSERTION(!gService, "Ruh-roh! This service has already been created!");
|
||||
|
@ -35,10 +35,10 @@
|
||||
// Default value for mOptimizedIconDimension
|
||||
#define OPTIMIZED_FAVICON_DIMENSION 16
|
||||
|
||||
#define MAX_FAVICON_CACHE_SIZE 256
|
||||
#define MAX_FAILED_FAVICONS 256
|
||||
#define FAVICON_CACHE_REDUCE_COUNT 64
|
||||
|
||||
#define MAX_UNASSOCIATED_FAVICONS 64
|
||||
#define UNASSOCIATED_FAVICONS_LENGTH 32
|
||||
|
||||
// When replaceFaviconData is called, we store the icons in an in-memory cache
|
||||
// instead of in storage. Icons in the cache are expired according to this
|
||||
@ -77,8 +77,8 @@ NS_IMPL_ISUPPORTS_CI(
|
||||
nsFaviconService::nsFaviconService()
|
||||
: mOptimizedIconDimension(OPTIMIZED_FAVICON_DIMENSION)
|
||||
, mFailedFaviconSerial(0)
|
||||
, mFailedFavicons(MAX_FAVICON_CACHE_SIZE)
|
||||
, mUnassociatedIcons(MAX_UNASSOCIATED_FAVICONS)
|
||||
, mFailedFavicons(MAX_FAILED_FAVICONS / 2)
|
||||
, mUnassociatedIcons(UNASSOCIATED_FAVICONS_LENGTH)
|
||||
{
|
||||
NS_ASSERTION(!gFaviconService,
|
||||
"Attempting to create two instances of the service!");
|
||||
@ -435,11 +435,11 @@ nsFaviconService::AddFailedFavicon(nsIURI* aFaviconURI)
|
||||
mFailedFavicons.Put(spec, mFailedFaviconSerial);
|
||||
mFailedFaviconSerial ++;
|
||||
|
||||
if (mFailedFavicons.Count() > MAX_FAVICON_CACHE_SIZE) {
|
||||
if (mFailedFavicons.Count() > MAX_FAILED_FAVICONS) {
|
||||
// need to expire some entries, delete the FAVICON_CACHE_REDUCE_COUNT number
|
||||
// of items that are the oldest
|
||||
uint32_t threshold = mFailedFaviconSerial -
|
||||
MAX_FAVICON_CACHE_SIZE + FAVICON_CACHE_REDUCE_COUNT;
|
||||
MAX_FAILED_FAVICONS + FAVICON_CACHE_REDUCE_COUNT;
|
||||
mFailedFavicons.Enumerate(ExpireFailedFaviconsCallback, &threshold);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
#define BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_SIZE 64
|
||||
#define RECENT_BOOKMARKS_INITIAL_CACHE_SIZE 10
|
||||
// Threashold to expire old bookmarks if the initial cache size is exceeded.
|
||||
#define BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_LENGTH 32
|
||||
#define RECENT_BOOKMARKS_INITIAL_CACHE_LENGTH 10
|
||||
// Threshold to expire old bookmarks if the initial cache size is exceeded.
|
||||
#define RECENT_BOOKMARKS_THRESHOLD PRTime((int64_t)1 * 60 * PR_USEC_PER_SEC)
|
||||
|
||||
#define BEGIN_CRITICAL_BOOKMARK_CACHE_SECTION(_itemId_) \
|
||||
@ -169,7 +169,7 @@ ExpireNonrecentBookmarksCallback(BookmarkKeyClass* aKey,
|
||||
static void
|
||||
ExpireNonrecentBookmarks(nsTHashtable<BookmarkKeyClass>* hashTable)
|
||||
{
|
||||
if (hashTable->Count() > RECENT_BOOKMARKS_INITIAL_CACHE_SIZE) {
|
||||
if (hashTable->Count() > RECENT_BOOKMARKS_INITIAL_CACHE_LENGTH) {
|
||||
int64_t threshold = PR_Now() - RECENT_BOOKMARKS_THRESHOLD;
|
||||
(void)hashTable->EnumerateEntries(ExpireNonrecentBookmarksCallback,
|
||||
reinterpret_cast<void*>(&threshold));
|
||||
@ -208,10 +208,10 @@ nsNavBookmarks::nsNavBookmarks()
|
||||
, mCanNotify(false)
|
||||
, mCacheObservers("bookmark-observers")
|
||||
, mBatching(false)
|
||||
, mBookmarkToKeywordHash(BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_SIZE)
|
||||
, mBookmarkToKeywordHash(BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_LENGTH)
|
||||
, mBookmarkToKeywordHashInitialized(false)
|
||||
, mRecentBookmarksCache(RECENT_BOOKMARKS_INITIAL_CACHE_SIZE)
|
||||
, mUncachableBookmarks(RECENT_BOOKMARKS_INITIAL_CACHE_SIZE)
|
||||
, mRecentBookmarksCache(RECENT_BOOKMARKS_INITIAL_CACHE_LENGTH)
|
||||
, mUncachableBookmarks(RECENT_BOOKMARKS_INITIAL_CACHE_LENGTH)
|
||||
{
|
||||
NS_ASSERTION(!gBookmarksService,
|
||||
"Attempting to create two instances of the service!");
|
||||
|
@ -114,13 +114,13 @@ using namespace mozilla::places;
|
||||
(HISTORY_ADDITIONAL_DATE_CONT_NUM + \
|
||||
std::min(6, (int32_t)ceilf((float)_daysFromOldestVisit/30)))
|
||||
// Max number of containers, used to initialize the params hash.
|
||||
#define HISTORY_DATE_CONT_MAX 10
|
||||
#define HISTORY_DATE_CONT_LENGTH 8
|
||||
|
||||
// Initial size of the embed visits cache.
|
||||
#define EMBED_VISITS_INITIAL_CACHE_SIZE 128
|
||||
// Initial length of the embed visits cache.
|
||||
#define EMBED_VISITS_INITIAL_CACHE_LENGTH 64
|
||||
|
||||
// Initial size of the recent events caches.
|
||||
#define RECENT_EVENTS_INITIAL_CACHE_SIZE 128
|
||||
// Initial length of the recent events cache.
|
||||
#define RECENT_EVENTS_INITIAL_CACHE_LENGTH 64
|
||||
|
||||
// Observed topics.
|
||||
#ifdef MOZ_XUL
|
||||
@ -255,10 +255,10 @@ nsNavHistory::nsNavHistory()
|
||||
: mBatchLevel(0)
|
||||
, mBatchDBTransaction(nullptr)
|
||||
, mCachedNow(0)
|
||||
, mRecentTyped(RECENT_EVENTS_INITIAL_CACHE_SIZE)
|
||||
, mRecentLink(RECENT_EVENTS_INITIAL_CACHE_SIZE)
|
||||
, mRecentBookmark(RECENT_EVENTS_INITIAL_CACHE_SIZE)
|
||||
, mEmbedVisits(EMBED_VISITS_INITIAL_CACHE_SIZE)
|
||||
, mRecentTyped(RECENT_EVENTS_INITIAL_CACHE_LENGTH)
|
||||
, mRecentLink(RECENT_EVENTS_INITIAL_CACHE_LENGTH)
|
||||
, mRecentBookmark(RECENT_EVENTS_INITIAL_CACHE_LENGTH)
|
||||
, mEmbedVisits(EMBED_VISITS_INITIAL_CACHE_LENGTH)
|
||||
, mHistoryEnabled(true)
|
||||
, mNumVisitsForFrecency(10)
|
||||
, mTagsFolder(-1)
|
||||
@ -2190,8 +2190,8 @@ nsNavHistory::GetQueryResults(nsNavHistoryQueryResultNode *aResultNode,
|
||||
|
||||
nsCString queryString;
|
||||
bool paramsPresent = false;
|
||||
nsNavHistory::StringHash addParams(HISTORY_DATE_CONT_MAX);
|
||||
nsresult rv = ConstructQueryString(aQueries, aOptions, queryString,
|
||||
nsNavHistory::StringHash addParams(HISTORY_DATE_CONT_LENGTH);
|
||||
nsresult rv = ConstructQueryString(aQueries, aOptions, queryString,
|
||||
paramsPresent, addParams);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
@ -2967,7 +2967,7 @@ nsNavHistory::AsyncExecuteLegacyQueries(nsINavHistoryQuery** aQueries,
|
||||
|
||||
nsCString queryString;
|
||||
bool paramsPresent = false;
|
||||
nsNavHistory::StringHash addParams(HISTORY_DATE_CONT_MAX);
|
||||
nsNavHistory::StringHash addParams(HISTORY_DATE_CONT_LENGTH);
|
||||
nsresult rv = ConstructQueryString(queries, options, queryString,
|
||||
paramsPresent, addParams);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
@ -4019,7 +4019,7 @@ nsNavHistoryResult::nsNavHistoryResult(nsNavHistoryContainerResultNode* aRoot)
|
||||
, mIsHistoryObserver(false)
|
||||
, mIsBookmarkFolderObserver(false)
|
||||
, mIsAllBookmarksObserver(false)
|
||||
, mBookmarkFolderObservers(128)
|
||||
, mBookmarkFolderObservers(64)
|
||||
, mBatchInProgress(false)
|
||||
, mSuppressNotifications(false)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ template<class EntryType>
|
||||
class AutoHashtable : public nsTHashtable<EntryType>
|
||||
{
|
||||
public:
|
||||
AutoHashtable(uint32_t initSize = PL_DHASH_MIN_SIZE);
|
||||
AutoHashtable(uint32_t initLength = PL_DHASH_DEFAULT_INITIAL_LENGTH);
|
||||
typedef bool (*ReflectEntryFunc)(EntryType *entry, JSContext *cx, JS::Handle<JSObject*> obj);
|
||||
bool ReflectIntoJS(ReflectEntryFunc entryFunc, JSContext *cx, JS::Handle<JSObject*> obj);
|
||||
private:
|
||||
@ -90,8 +90,8 @@ private:
|
||||
};
|
||||
|
||||
template<class EntryType>
|
||||
AutoHashtable<EntryType>::AutoHashtable(uint32_t initSize)
|
||||
: nsTHashtable<EntryType>(initSize)
|
||||
AutoHashtable<EntryType>::AutoHashtable(uint32_t initLength)
|
||||
: nsTHashtable<EntryType>(initLength)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
NS_DECL_NSISYSTEMPROXYSETTINGS
|
||||
|
||||
nsUnixSystemProxySettings()
|
||||
: mSchemeProxySettings(5)
|
||||
: mSchemeProxySettings(4)
|
||||
{
|
||||
}
|
||||
nsresult Init();
|
||||
|
@ -125,7 +125,7 @@ nsDocLoader::nsDocLoader()
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&mRequestInfoHash, &hash_table_ops, nullptr,
|
||||
sizeof(nsRequestInfo), 16);
|
||||
sizeof(nsRequestInfo));
|
||||
|
||||
ClearInternalProgress();
|
||||
|
||||
|
@ -472,7 +472,7 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime,
|
||||
: mGCThingCycleCollectorGlobal(sGCThingCycleCollectorGlobal)
|
||||
, mJSZoneCycleCollectorGlobal(sJSZoneCycleCollectorGlobal)
|
||||
, mJSRuntime(nullptr)
|
||||
, mJSHolders(512)
|
||||
, mJSHolders(256)
|
||||
, mOutOfMemoryState(OOMState::OK)
|
||||
, mLargeAllocationFailureState(OOMState::OK)
|
||||
{
|
||||
|
@ -855,7 +855,7 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(IsEmpty(), "Failed to call CCGraph::Clear");
|
||||
PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps, nullptr,
|
||||
sizeof(PtrToNodeEntry), 32768);
|
||||
sizeof(PtrToNodeEntry), 16384);
|
||||
}
|
||||
|
||||
void Clear()
|
||||
|
@ -214,10 +214,7 @@ static const PLHashAllocOps typesToLogHashAllocOps = {
|
||||
class CodeAddressServiceStringTable MOZ_FINAL
|
||||
{
|
||||
public:
|
||||
CodeAddressServiceStringTable()
|
||||
: mSet(64)
|
||||
{
|
||||
}
|
||||
CodeAddressServiceStringTable() : mSet(32) {}
|
||||
|
||||
const char* Intern(const char* aString)
|
||||
{
|
||||
|
@ -306,11 +306,11 @@ nsComponentManagerImpl::Create(nsISupports* aOuter, REFNSIID aIID,
|
||||
return gComponentManager->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static const int CONTRACTID_HASHTABLE_INITIAL_SIZE = 2048;
|
||||
static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 1024;
|
||||
|
||||
nsComponentManagerImpl::nsComponentManagerImpl()
|
||||
: mFactories(CONTRACTID_HASHTABLE_INITIAL_SIZE)
|
||||
, mContractIDs(CONTRACTID_HASHTABLE_INITIAL_SIZE)
|
||||
: mFactories(CONTRACTID_HASHTABLE_INITIAL_LENGTH)
|
||||
, mContractIDs(CONTRACTID_HASHTABLE_INITIAL_LENGTH)
|
||||
, mLock("nsComponentManagerImpl.mLock")
|
||||
, mStatus(NOT_INITIALIZED)
|
||||
{
|
||||
|
@ -538,14 +538,14 @@ NS_SizeOfAtomTablesIncludingThis(MallocSizeOf aMallocSizeOf,
|
||||
: 0;
|
||||
}
|
||||
|
||||
#define ATOM_HASHTABLE_INITIAL_SIZE 4096
|
||||
#define ATOM_HASHTABLE_INITIAL_LENGTH 2048
|
||||
|
||||
static inline void
|
||||
EnsureTableExists()
|
||||
{
|
||||
if (!gAtomTable.ops) {
|
||||
PL_DHashTableInit(&gAtomTable, &AtomTableOps, 0,
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_SIZE);
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ nsPersistentProperties::nsPersistentProperties()
|
||||
mSubclass = static_cast<nsIPersistentProperties*>(this);
|
||||
|
||||
PL_DHashTableInit(&mTable, &property_HashTableOps, nullptr,
|
||||
sizeof(PropertyTableEntry), 20);
|
||||
sizeof(PropertyTableEntry), 16);
|
||||
|
||||
PL_INIT_ARENA_POOL(&mArena, "PersistentPropertyArena", 2048);
|
||||
}
|
||||
|
@ -129,27 +129,27 @@ nsStaticCaseInsensitiveNameTable::~nsStaticCaseInsensitiveNameTable()
|
||||
|
||||
bool
|
||||
nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[],
|
||||
int32_t aCount)
|
||||
int32_t aLength)
|
||||
{
|
||||
NS_ASSERTION(!mNameArray, "double Init");
|
||||
NS_ASSERTION(!mNameTable.ops, "double Init");
|
||||
NS_ASSERTION(aNames, "null name table");
|
||||
NS_ASSERTION(aCount, "0 count");
|
||||
NS_ASSERTION(aLength, "0 length");
|
||||
|
||||
mNameArray = (nsDependentCString*)
|
||||
nsMemory::Alloc(aCount * sizeof(nsDependentCString));
|
||||
nsMemory::Alloc(aLength * sizeof(nsDependentCString));
|
||||
if (!mNameArray) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!PL_DHashTableInit(&mNameTable, &nametable_CaseInsensitiveHashTableOps,
|
||||
nullptr, sizeof(NameTableEntry), aCount,
|
||||
fallible_t())) {
|
||||
nullptr, sizeof(NameTableEntry), fallible_t(),
|
||||
aLength)) {
|
||||
mNameTable.ops = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int32_t index = 0; index < aCount; ++index) {
|
||||
for (int32_t index = 0; index < aLength; ++index) {
|
||||
const char* raw = aNames[index];
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ class nsStaticCaseInsensitiveNameTable
|
||||
public:
|
||||
enum { NOT_FOUND = -1 };
|
||||
|
||||
bool Init(const char* const aNames[], int32_t aCount);
|
||||
bool Init(const char* const aNames[], int32_t aLength);
|
||||
int32_t Lookup(const nsACString& aName);
|
||||
int32_t Lookup(const nsAString& aName);
|
||||
const nsAFlatCString& GetStringValue(int32_t aIndex);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user