зеркало из https://github.com/mozilla/gecko-dev.git
Bug 734847 part 2 - treewide changes resulting from the default-infallibility of hashtables; either remove useless result checks, or use the fallible version of APIs, depending on context, r=jlebar
--HG-- extra : rebase_source : 844b008c5167e6ca39a7ba9eeec8b30672938704
This commit is contained in:
Родитель
520acef26d
Коммит
eaa4878487
|
@ -395,8 +395,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
|||
new nsDocAccessibleWrap(aDocument, rootElm, presShell);
|
||||
|
||||
// Cache the document accessible into document cache.
|
||||
if (!docAcc || !mDocAccessibleCache.Put(aDocument, docAcc))
|
||||
return nsnull;
|
||||
mDocAccessibleCache.Put(aDocument, docAcc);
|
||||
|
||||
// Initialize the document accessible.
|
||||
if (!docAcc->Init()) {
|
||||
|
|
|
@ -1369,17 +1369,11 @@ nsDocAccessible::BindToDocument(nsAccessible* aAccessible,
|
|||
return false;
|
||||
|
||||
// Put into DOM node cache.
|
||||
if (aAccessible->IsPrimaryForNode() &&
|
||||
!mNodeToAccessibleMap.Put(aAccessible->GetNode(), aAccessible))
|
||||
return false;
|
||||
if (aAccessible->IsPrimaryForNode())
|
||||
mNodeToAccessibleMap.Put(aAccessible->GetNode(), aAccessible);
|
||||
|
||||
// Put into unique ID cache.
|
||||
if (!mAccessibleCache.Put(aAccessible->UniqueID(), aAccessible)) {
|
||||
if (aAccessible->IsPrimaryForNode())
|
||||
mNodeToAccessibleMap.Remove(aAccessible->GetNode());
|
||||
|
||||
return false;
|
||||
}
|
||||
mAccessibleCache.Put(aAccessible->UniqueID(), aAccessible);
|
||||
|
||||
// Initialize the accessible.
|
||||
if (!aAccessible->Init()) {
|
||||
|
@ -1621,10 +1615,7 @@ nsDocAccessible::AddDependentIDsFor(nsAccessible* aRelProvider,
|
|||
if (!providers) {
|
||||
providers = new AttrRelProviderArray();
|
||||
if (providers) {
|
||||
if (!mDependentIDsHash.Put(id, providers)) {
|
||||
delete providers;
|
||||
providers = nsnull;
|
||||
}
|
||||
mDependentIDsHash.Put(id, providers);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -574,12 +574,11 @@ nsXULTreeAccessible::GetTreeItemAccessible(PRInt32 aRow)
|
|||
|
||||
nsRefPtr<nsAccessible> treeItem = CreateTreeItemAccessible(aRow);
|
||||
if (treeItem) {
|
||||
if (mAccessibleCache.Put(key, treeItem)) {
|
||||
if (Document()->BindToDocument(treeItem, nsnull))
|
||||
return treeItem;
|
||||
mAccessibleCache.Put(key, treeItem);
|
||||
if (Document()->BindToDocument(treeItem, nsnull))
|
||||
return treeItem;
|
||||
|
||||
mAccessibleCache.Remove(key);
|
||||
}
|
||||
mAccessibleCache.Remove(key);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
|
|
@ -732,12 +732,11 @@ nsXULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn)
|
|||
new nsXULTreeGridCellAccessibleWrap(mContent, mDoc, this, mTree,
|
||||
mTreeView, mRow, aColumn);
|
||||
if (cell) {
|
||||
if (mAccessibleCache.Put(key, cell)) {
|
||||
if (Document()->BindToDocument(cell, nsnull))
|
||||
return cell;
|
||||
mAccessibleCache.Put(key, cell);
|
||||
if (Document()->BindToDocument(cell, nsnull))
|
||||
return cell;
|
||||
|
||||
mAccessibleCache.Remove(key);
|
||||
}
|
||||
mAccessibleCache.Remove(key);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
|
|
@ -175,8 +175,7 @@ nsChromeRegistry::GetService()
|
|||
nsresult
|
||||
nsChromeRegistry::Init()
|
||||
{
|
||||
if (!mOverrideTable.Init())
|
||||
return NS_ERROR_FAILURE;
|
||||
mOverrideTable.Init();
|
||||
|
||||
// This initialization process is fairly complicated and may cause reentrant
|
||||
// getservice calls to resolve chrome URIs (especially locale files). We
|
||||
|
|
|
@ -155,9 +155,8 @@ nsChromeRegistryChrome::Init()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!mOverlayHash.Init() ||
|
||||
!mStyleHash.Init())
|
||||
return NS_ERROR_FAILURE;
|
||||
mOverlayHash.Init();
|
||||
mStyleHash.Init();
|
||||
|
||||
mSelectedLocale = NS_LITERAL_CSTRING("en-US");
|
||||
mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
|
||||
|
|
|
@ -171,7 +171,7 @@ class nsChromeRegistryChrome : public nsChromeRegistry
|
|||
OverlayListHash() { }
|
||||
~OverlayListHash() { }
|
||||
|
||||
bool Init() { return mTable.Init(); }
|
||||
void Init() { mTable.Init(); }
|
||||
void Add(nsIURI* aBase, nsIURI* aOverlay);
|
||||
void Clear() { mTable.Clear(); }
|
||||
const nsCOMArray<nsIURI>* GetArray(nsIURI* aBase);
|
||||
|
|
|
@ -117,9 +117,7 @@ nsChromeRegistryContent::RegisterPackage(const ChromePackage& aPackage)
|
|||
entry->localeBaseURI = locale;
|
||||
entry->skinBaseURI = skin;
|
||||
|
||||
nsresult rv = mPackagesHash.Put(aPackage.package, entry);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
mPackagesHash.Put(aPackage.package, entry);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -548,30 +548,14 @@ nsContentUtils::InitializeEventTable() {
|
|||
sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>;
|
||||
sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>;
|
||||
sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
|
||||
|
||||
if (!sAtomEventTable || !sStringEventTable || !sUserDefinedEvents ||
|
||||
!sAtomEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1) ||
|
||||
!sStringEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1)) {
|
||||
delete sAtomEventTable;
|
||||
sAtomEventTable = nsnull;
|
||||
delete sStringEventTable;
|
||||
sStringEventTable = nsnull;
|
||||
delete sUserDefinedEvents;
|
||||
sUserDefinedEvents = nsnull;
|
||||
return false;
|
||||
}
|
||||
sAtomEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1);
|
||||
sStringEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1);
|
||||
|
||||
// Subtract one from the length because of the trailing null
|
||||
for (PRUint32 i = 0; i < ArrayLength(eventArray) - 1; ++i) {
|
||||
if (!sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]) ||
|
||||
!sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
|
||||
eventArray[i])) {
|
||||
delete sAtomEventTable;
|
||||
sAtomEventTable = nsnull;
|
||||
delete sStringEventTable;
|
||||
sStringEventTable = nsnull;
|
||||
return false;
|
||||
}
|
||||
sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]);
|
||||
sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
|
||||
eventArray[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -594,15 +578,9 @@ nsContentUtils::InitializeTouchEventTable()
|
|||
};
|
||||
// Subtract one from the length because of the trailing null
|
||||
for (PRUint32 i = 0; i < ArrayLength(touchEventArray) - 1; ++i) {
|
||||
if (!sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]) ||
|
||||
!sStringEventTable->Put(Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
|
||||
touchEventArray[i])) {
|
||||
delete sAtomEventTable;
|
||||
sAtomEventTable = nsnull;
|
||||
delete sStringEventTable;
|
||||
sStringEventTable = nsnull;
|
||||
return;
|
||||
}
|
||||
sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]);
|
||||
sStringEventTable->Put(Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
|
||||
touchEventArray[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,8 @@ public:
|
|||
|
||||
bool Initialize()
|
||||
{
|
||||
return mTable.Init();
|
||||
mTable.Init();
|
||||
return true;
|
||||
}
|
||||
|
||||
CacheEntry* GetEntry(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
|
@ -260,14 +261,7 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
|
|||
}
|
||||
}
|
||||
|
||||
if (!mTable.Put(key, entry)) {
|
||||
// Failed, clean up the new entry.
|
||||
delete entry;
|
||||
|
||||
NS_WARNING("Failed to add entry to the CORS preflight cache!");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
mTable.Put(key, entry);
|
||||
PR_INSERT_LINK(entry, &mList);
|
||||
|
||||
return entry;
|
||||
|
|
|
@ -65,7 +65,8 @@ nsDOMAttributeMap::nsDOMAttributeMap(Element* aContent)
|
|||
bool
|
||||
nsDOMAttributeMap::Init()
|
||||
{
|
||||
return mAttributeCache.Init();
|
||||
mAttributeCache.Init();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,9 +213,8 @@ nsDOMAttributeMap::GetAttribute(nsINodeInfo* aNodeInfo, bool aNsAware)
|
|||
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
|
||||
nsRefPtr<nsDOMAttribute> newAttr =
|
||||
new nsDOMAttribute(this, ni.forget(), EmptyString(), aNsAware);
|
||||
if (newAttr && mAttributeCache.Put(attr, newAttr)) {
|
||||
node = newAttr;
|
||||
}
|
||||
mAttributeCache.Put(attr, newAttr);
|
||||
node = newAttr;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
@ -352,8 +352,7 @@ nsDOMAttributeMap::SetNamedItemInternal(nsIDOMNode *aNode,
|
|||
// Add the new attribute to the attribute map before updating
|
||||
// its value in the element. @see bug 364413.
|
||||
nsAttrKey attrkey(ni->NamespaceID(), ni->NameAtom());
|
||||
rv = mAttributeCache.Put(attrkey, attribute);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mAttributeCache.Put(attrkey, attribute);
|
||||
iAttribute->SetMap(this);
|
||||
|
||||
rv = mContent->SetAttr(ni->NamespaceID(), ni->NameAtom(),
|
||||
|
|
|
@ -726,9 +726,7 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
|
|||
|
||||
load = new PendingLoad(aDisplayDocument);
|
||||
|
||||
if (!mPendingLoads.Put(clone, load)) {
|
||||
return nsnull;
|
||||
}
|
||||
mPendingLoads.Put(clone, load);
|
||||
|
||||
if (NS_FAILED(load->StartLoad(clone, aRequestingNode))) {
|
||||
// Make sure we don't thrash things by trying this load again, since
|
||||
|
@ -920,22 +918,14 @@ nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
|
|||
}
|
||||
|
||||
ExternalResource* newResource = new ExternalResource();
|
||||
if (newResource && !mMap.Put(aURI, newResource)) {
|
||||
delete newResource;
|
||||
newResource = nsnull;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mMap.Put(aURI, newResource);
|
||||
|
||||
if (newResource) {
|
||||
newResource->mDocument = doc;
|
||||
newResource->mViewer = aViewer;
|
||||
newResource->mLoadGroup = aLoadGroup;
|
||||
if (doc) {
|
||||
TransferZoomLevels(aDisplayDocument, doc);
|
||||
TransferShowingState(aDisplayDocument, doc);
|
||||
}
|
||||
newResource->mDocument = doc;
|
||||
newResource->mViewer = aViewer;
|
||||
newResource->mLoadGroup = aLoadGroup;
|
||||
if (doc) {
|
||||
TransferZoomLevels(aDisplayDocument, doc);
|
||||
TransferShowingState(aDisplayDocument, doc);
|
||||
}
|
||||
|
||||
const nsTArray< nsCOMPtr<nsIObserver> > & obs = load->Observers();
|
||||
|
@ -2000,7 +1990,7 @@ nsDocument::Init()
|
|||
}
|
||||
|
||||
mIdentifierMap.Init();
|
||||
(void)mStyledLinks.Init();
|
||||
mStyledLinks.Init();
|
||||
mRadioGroups.Init();
|
||||
|
||||
// Force initialization.
|
||||
|
@ -2041,10 +2031,8 @@ nsDocument::Init()
|
|||
mScriptLoader = new nsScriptLoader(this);
|
||||
NS_ENSURE_TRUE(mScriptLoader, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (!mImageTracker.Init() ||
|
||||
!mPlugins.Init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mImageTracker.Init();
|
||||
mPlugins.Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5355,9 +5343,7 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
|||
|
||||
if (!mBoxObjectTable) {
|
||||
mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>;
|
||||
if (mBoxObjectTable && !mBoxObjectTable->Init(12)) {
|
||||
mBoxObjectTable = nsnull;
|
||||
}
|
||||
mBoxObjectTable->Init(12);
|
||||
} else {
|
||||
// Want to use Get(content, aResult); but it's the wrong type
|
||||
*aResult = mBoxObjectTable->GetWeak(content);
|
||||
|
@ -6502,7 +6488,7 @@ nsDocument::GetRadioGroup(const nsAString& aName)
|
|||
}
|
||||
|
||||
nsAutoPtr<nsRadioGroupStruct> newRadioGroup(new nsRadioGroupStruct());
|
||||
NS_ENSURE_TRUE(mRadioGroups.Put(tmKey, newRadioGroup), nsnull);
|
||||
mRadioGroups.Put(tmKey, newRadioGroup);
|
||||
|
||||
return newRadioGroup.forget();
|
||||
}
|
||||
|
@ -8285,9 +8271,7 @@ nsDocument::AddImage(imgIRequest* aImage)
|
|||
mImageTracker.Get(aImage, &oldCount);
|
||||
|
||||
// Put the image in the hashtable, with the proper count.
|
||||
bool success = mImageTracker.Put(aImage, oldCount + 1);
|
||||
if (!success)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mImageTracker.Put(aImage, oldCount + 1);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
|
|
@ -140,9 +140,9 @@ NS_IMPL_ISUPPORTS1(NameSpaceManagerImpl, nsINameSpaceManager)
|
|||
|
||||
nsresult NameSpaceManagerImpl::Init()
|
||||
{
|
||||
nsresult rv = mURIToIDTable.Init(32);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mURIToIDTable.Init(32);
|
||||
|
||||
nsresult rv;
|
||||
#define REGISTER_NAMESPACE(uri, id) \
|
||||
rv = AddNameSpace(NS_LITERAL_STRING(uri), id); \
|
||||
NS_ENSURE_SUCCESS(rv, rv)
|
||||
|
@ -288,11 +288,7 @@ nsresult NameSpaceManagerImpl::AddNameSpace(const nsAString& aURI,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!mURIToIDTable.Put(uri, aNameSpaceID)) {
|
||||
mURIArray.RemoveElementAt(aNameSpaceID - 1);
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mURIToIDTable.Put(uri, aNameSpaceID);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@ nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData)
|
|||
// Make sure this event isn't already being dispatched.
|
||||
NS_ENSURE_STATE(!(NS_IS_EVENT_IN_DISPATCH(mEvent)));
|
||||
NS_ENSURE_STATE(mData.IsInitialized());
|
||||
return mData.Put(aKey, aData) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
mData.Put(aKey, aData);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -289,12 +289,9 @@ nsHTMLFormElement::Init()
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mSelectedRadioButtons.Init(4),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mRequiredRadioButtonCounts.Init(4),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mValueMissingRadioGroups.Init(4),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mSelectedRadioButtons.Init(4);
|
||||
mRequiredRadioButtonCounts.Init(4);
|
||||
mValueMissingRadioGroups.Init(4);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1894,8 +1891,7 @@ NS_IMETHODIMP
|
|||
nsHTMLFormElement::SetCurrentRadioButton(const nsAString& aName,
|
||||
nsIDOMHTMLInputElement* aRadio)
|
||||
{
|
||||
NS_ENSURE_TRUE(mSelectedRadioButtons.Put(aName, aRadio),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mSelectedRadioButtons.Put(aName, aRadio);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2144,10 +2140,7 @@ nsFormControlList::~nsFormControlList()
|
|||
|
||||
nsresult nsFormControlList::Init()
|
||||
{
|
||||
NS_ENSURE_TRUE(
|
||||
mNameLookupTable.Init(NS_FORM_CONTROL_LIST_HASHTABLE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mNameLookupTable.Init(NS_FORM_CONTROL_LIST_HASHTABLE_SIZE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2310,9 +2303,7 @@ nsFormControlList::AddElementToTable(nsGenericHTMLFormElement* aChild,
|
|||
|
||||
if (!supports) {
|
||||
// No entry found, add the form control
|
||||
NS_ENSURE_TRUE(mNameLookupTable.Put(aName,
|
||||
NS_ISUPPORTS_CAST(nsIContent*, aChild)),
|
||||
NS_ERROR_FAILURE);
|
||||
mNameLookupTable.Put(aName, NS_ISUPPORTS_CAST(nsIContent*, aChild));
|
||||
} else {
|
||||
// Found something in the hash, check its type
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(supports);
|
||||
|
@ -2345,8 +2336,7 @@ nsFormControlList::AddElementToTable(nsGenericHTMLFormElement* aChild,
|
|||
nsCOMPtr<nsISupports> listSupports = do_QueryObject(list);
|
||||
|
||||
// Replace the element with the list.
|
||||
NS_ENSURE_TRUE(mNameLookupTable.Put(aName, listSupports),
|
||||
NS_ERROR_FAILURE);
|
||||
mNameLookupTable.Put(aName, listSupports);
|
||||
} else {
|
||||
// There's already a list in the hash, add the child to the list
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList = do_QueryInterface(supports);
|
||||
|
@ -2455,7 +2445,7 @@ nsFormControlList::RemoveElementFromTable(nsGenericHTMLFormElement* aChild,
|
|||
// single element.
|
||||
nsIContent* node = list->GetNodeAt(0);
|
||||
if (node) {
|
||||
NS_ENSURE_TRUE(mNameLookupTable.Put(aName, node),NS_ERROR_FAILURE);
|
||||
mNameLookupTable.Put(aName, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1263,12 +1263,7 @@ bool nsSkeletonState::DecodeHeader(ogg_packet* aPacket)
|
|||
LOG(PR_LOG_DEBUG, ("Skeleton segment length: %lld", mLength));
|
||||
|
||||
// Initialize the serianlno-to-index map.
|
||||
bool init = mIndex.Init();
|
||||
if (!init) {
|
||||
NS_WARNING("Failed to initialize Ogg skeleton serialno-to-index map");
|
||||
mActive = false;
|
||||
return mDoneReadingHeaders = true;
|
||||
}
|
||||
mIndex.Init();
|
||||
mActive = true;
|
||||
} else if (IsSkeletonIndex(aPacket) && mVersion >= SKELETON_VERSION(4,0)) {
|
||||
if (!DecodeIndex(aPacket)) {
|
||||
|
|
|
@ -126,11 +126,7 @@ nsOggReader::~nsOggReader()
|
|||
}
|
||||
|
||||
nsresult nsOggReader::Init(nsBuiltinDecoderReader* aCloneDonor) {
|
||||
bool init = mCodecStates.Init();
|
||||
NS_ASSERTION(init, "Failed to initialize mCodecStates");
|
||||
if (!init) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mCodecStates.Init();
|
||||
int ret = ogg_sync_init(&mOggState);
|
||||
NS_ENSURE_TRUE(ret == 0, NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
|
@ -205,8 +201,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
|||
// an nsOggCodecState to demux it, and map that to the nsOggCodecState
|
||||
// in mCodecStates.
|
||||
codecState = nsOggCodecState::Create(&page);
|
||||
DebugOnly<bool> r = mCodecStates.Put(serial, codecState);
|
||||
NS_ASSERTION(r, "Failed to insert into mCodecStates");
|
||||
mCodecStates.Put(serial, codecState);
|
||||
bitstreams.AppendElement(codecState);
|
||||
mKnownStreams.AppendElement(serial);
|
||||
if (codecState &&
|
||||
|
|
|
@ -104,11 +104,7 @@ nsSVGAttrTearoffTable<SimpleType, TearoffType>::AddTearoff(SimpleType* aSimple,
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool result =
|
||||
#endif
|
||||
mTable.Put(aSimple, aTearoff);
|
||||
NS_ABORT_IF_FALSE(result, "Out of memory.");
|
||||
mTable.Put(aSimple, aTearoff);
|
||||
}
|
||||
|
||||
template<class SimpleType, class TearoffType>
|
||||
|
|
|
@ -554,8 +554,7 @@ nsresult
|
|||
nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
|
||||
{
|
||||
if (!mBindingTable.IsInitialized()) {
|
||||
if (!mBindingTable.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mBindingTable.Init();
|
||||
}
|
||||
|
||||
// After this point, aBinding will be the most-derived binding for aContent.
|
||||
|
@ -584,11 +583,9 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
|
|||
}
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
|
||||
if (aBinding) {
|
||||
aContent->SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
|
||||
result = mBindingTable.Put(aContent, aBinding);
|
||||
mBindingTable.Put(aContent, aBinding);
|
||||
} else {
|
||||
mBindingTable.Remove(aContent);
|
||||
|
||||
|
@ -603,7 +600,7 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
|
|||
}
|
||||
}
|
||||
|
||||
return result ? NS_OK : NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
|
@ -1101,12 +1098,11 @@ nsBindingManager::PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
|
|||
{
|
||||
NS_PRECONDITION(aDocumentInfo, "Must have a non-null documentinfo!");
|
||||
|
||||
NS_ENSURE_TRUE(mDocumentTable.IsInitialized() || mDocumentTable.Init(16),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!mDocumentTable.IsInitialized())
|
||||
mDocumentTable.Init(16);
|
||||
|
||||
NS_ENSURE_TRUE(mDocumentTable.Put(aDocumentInfo->DocumentURI(),
|
||||
aDocumentInfo),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mDocumentTable.Put(aDocumentInfo->DocumentURI(),
|
||||
aDocumentInfo);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1133,11 +1129,10 @@ nsBindingManager::PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListen
|
|||
{
|
||||
NS_PRECONDITION(aListener, "Must have a non-null listener!");
|
||||
|
||||
NS_ENSURE_TRUE(mLoadingDocTable.IsInitialized() || mLoadingDocTable.Init(16),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!mLoadingDocTable.IsInitialized())
|
||||
mLoadingDocTable.Init(16);
|
||||
|
||||
NS_ENSURE_TRUE(mLoadingDocTable.Put(aURL, aListener),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mLoadingDocTable.Put(aURL, aListener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1355,8 +1350,9 @@ EnumRuleProcessors(nsISupports *aKey, nsXBLBinding *aBinding, void* aClosure)
|
|||
nsIStyleRuleProcessor *ruleProc =
|
||||
binding->PrototypeBinding()->GetRuleProcessor();
|
||||
if (ruleProc) {
|
||||
if (!set->IsInitialized() && !set->Init(16))
|
||||
return PL_DHASH_STOP;
|
||||
if (!set->IsInitialized()) {
|
||||
set->Init(16);
|
||||
}
|
||||
set->PutEntry(ruleProc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1438,22 +1438,14 @@ nsXBLBinding::GetInsertionPointsFor(nsIContent* aParent,
|
|||
if (!mInsertionPointTable) {
|
||||
mInsertionPointTable =
|
||||
new nsClassHashtable<nsISupportsHashKey, nsInsertionPointList>;
|
||||
if (!mInsertionPointTable || !mInsertionPointTable->Init(4)) {
|
||||
delete mInsertionPointTable;
|
||||
mInsertionPointTable = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInsertionPointTable->Init(4);
|
||||
}
|
||||
|
||||
mInsertionPointTable->Get(aParent, aResult);
|
||||
|
||||
if (!*aResult) {
|
||||
*aResult = new nsInsertionPointList;
|
||||
if (!*aResult || !mInsertionPointTable->Put(aParent, *aResult)) {
|
||||
delete *aResult;
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInsertionPointTable->Put(aParent, *aResult);
|
||||
if (aParent) {
|
||||
aParent->SetFlags(NODE_IS_INSERTION_PARENT);
|
||||
}
|
||||
|
|
|
@ -407,9 +407,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTHashtable<nsStringHashKey> hash;
|
||||
if (!hash.Init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
hash.Init();
|
||||
|
||||
PRInt32 i, len = nodes->size();
|
||||
for (i = 0; i < len; ++i) {
|
||||
|
@ -417,9 +415,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
|||
const txXPathNode& node = nodes->get(i);
|
||||
txXPathNodeUtils::appendNodeValue(node, str);
|
||||
if (!hash.GetEntry(str)) {
|
||||
if (!hash.PutEntry(str)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
hash.PutEntry(str);
|
||||
rv = resultSet->append(node);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
|
|
@ -51,8 +51,7 @@ const PRInt32 txExecutionState::kMaxRecursionDepth = 20000;
|
|||
|
||||
nsresult txLoadedDocumentsHash::init(txXPathNode* aSourceDocument)
|
||||
{
|
||||
nsresult rv = Init(8);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Init(8);
|
||||
|
||||
mSourceDocument = aSourceDocument;
|
||||
|
||||
|
|
|
@ -272,15 +272,10 @@ txKeyHash::getKeyNodes(const txExpandedName& aKeyName,
|
|||
nsresult
|
||||
txKeyHash::init()
|
||||
{
|
||||
nsresult rv = mKeyValues.Init(8);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mIndexedKeys.Init(1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mKeyValues.Init(8);
|
||||
mIndexedKeys.Init(1);
|
||||
mEmptyNodeSet = new txNodeSet(nsnull);
|
||||
NS_ENSURE_TRUE(mEmptyNodeSet, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1873,10 +1873,7 @@ nsXULDocument::SetTemplateBuilderFor(nsIContent* aContent,
|
|||
return NS_OK;
|
||||
}
|
||||
mTemplateBuilderTable = new BuilderTable;
|
||||
if (! mTemplateBuilderTable || !mTemplateBuilderTable->Init()) {
|
||||
mTemplateBuilderTable = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mTemplateBuilderTable->Init();
|
||||
}
|
||||
|
||||
if (aBuilder) {
|
||||
|
@ -2649,9 +2646,9 @@ nsXULDocument::LoadOverlay(const nsAString& aURL, nsIObserver* aObserver)
|
|||
|
||||
if (aObserver) {
|
||||
nsIObserver* obs = nsnull;
|
||||
NS_ENSURE_TRUE(mOverlayLoadObservers.IsInitialized() || mOverlayLoadObservers.Init(),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (!mOverlayLoadObservers.IsInitialized()) {
|
||||
mOverlayLoadObservers.Init();
|
||||
}
|
||||
obs = mOverlayLoadObservers.GetWeak(uri);
|
||||
|
||||
if (obs) {
|
||||
|
@ -3248,8 +3245,9 @@ nsXULDocument::DoneWalking()
|
|||
// XXXbz really, we shouldn't be firing binding constructors
|
||||
// until after StartLayout returns!
|
||||
|
||||
NS_ENSURE_TRUE(mPendingOverlayLoadNotifications.IsInitialized() || mPendingOverlayLoadNotifications.Init(),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!mPendingOverlayLoadNotifications.IsInitialized()) {
|
||||
mPendingOverlayLoadNotifications.Init();
|
||||
}
|
||||
|
||||
mPendingOverlayLoadNotifications.Get(overlayURI, getter_AddRefs(obs));
|
||||
if (!obs) {
|
||||
|
|
|
@ -209,7 +209,7 @@ nsXULPrototypeCache::PutPrototype(nsXULPrototypeDocument* aDocument)
|
|||
{
|
||||
nsCOMPtr<nsIURI> uri = aDocument->GetURI();
|
||||
// Put() releases any old value and addrefs the new one
|
||||
NS_ENSURE_TRUE(mPrototypeTable.Put(uri, aDocument), NS_ERROR_OUT_OF_MEMORY);
|
||||
mPrototypeTable.Put(uri, aDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -219,8 +219,7 @@ nsXULPrototypeCache::PutStyleSheet(nsCSSStyleSheet* aStyleSheet)
|
|||
{
|
||||
nsIURI* uri = aStyleSheet->GetSheetURI();
|
||||
|
||||
NS_ENSURE_TRUE(mStyleSheetTable.Put(uri, aStyleSheet),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mStyleSheetTable.Put(uri, aStyleSheet);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -266,7 +265,7 @@ nsXULPrototypeCache::PutScript(nsIURI* aURI, JSScript* aScriptObject)
|
|||
|
||||
CacheScriptEntry entry = {aScriptObject};
|
||||
|
||||
NS_ENSURE_TRUE(mScriptTable.Put(aURI, entry), NS_ERROR_OUT_OF_MEMORY);
|
||||
mScriptTable.Put(aURI, entry);
|
||||
|
||||
// Lock the object from being gc'd until it is removed from the cache
|
||||
nsCOMPtr<nsIScriptRuntime> rt;
|
||||
|
@ -296,8 +295,7 @@ nsXULPrototypeCache::PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
|
|||
nsRefPtr<nsXBLDocumentInfo> info;
|
||||
mXBLDocTable.Get(uri, getter_AddRefs(info));
|
||||
if (!info) {
|
||||
NS_ENSURE_TRUE(mXBLDocTable.Put(uri, aDocumentInfo),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mXBLDocTable.Put(uri, aDocumentInfo);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1241,9 +1241,8 @@ nsXULContentBuilder::CreateContainerContentsForQuerySet(nsIContent* aElement,
|
|||
if (prevmatch) {
|
||||
prevmatch->mNext = newmatch;
|
||||
}
|
||||
else if (!mMatchMap.Put(resultid, newmatch)) {
|
||||
nsTemplateMatch::Destroy(mPool, newmatch, true);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
else {
|
||||
mMatchMap.Put(resultid, newmatch);
|
||||
}
|
||||
|
||||
if (removematch) {
|
||||
|
|
|
@ -211,8 +211,8 @@ nsXULTemplateBuilder::InitGlobals()
|
|||
gXULTemplateLog = PR_NewLogModule("nsXULTemplateBuilder");
|
||||
#endif
|
||||
|
||||
if (!mMatchMap.IsInitialized() && !mMatchMap.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mMatchMap.IsInitialized())
|
||||
mMatchMap.Init();
|
||||
|
||||
const size_t bucketsizes[] = { sizeof(nsTemplateMatch) };
|
||||
return mPool.Init("nsXULTemplateBuilder", bucketsizes, 1, 256);
|
||||
|
@ -791,8 +791,7 @@ nsXULTemplateBuilder::UpdateResultInContainer(nsIXULTemplateResult* aOldResult,
|
|||
if (oldmatch == firstmatch) {
|
||||
// the match to remove is at the beginning
|
||||
if (oldmatch->mNext) {
|
||||
if (!mMatchMap.Put(aOldId, oldmatch->mNext))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mMatchMap.Put(aOldId, oldmatch->mNext);
|
||||
}
|
||||
else {
|
||||
mMatchMap.Remove(aOldId);
|
||||
|
@ -965,13 +964,7 @@ nsXULTemplateBuilder::UpdateResultInContainer(nsIXULTemplateResult* aOldResult,
|
|||
|
||||
// put the match in the map if there isn't a previous match
|
||||
if (! prevmatch) {
|
||||
if (!mMatchMap.Put(aNewId, newmatch)) {
|
||||
// The match may have already matched a rule above, so
|
||||
// HasBeenRemoved should be called to indicate that it
|
||||
// is being removed again.
|
||||
nsTemplateMatch::Destroy(mPool, newmatch, true);
|
||||
return rv;
|
||||
}
|
||||
mMatchMap.Put(aNewId, newmatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1000,10 +993,7 @@ nsXULTemplateBuilder::UpdateResultInContainer(nsIXULTemplateResult* aOldResult,
|
|||
acceptedmatch = newmatch;
|
||||
}
|
||||
|
||||
if (!mMatchMap.Put(aNewId, newmatch)) {
|
||||
nsTemplateMatch::Destroy(mPool, newmatch, true);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mMatchMap.Put(aNewId, newmatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -342,15 +342,12 @@ nsXULTemplateQueryProcessorRDF::InitializeForBuilding(nsISupports* aDatasource,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!mMemoryElementToResultMap.IsInitialized() &&
|
||||
!mMemoryElementToResultMap.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mBindingDependencies.IsInitialized() &&
|
||||
!mBindingDependencies.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mRuleToBindingsMap.IsInitialized() &&
|
||||
!mRuleToBindingsMap.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mMemoryElementToResultMap.IsInitialized())
|
||||
mMemoryElementToResultMap.Init();
|
||||
if (!mBindingDependencies.IsInitialized())
|
||||
mBindingDependencies.Init();
|
||||
if (!mRuleToBindingsMap.IsInitialized())
|
||||
mRuleToBindingsMap.Init();
|
||||
|
||||
mQueryProcessorRDFInited = true;
|
||||
}
|
||||
|
@ -620,8 +617,7 @@ nsXULTemplateQueryProcessorRDF::AddBinding(nsIDOMNode* aRuleNode,
|
|||
nsRefPtr<RDFBindingSet> bindings = mRuleToBindingsMap.GetWeak(aRuleNode);
|
||||
if (!bindings) {
|
||||
bindings = new RDFBindingSet();
|
||||
if (!bindings || !mRuleToBindingsMap.Put(aRuleNode, bindings))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mRuleToBindingsMap.Put(aRuleNode, bindings);
|
||||
}
|
||||
|
||||
return bindings->AddBinding(aVar, aRef, property);
|
||||
|
@ -1766,10 +1762,7 @@ nsXULTemplateQueryProcessorRDF::AddBindingDependency(nsXULTemplateResultRDF* aRe
|
|||
if (!arr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!mBindingDependencies.Put(aResource, arr)) {
|
||||
delete arr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mBindingDependencies.Put(aResource, arr);
|
||||
}
|
||||
|
||||
PRInt32 index = arr->IndexOf(aResult);
|
||||
|
@ -1811,10 +1804,7 @@ nsXULTemplateQueryProcessorRDF::AddMemoryElements(const Instantiation& aInst,
|
|||
if (!arr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!mMemoryElementToResultMap.Put(hash, arr)) {
|
||||
delete arr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mMemoryElementToResultMap.Put(hash, arr);
|
||||
}
|
||||
|
||||
// results may be added more than once so they will all get deleted properly
|
||||
|
|
|
@ -255,9 +255,8 @@ nsXULTemplateQueryProcessorXML::InitializeForBuilding(nsISupports* aDatasource,
|
|||
mEvaluator = do_CreateInstance("@mozilla.org/dom/xpath-evaluator;1");
|
||||
NS_ENSURE_TRUE(mEvaluator, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (!mRuleToBindingsMap.IsInitialized() &&
|
||||
!mRuleToBindingsMap.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mRuleToBindingsMap.IsInitialized())
|
||||
mRuleToBindingsMap.Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -400,8 +399,7 @@ nsXULTemplateQueryProcessorXML::AddBinding(nsIDOMNode* aRuleNode,
|
|||
nsRefPtr<nsXMLBindingSet> bindings = mRuleToBindingsMap.GetWeak(aRuleNode);
|
||||
if (!bindings) {
|
||||
bindings = new nsXMLBindingSet();
|
||||
if (!bindings || !mRuleToBindingsMap.Put(aRuleNode, bindings))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mRuleToBindingsMap.Put(aRuleNode, bindings);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMXPathExpression> compiledexpr;
|
||||
|
|
|
@ -1743,9 +1743,8 @@ nsXULTreeBuilder::OpenSubtreeForQuerySet(nsTreeRows::Subtree* aSubtree,
|
|||
if (prevmatch) {
|
||||
prevmatch->mNext = newmatch;
|
||||
}
|
||||
else if (!mMatchMap.Put(resultid, newmatch)) {
|
||||
nsTemplateMatch::Destroy(mPool, newmatch, true);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
else {
|
||||
mMatchMap.Put(resultid, newmatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -877,8 +877,7 @@ nsDocShell::Init()
|
|||
rv = mContentListener->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mStorages.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mStorages.Init();
|
||||
|
||||
// We want to hold a strong ref to the loadgroup, so it better hold a weak
|
||||
// ref to us... use an InterfaceRequestorProxy to do this.
|
||||
|
@ -2442,8 +2441,7 @@ nsDocShell::GetSessionStorageForPrincipal(nsIPrincipal* aPrincipal,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!mStorages.Put(origin, newstorage))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mStorages.Put(origin, newstorage);
|
||||
|
||||
newstorage.swap(*aStorage);
|
||||
#if defined(PR_LOGGING) && defined(DEBUG)
|
||||
|
@ -2580,8 +2578,7 @@ nsDocShell::AddSessionStorage(nsIPrincipal* aPrincipal,
|
|||
("nsDocShell[%p]: was added a sessionStorage %p",
|
||||
this, aStorage));
|
||||
#endif
|
||||
if (!mStorages.Put(origin, aStorage))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mStorages.Put(origin, aStorage);
|
||||
}
|
||||
else {
|
||||
return topDocShell->AddSessionStorage(aPrincipal, aStorage);
|
||||
|
|
|
@ -816,14 +816,7 @@ nsGlobalWindow::Init()
|
|||
#endif
|
||||
|
||||
sWindowsById = new WindowByIdTable();
|
||||
// There are two reasons to have Init() failing: if we were not able to
|
||||
// alloc the memory or if the size we want to init is too high. None of them
|
||||
// should happen.
|
||||
#ifdef DEBUG
|
||||
NS_ASSERTION(sWindowsById->Init(), "Init() should not fail!");
|
||||
#else
|
||||
sWindowsById->Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
|
@ -6745,10 +6738,8 @@ void
|
|||
nsGlobalWindow::CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
||||
nsScriptObjectHolder<JSObject>& aHandler)
|
||||
{
|
||||
if (!mCachedXBLPrototypeHandlers.IsInitialized() &&
|
||||
!mCachedXBLPrototypeHandlers.Init()) {
|
||||
NS_ERROR("Failed to initiailize hashtable!");
|
||||
return;
|
||||
if (!mCachedXBLPrototypeHandlers.IsInitialized()) {
|
||||
mCachedXBLPrototypeHandlers.Init();
|
||||
}
|
||||
|
||||
if (!mCachedXBLPrototypeHandlers.Count()) {
|
||||
|
|
|
@ -73,10 +73,7 @@ CloneObjectStoreInfo(const nsAString& aKey,
|
|||
|
||||
nsRefPtr<ObjectStoreInfo> newInfo(new ObjectStoreInfo(*aData));
|
||||
|
||||
if (!hash->Put(aKey, newInfo)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
hash->Put(aKey, newInfo);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
@ -178,11 +175,7 @@ DatabaseInfo::Put(DatabaseInfo* aInfo)
|
|||
|
||||
if (!gDatabaseHash) {
|
||||
nsAutoPtr<DatabaseHash> databaseHash(new DatabaseHash());
|
||||
if (!databaseHash->Init()) {
|
||||
NS_ERROR("Failed to initialize hashtable!");
|
||||
return false;
|
||||
}
|
||||
|
||||
databaseHash->Init();
|
||||
gDatabaseHash = databaseHash.forget();
|
||||
}
|
||||
|
||||
|
@ -191,10 +184,7 @@ DatabaseInfo::Put(DatabaseInfo* aInfo)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!gDatabaseHash->Put(aInfo->id, aInfo)) {
|
||||
NS_ERROR("Put failed!");
|
||||
return false;
|
||||
}
|
||||
gDatabaseHash->Put(aInfo->id, aInfo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -280,10 +270,7 @@ DatabaseInfo::PutObjectStore(ObjectStoreInfo* aInfo)
|
|||
|
||||
if (!objectStoreHash) {
|
||||
nsAutoPtr<ObjectStoreInfoHash> hash(new ObjectStoreInfoHash());
|
||||
if (!hash->Init()) {
|
||||
NS_ERROR("Failed to initialize hashtable!");
|
||||
return false;
|
||||
}
|
||||
hash->Init();
|
||||
objectStoreHash = hash.forget();
|
||||
}
|
||||
|
||||
|
@ -292,7 +279,8 @@ DatabaseInfo::PutObjectStore(ObjectStoreInfo* aInfo)
|
|||
return false;
|
||||
}
|
||||
|
||||
return objectStoreHash->Put(aInfo->name, aInfo);
|
||||
objectStoreHash->Put(aInfo->name, aInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -323,10 +311,7 @@ DatabaseInfo::Clone()
|
|||
|
||||
if (objectStoreHash) {
|
||||
dbInfo->objectStoreHash = new ObjectStoreInfoHash();
|
||||
if (!dbInfo->objectStoreHash->Init()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
dbInfo->objectStoreHash->Init();
|
||||
objectStoreHash->EnumerateRead(CloneObjectStoreInfo,
|
||||
dbInfo->objectStoreHash);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ FileManager::Init(nsIFile* aDirectory,
|
|||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
NS_ENSURE_TRUE(mFileInfos.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
mFileInfos.Init();
|
||||
|
||||
bool exists;
|
||||
nsresult rv = aDirectory->Exists(&exists);
|
||||
|
@ -186,10 +186,7 @@ FileManager::Load(mozIStorageConnection* aConnection)
|
|||
nsRefPtr<FileInfo> fileInfo = FileInfo::Create(this, id);
|
||||
fileInfo->mDBRefCnt = refcount;
|
||||
|
||||
if (!mFileInfos.Put(id, fileInfo)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mFileInfos.Put(id, fileInfo);
|
||||
|
||||
mLastFileId = NS_MAX(id, mLastFileId);
|
||||
}
|
||||
|
@ -273,10 +270,7 @@ FileManager::GetNewFileInfo()
|
|||
|
||||
fileInfo = FileInfo::Create(this, id);
|
||||
|
||||
if (!mFileInfos.Put(id, fileInfo)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return nsnull;
|
||||
}
|
||||
mFileInfos.Put(id, fileInfo);
|
||||
|
||||
mLastFileId = id;
|
||||
}
|
||||
|
|
|
@ -136,10 +136,7 @@ IDBTransaction::Create(IDBDatabase* aDatabase,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
if (!transaction->mCachedStatements.Init()) {
|
||||
NS_ERROR("Failed to initialize hash!");
|
||||
return nsnull;
|
||||
}
|
||||
transaction->mCachedStatements.Init();
|
||||
|
||||
if (!aDispatchDelayed) {
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
|
@ -396,9 +393,7 @@ IDBTransaction::GetCachedStatement(const nsACString& aQuery)
|
|||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
if (!mCachedStatements.Put(aQuery, stmt)) {
|
||||
NS_ERROR("Out of memory?!");
|
||||
}
|
||||
mCachedStatements.Put(aQuery, stmt);
|
||||
}
|
||||
|
||||
return stmt.forget();
|
||||
|
@ -845,7 +840,7 @@ CommitHelper::RevertAutoIncrementCounts()
|
|||
nsresult
|
||||
UpdateRefcountFunction::Init()
|
||||
{
|
||||
NS_ENSURE_TRUE(mFileInfoEntries.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
mFileInfoEntries.Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -911,10 +906,7 @@ UpdateRefcountFunction::ProcessValue(mozIStorageValueArray* aValues,
|
|||
NS_ASSERTION(fileInfo, "Shouldn't be null!");
|
||||
|
||||
nsAutoPtr<FileInfoEntry> newEntry(new FileInfoEntry(fileInfo));
|
||||
if (!mFileInfoEntries.Put(id, newEntry)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mFileInfoEntries.Put(id, newEntry);
|
||||
entry = newEntry.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -228,12 +228,9 @@ IndexedDatabaseManager::GetOrCreate()
|
|||
|
||||
instance = new IndexedDatabaseManager();
|
||||
|
||||
if (!instance->mLiveDatabases.Init() ||
|
||||
!instance->mQuotaHelperHash.Init() ||
|
||||
!instance->mFileManagers.Init()) {
|
||||
NS_WARNING("Out of memory!");
|
||||
return nsnull;
|
||||
}
|
||||
instance->mLiveDatabases.Init();
|
||||
instance->mQuotaHelperHash.Init();
|
||||
instance->mFileManagers.Init();
|
||||
|
||||
// We need a thread-local to hold the current window.
|
||||
NS_ASSERTION(instance->mCurrentWindowIndex == BAD_TLS_INDEX, "Huh?");
|
||||
|
@ -342,10 +339,7 @@ IndexedDatabaseManager::RegisterDatabase(IDBDatabase* aDatabase)
|
|||
nsTArray<IDBDatabase*>* array;
|
||||
if (!mLiveDatabases.Get(aDatabase->Origin(), &array)) {
|
||||
nsAutoPtr<nsTArray<IDBDatabase*> > newArray(new nsTArray<IDBDatabase*>());
|
||||
if (!mLiveDatabases.Put(aDatabase->Origin(), newArray)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return false;
|
||||
}
|
||||
mLiveDatabases.Put(aDatabase->Origin(), newArray);
|
||||
array = newArray.forget();
|
||||
}
|
||||
if (!array->AppendElement(aDatabase)) {
|
||||
|
@ -730,7 +724,7 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
|
|||
new nsTArray<nsRefPtr<FileManager> >());
|
||||
|
||||
nsTHashtable<nsStringHashKey> validSubdirs;
|
||||
NS_ENSURE_TRUE(validSubdirs.Init(20), NS_ERROR_OUT_OF_MEMORY);
|
||||
validSubdirs.Init(20);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> entries;
|
||||
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
|
||||
|
@ -808,10 +802,7 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
|
|||
rv = ss->UpdateQuotaInformationForFile(file);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!validSubdirs.PutEntry(dbBaseFilename)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
validSubdirs.PutEntry(dbBaseFilename);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -844,11 +835,7 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
|
|||
}
|
||||
}
|
||||
|
||||
if (!mFileManagers.Put(aOrigin, fileManagers)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mFileManagers.Put(aOrigin, fileManagers);
|
||||
fileManagers.forget();
|
||||
|
||||
NS_ADDREF(*aDirectory = directory);
|
||||
|
@ -878,8 +865,7 @@ IndexedDatabaseManager::QuotaIsLiftedInternal()
|
|||
helper = new CheckQuotaHelper(window, mQuotaHelperMutex);
|
||||
createdHelper = true;
|
||||
|
||||
bool result = mQuotaHelperHash.Put(window, helper);
|
||||
NS_ENSURE_TRUE(result, result);
|
||||
mQuotaHelperHash.Put(window, helper);
|
||||
|
||||
// Unlock while calling out to XPCOM
|
||||
{
|
||||
|
@ -966,10 +952,7 @@ IndexedDatabaseManager::GetOrCreateFileManager(const nsACString& aOrigin,
|
|||
if (!mFileManagers.Get(aOrigin, &array)) {
|
||||
nsAutoPtr<nsTArray<nsRefPtr<FileManager> > > newArray(
|
||||
new nsTArray<nsRefPtr<FileManager> >());
|
||||
if (!mFileManagers.Put(aOrigin, newArray)) {
|
||||
NS_WARNING("Out of memory?");
|
||||
return nsnull;
|
||||
}
|
||||
mFileManagers.Put(aOrigin, newArray);
|
||||
array = newArray.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -164,10 +164,7 @@ TransactionThreadPool::Init()
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (!mTransactionsInProgress.Init()) {
|
||||
NS_WARNING("Failed to init hash!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTransactionsInProgress.Init();
|
||||
|
||||
nsresult rv;
|
||||
mThreadPool = do_CreateInstance(NS_THREADPOOL_CONTRACTID, &rv);
|
||||
|
@ -468,10 +465,7 @@ TransactionThreadPool::Dispatch(IDBTransaction* aTransaction,
|
|||
}
|
||||
|
||||
if (autoDBTransactionInfo) {
|
||||
if (!mTransactionsInProgress.Put(databaseId, autoDBTransactionInfo)) {
|
||||
NS_WARNING("Failed to put!");
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mTransactionsInProgress.Put(databaseId, autoDBTransactionInfo);
|
||||
autoDBTransactionInfo.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -124,8 +124,7 @@ CrashReporterParent::GenerateHangCrashReport(const AnnotationTable* processNotes
|
|||
GenerateChildData(processNotes);
|
||||
|
||||
CrashReporter::AnnotationTable notes;
|
||||
if (!notes.Init(4))
|
||||
return false;
|
||||
notes.Init(4);
|
||||
notes.Put(nsDependentCString("HangID"), NS_ConvertUTF16toUTF8(mHangID));
|
||||
if (!CrashReporter::AppendExtraData(mParentDumpID, notes))
|
||||
NS_WARNING("problem appending parent data to .extra");
|
||||
|
|
|
@ -384,7 +384,7 @@ TabChild::OpenDialog(PRUint32 aType, const nsACString& aName,
|
|||
nsIDOMElement* aFrameElement)
|
||||
{
|
||||
if (!gActiveDialogs.IsInitialized()) {
|
||||
NS_ENSURE_STATE(gActiveDialogs.Init());
|
||||
gActiveDialogs.Init();
|
||||
}
|
||||
InfallibleTArray<PRInt32> intParams;
|
||||
InfallibleTArray<nsString> stringParams;
|
||||
|
@ -392,7 +392,7 @@ TabChild::OpenDialog(PRUint32 aType, const nsACString& aName,
|
|||
PContentDialogChild* dialog =
|
||||
SendPContentDialogConstructor(aType, nsCString(aName),
|
||||
nsCString(aFeatures), intParams, stringParams);
|
||||
NS_ENSURE_STATE(gActiveDialogs.Put(dialog, aArguments));
|
||||
gActiveDialogs.Put(dialog, aArguments);
|
||||
nsIThread *thread = NS_GetCurrentThread();
|
||||
while (gActiveDialogs.GetWeak(dialog)) {
|
||||
if (!NS_ProcessNextEvent(thread)) {
|
||||
|
|
|
@ -1044,9 +1044,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentEncoding(const char* *result)
|
|||
if (!gCharsetMap) {
|
||||
const int NUM_CHARSETS = sizeof(charsets) / sizeof(moz2javaCharset);
|
||||
gCharsetMap = new nsDataHashtable<nsDepCharHashKey, const char*>();
|
||||
if (!gCharsetMap || !gCharsetMap->Init(NUM_CHARSETS))
|
||||
if (!gCharsetMap)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
gCharsetMap->Init(NUM_CHARSETS);
|
||||
for (PRUint16 i = 0; i < NUM_CHARSETS; i++) {
|
||||
gCharsetMap->Put(charsets[i].mozName, charsets[i].javaName);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,8 @@ PluginInstanceParent::~PluginInstanceParent()
|
|||
bool
|
||||
PluginInstanceParent::Init()
|
||||
{
|
||||
return !!mScriptableObjects.Init();
|
||||
mScriptableObjects.Init();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1542,7 +1543,8 @@ PluginInstanceParent::RegisterNPObjectForActor(
|
|||
NS_ASSERTION(aObject && aActor, "Null pointers!");
|
||||
NS_ASSERTION(mScriptableObjects.IsInitialized(), "Hash not initialized!");
|
||||
NS_ASSERTION(!mScriptableObjects.Get(aObject, nsnull), "Duplicate entry!");
|
||||
return !!mScriptableObjects.Put(aObject, aActor);
|
||||
mScriptableObjects.Put(aObject, aActor);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -177,20 +177,9 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
|
|||
|
||||
NS_ASSERTION(aChannel, "need a channel");
|
||||
|
||||
if (!mObjectMap.Init()) {
|
||||
NS_WARNING("Failed to initialize object hashtable!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mStringIdentifiers.Init()) {
|
||||
NS_ERROR("Failed to initialize string identifier hashtable!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mIntIdentifiers.Init()) {
|
||||
NS_ERROR("Failed to initialize int identifier hashtable!");
|
||||
return false;
|
||||
}
|
||||
mObjectMap.Init();
|
||||
mStringIdentifiers.Init();
|
||||
mIntIdentifiers.Init();
|
||||
|
||||
if (!InitGraphics())
|
||||
return false;
|
||||
|
|
|
@ -137,9 +137,7 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
|
|||
{
|
||||
NS_ASSERTION(mSubprocess, "Out of memory!");
|
||||
|
||||
if (!mIdentifiers.Init()) {
|
||||
NS_ERROR("Out of memory");
|
||||
}
|
||||
mIdentifiers.Init();
|
||||
|
||||
Preferences::RegisterCallback(TimeoutChanged, kChildTimeoutPref, this);
|
||||
Preferences::RegisterCallback(TimeoutChanged, kParentTimeoutPref, this);
|
||||
|
|
|
@ -273,12 +273,7 @@ nsDOMStorageManager::Initialize()
|
|||
if (!gStorageManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!gStorageManager->mStorages.Init()) {
|
||||
delete gStorageManager;
|
||||
gStorageManager = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
gStorageManager->mStorages.Init();
|
||||
NS_ADDREF(gStorageManager);
|
||||
|
||||
// No observers needed in non-chrome
|
||||
|
|
|
@ -46,8 +46,7 @@
|
|||
nsresult
|
||||
nsDOMStorageMemoryDB::Init(nsDOMStoragePersistentDB* aPreloadDB)
|
||||
{
|
||||
if (!mData.Init(20))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mData.Init(20);
|
||||
|
||||
mPreloadDB = aPreloadDB;
|
||||
return NS_OK;
|
||||
|
@ -86,10 +85,7 @@ nsDOMStorageMemoryDB::GetItemsTable(DOMStorageImpl* aStorage,
|
|||
if (!storageData)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!storageData->mTable.Init()) {
|
||||
delete storageData;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
storageData->mTable.Init();
|
||||
|
||||
if (mPreloadDB) {
|
||||
nsresult rv;
|
||||
|
|
|
@ -639,11 +639,7 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
|||
|
||||
domainInfo = new WorkerDomainInfo();
|
||||
domainInfo->mDomain = domain;
|
||||
|
||||
if (!mDomainMap.Put(domain, domainInfo)) {
|
||||
delete domainInfo;
|
||||
domainInfo = nsnull;
|
||||
}
|
||||
mDomainMap.Put(domain, domainInfo);
|
||||
}
|
||||
|
||||
if (domainInfo) {
|
||||
|
@ -696,13 +692,7 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
|||
NS_ASSERTION(!parent, "Shouldn't have a parent here!");
|
||||
|
||||
windowArray = new nsTArray<WorkerPrivate*>(1);
|
||||
|
||||
if (!mWindowMap.Put(window, windowArray)) {
|
||||
delete windowArray;
|
||||
UnregisterWorker(aCx, aWorkerPrivate);
|
||||
JS_ReportOutOfMemory(aCx);
|
||||
return false;
|
||||
}
|
||||
mWindowMap.Put(window, windowArray);
|
||||
}
|
||||
|
||||
NS_ASSERTION(!windowArray->Contains(aWorkerPrivate),
|
||||
|
@ -915,11 +905,8 @@ RuntimeService::Init()
|
|||
mIdleThreadTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
NS_ENSURE_STATE(mIdleThreadTimer);
|
||||
|
||||
bool ok = mDomainMap.Init();
|
||||
NS_ENSURE_STATE(ok);
|
||||
|
||||
ok = mWindowMap.Init();
|
||||
NS_ENSURE_STATE(ok);
|
||||
mDomainMap.Init();
|
||||
mWindowMap.Init();
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
NS_ENSURE_TRUE(obs, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -116,7 +116,7 @@ nsCommandManager::Init(nsIDOMWindow *aWindow)
|
|||
|
||||
NS_ASSERTION(aWindow, "Need non-null window here");
|
||||
mWindow = aWindow; // weak ptr
|
||||
NS_ENSURE_TRUE(mObserversTable.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
mObserversTable.Init();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,7 @@ nsCommandManager::AddCommandObserver(nsIObserver *aCommandObserver, const char *
|
|||
if (!mObserversTable.Get(aCommandToObserve, &commandObservers))
|
||||
{
|
||||
nsAutoPtr<nsCOMArray<nsIObserver> > array(new nsCOMArray<nsIObserver>);
|
||||
if (!array || !mObserversTable.Put(aCommandToObserve, array))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mObserversTable.Put(aCommandToObserve, array);
|
||||
|
||||
commandObservers = array.forget();
|
||||
}
|
||||
|
|
|
@ -193,9 +193,7 @@ nsPermissionManager::Init()
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mHostTable.Init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mHostTable.Init();
|
||||
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
|
@ -123,9 +123,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(Hunspell,
|
|||
nsresult
|
||||
mozHunspell::Init()
|
||||
{
|
||||
if (!mDictionaries.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mDictionaries.Init();
|
||||
LoadDictionaryList();
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
|
|
|
@ -90,8 +90,8 @@ mozPersonalDictionary::~mozPersonalDictionary()
|
|||
|
||||
nsresult mozPersonalDictionary::Init()
|
||||
{
|
||||
if (!mDictionaryTable.Init() || !mIgnoreTable.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mDictionaryTable.Init();
|
||||
mIgnoreTable.Init();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> svc =
|
||||
|
|
|
@ -915,10 +915,8 @@ nsresult imgLoader::InitCache()
|
|||
|
||||
gCacheTracker = new imgCacheExpirationTracker();
|
||||
|
||||
if (!sCache.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!sChromeCache.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
sCache.Init();
|
||||
sChromeCache.Init();
|
||||
|
||||
PRInt32 timeweight;
|
||||
rv = Preferences::GetInt("image.cache.timeweight", &timeweight);
|
||||
|
@ -1083,8 +1081,7 @@ bool imgLoader::PutIntoCache(nsIURI *key, imgCacheEntry *entry)
|
|||
("[this=%p] imgLoader::PutIntoCache -- Element NOT already in the cache", nsnull));
|
||||
}
|
||||
|
||||
if (!cache.Put(spec, entry))
|
||||
return false;
|
||||
cache.Put(spec, entry);
|
||||
|
||||
// We can be called to resurrect an evicted entry.
|
||||
if (entry->Evicted())
|
||||
|
|
|
@ -454,12 +454,9 @@ mozJSComponentLoader::ReallyInit()
|
|||
if (NS_FAILED(rv) || !mSystemPrincipal)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mModules.Init(32))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mImports.Init(32))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mInProgressImports.Init(32))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mModules.Init(32);
|
||||
mImports.Init(32);
|
||||
mInProgressImports.Init(32);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
do_GetService(kObserverServiceContractID, &rv);
|
||||
|
@ -607,8 +604,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile)
|
|||
}
|
||||
|
||||
// Cache this module for later
|
||||
if (!mModules.Put(spec, entry))
|
||||
return NULL;
|
||||
mModules.Put(spec, entry);
|
||||
|
||||
// The hash owns the ModuleEntry now, forget about it
|
||||
return entry.forget();
|
||||
|
@ -1141,8 +1137,9 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
|
|||
nsAutoPtr<ModuleEntry> newEntry;
|
||||
if (!mImports.Get(key, &mod) && !mInProgressImports.Get(key, &mod)) {
|
||||
newEntry = new ModuleEntry;
|
||||
if (!newEntry || !mInProgressImports.Put(key, newEntry))
|
||||
if (!newEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mInProgressImports.Put(key, newEntry);
|
||||
|
||||
JS::Anchor<jsval> exception(JSVAL_VOID);
|
||||
rv = GlobalForLocation(sourceLocalFile, resURI, &newEntry->global,
|
||||
|
@ -1256,8 +1253,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
|
|||
|
||||
// Cache this module for later
|
||||
if (newEntry) {
|
||||
if (!mImports.Put(key, newEntry))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mImports.Put(key, newEntry);
|
||||
newEntry.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -440,8 +440,8 @@ ListBase<LC>::getPrototype(JSContext *cx, XPCWrappedNativeScope *scope,
|
|||
xpc_UnmarkGrayObject(interfacePrototype);
|
||||
return interfacePrototype;
|
||||
}
|
||||
} else if (!cache.Init()) {
|
||||
return NULL;
|
||||
} else {
|
||||
cache.Init();
|
||||
}
|
||||
|
||||
JSObject* proto = Base::getPrototype(cx, scope, receiver);
|
||||
|
@ -491,7 +491,7 @@ ListBase<LC>::getPrototype(JSContext *cx, XPCWrappedNativeScope *scope,
|
|||
// overwrite the value set by InvalidateProtoShape_add when we set our own properties.
|
||||
js::SetReservedSlot(interfacePrototype, 0, PrivateUint32Value(USE_CACHE));
|
||||
|
||||
if (!cache.Put(sInterfaceClass.name, interfacePrototype))
|
||||
if (!cache.Put(sInterfaceClass.name, interfacePrototype, fallible_t()))
|
||||
return NULL;
|
||||
|
||||
return interfacePrototype;
|
||||
|
|
|
@ -4380,6 +4380,9 @@ namespace xpc {
|
|||
|
||||
struct CompartmentPrivate
|
||||
{
|
||||
typedef nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *> ExpandoMap;
|
||||
typedef nsTHashtable<nsPtrHashKey<JSObject> > DOMExpandoMap;
|
||||
|
||||
CompartmentPrivate(bool wantXrays)
|
||||
: wantXrays(wantXrays)
|
||||
{
|
||||
|
@ -4391,20 +4394,17 @@ struct CompartmentPrivate
|
|||
bool wantXrays;
|
||||
nsAutoPtr<JSObject2JSObjectMap> waiverWrapperMap;
|
||||
// NB: we don't want this map to hold a strong reference to the wrapper.
|
||||
nsAutoPtr<nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *> > expandoMap;
|
||||
nsAutoPtr<nsTHashtable<nsPtrHashKey<JSObject> > > domExpandoMap;
|
||||
nsAutoPtr<ExpandoMap> expandoMap;
|
||||
nsAutoPtr<DOMExpandoMap> domExpandoMap;
|
||||
nsCString location;
|
||||
|
||||
bool RegisterExpandoObject(XPCWrappedNative *wn, JSObject *expando) {
|
||||
if (!expandoMap) {
|
||||
expandoMap = new nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *>();
|
||||
if (!expandoMap->Init(8)) {
|
||||
expandoMap = nsnull;
|
||||
return false;
|
||||
}
|
||||
expandoMap = new ExpandoMap();
|
||||
expandoMap->Init(8);
|
||||
}
|
||||
wn->SetHasExpandoObject();
|
||||
return expandoMap->Put(wn, expando);
|
||||
return expandoMap->Put(wn, expando, mozilla::fallible_t());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4430,13 +4430,10 @@ struct CompartmentPrivate
|
|||
|
||||
bool RegisterDOMExpandoObject(JSObject *expando) {
|
||||
if (!domExpandoMap) {
|
||||
domExpandoMap = new nsTHashtable<nsPtrHashKey<JSObject> >();
|
||||
if (!domExpandoMap->Init(8)) {
|
||||
domExpandoMap = nsnull;
|
||||
return false;
|
||||
}
|
||||
domExpandoMap = new DOMExpandoMap();
|
||||
domExpandoMap->Init(8);
|
||||
}
|
||||
return domExpandoMap->PutEntry(expando);
|
||||
return domExpandoMap->PutEntry(expando, mozilla::fallible_t());
|
||||
}
|
||||
void RemoveDOMExpandoObject(JSObject *expando) {
|
||||
if (domExpandoMap)
|
||||
|
|
|
@ -76,8 +76,8 @@ public:
|
|||
"Shouldn't have both root flags");
|
||||
}
|
||||
|
||||
bool Init() {
|
||||
return mPendingRestyles.Init();
|
||||
void Init() {
|
||||
mPendingRestyles.Init();
|
||||
}
|
||||
|
||||
PRUint32 Count() const {
|
||||
|
|
|
@ -1395,9 +1395,8 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument *aDocument,
|
|||
ELEMENT_IS_POTENTIAL_ANIMATION_RESTYLE_ROOT, this)
|
||||
{
|
||||
// XXXbz this should be in Init() or something!
|
||||
if (!mPendingRestyles.Init() || !mPendingAnimationRestyles.Init()) {
|
||||
// now what?
|
||||
}
|
||||
mPendingRestyles.Init();
|
||||
mPendingAnimationRestyles.Init();
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool gFirstTime = true;
|
||||
|
|
|
@ -275,10 +275,7 @@ nsCounterManager::CounterListFor(const nsSubstring& aCounterName)
|
|||
nsCounterList *counterList;
|
||||
if (!mNames.Get(aCounterName, &counterList)) {
|
||||
counterList = new nsCounterList();
|
||||
if (!mNames.Put(aCounterName, counterList)) {
|
||||
delete counterList;
|
||||
return nsnull;
|
||||
}
|
||||
mNames.Put(aCounterName, counterList);
|
||||
}
|
||||
return counterList;
|
||||
}
|
||||
|
|
|
@ -96,13 +96,15 @@ nsresult
|
|||
nsLayoutHistoryState::Init()
|
||||
{
|
||||
mScrollPositionOnly = false;
|
||||
return mStates.Init() ? NS_OK : NS_ERROR_FAILURE;
|
||||
mStates.Init();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLayoutHistoryState::AddState(const nsCString& aStateKey, nsPresState* aState)
|
||||
{
|
||||
return mStates.Put(aStateKey, aState) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
mStates.Put(aStateKey, aState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -143,11 +143,7 @@ static ContentMap* sContentMap = NULL;
|
|||
static ContentMap& GetContentMap() {
|
||||
if (!sContentMap) {
|
||||
sContentMap = new ContentMap();
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
sContentMap->Init();
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Could not initialize map.");
|
||||
}
|
||||
return *sContentMap;
|
||||
}
|
||||
|
|
|
@ -289,7 +289,6 @@ public:
|
|||
nsTArray<void *> mEntries;
|
||||
size_t mEntrySize;
|
||||
|
||||
protected:
|
||||
typedef const void* KeyTypePointer;
|
||||
KeyTypePointer mKey;
|
||||
|
||||
|
@ -306,7 +305,6 @@ protected:
|
|||
{ return NS_PTR_TO_INT32(aKey); }
|
||||
|
||||
enum { ALLOW_MEMMOVE = false };
|
||||
friend class nsTHashtable<FreeList>;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -337,9 +335,6 @@ struct nsPresArena::State {
|
|||
// If there is no free-list entry for this type already, we have
|
||||
// to create one now, to record its size.
|
||||
FreeList* list = mFreeLists.PutEntry(aCode);
|
||||
if (!list) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsTArray<void*>::index_type len = list->mEntries.Length();
|
||||
if (list->mEntrySize == 0) {
|
||||
|
|
|
@ -954,9 +954,9 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
|||
mDeviceContext->FlushFontCache();
|
||||
mCurAppUnitsPerDevPixel = AppUnitsPerDevPixel();
|
||||
|
||||
for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i)
|
||||
if (!mImageLoaders[i].Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i) {
|
||||
mImageLoaders[i].Init();
|
||||
}
|
||||
|
||||
mEventManager = new nsEventStateManager();
|
||||
NS_ADDREF(mEventManager);
|
||||
|
|
|
@ -767,9 +767,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!mFramesToDirty.Init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mFramesToDirty.Init();
|
||||
|
||||
mDocument = aDocument;
|
||||
NS_ADDREF(mDocument);
|
||||
|
|
|
@ -587,9 +587,7 @@ TextOverflow::ProcessLine(const nsDisplayListSet& aLists,
|
|||
mRight.mActive = mRight.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP;
|
||||
|
||||
FrameHashtable framesToHide;
|
||||
if (!framesToHide.Init(100)) {
|
||||
return;
|
||||
}
|
||||
framesToHide.Init(100);
|
||||
AlignmentEdges alignmentEdges;
|
||||
ExamineLineFrames(aLine, &framesToHide, &alignmentEdges);
|
||||
bool needLeft = mLeft.IsNeeded();
|
||||
|
|
|
@ -128,9 +128,7 @@ nsFontFaceList::AddFontsFromTextRun(gfxTextRun* aTextRun,
|
|||
}
|
||||
nsCOMPtr<nsFontFace> ff =
|
||||
new nsFontFace(fe, iter.GetGlyphRun()->mMatchType, rule);
|
||||
if (!mFontFaces.Put(fe, ff)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mFontFaces.Put(fe, ff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1102,10 +1102,15 @@ Loader::CreateSheet(nsIURI* aURI,
|
|||
LOG(("css::Loader::CreateSheet"));
|
||||
NS_PRECONDITION(aSheet, "Null out param!");
|
||||
|
||||
NS_ENSURE_TRUE((mCompleteSheets.IsInitialized() || mCompleteSheets.Init()) &&
|
||||
(mLoadingDatas.IsInitialized() || mLoadingDatas.Init()) &&
|
||||
(mPendingDatas.IsInitialized() || mPendingDatas.Init()),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!mCompleteSheets.IsInitialized()) {
|
||||
mCompleteSheets.Init();
|
||||
}
|
||||
if (!mLoadingDatas.IsInitialized()) {
|
||||
mLoadingDatas.Init();
|
||||
}
|
||||
if (!mPendingDatas.IsInitialized()) {
|
||||
mPendingDatas.Init();
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
*aSheet = nsnull;
|
||||
|
@ -1597,14 +1602,7 @@ Loader::LoadSheet(SheetLoadData* aLoadData, StyleSheetState aSheetState)
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (!mLoadingDatas.Put(&key, aLoadData)) {
|
||||
LOG_ERROR((" Failed to put data in loading table"));
|
||||
aLoadData->mIsCancelled = true;
|
||||
channel->Cancel(NS_ERROR_OUT_OF_MEMORY);
|
||||
SheetComplete(aLoadData, NS_ERROR_OUT_OF_MEMORY);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mLoadingDatas.Put(&key, aLoadData);
|
||||
aLoadData->mIsLoading = true;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1951,9 +1949,7 @@ Loader::LoadStyleLink(nsIContent* aElement,
|
|||
*aIsAlternate) {
|
||||
LOG((" Deferring alternate sheet load"));
|
||||
URIAndPrincipalHashKey key(data->mURI, data->mLoaderPrincipal);
|
||||
if (!mPendingDatas.Put(&key, data)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mPendingDatas.Put(&key, data);
|
||||
|
||||
data->mMustNotify = true;
|
||||
return NS_OK;
|
||||
|
|
|
@ -500,10 +500,7 @@ void nsTableFrame::ResetRowIndices(const nsFrameList::Slice& aRowGroupsToExclude
|
|||
|
||||
PRInt32 rowIndex = 0;
|
||||
nsTHashtable<nsPtrHashKey<nsTableRowGroupFrame> > excludeRowGroups;
|
||||
if (!excludeRowGroups.Init()) {
|
||||
NS_ERROR("Failed to initialize excludeRowGroups hash.");
|
||||
return;
|
||||
}
|
||||
excludeRowGroups.Init();
|
||||
nsFrameList::Enumerator excludeRowGroupsEnumerator(aRowGroupsToExclude);
|
||||
while (!excludeRowGroupsEnumerator.AtEnd()) {
|
||||
excludeRowGroups.PutEntry(static_cast<nsTableRowGroupFrame*>(excludeRowGroupsEnumerator.get()));
|
||||
|
|
|
@ -343,15 +343,11 @@ nsBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports*
|
|||
if (!mPropertyTable) {
|
||||
mPropertyTable = new nsInterfaceHashtable<nsStringHashKey,nsISupports>;
|
||||
if (!mPropertyTable) return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mPropertyTable->Init(8)) {
|
||||
mPropertyTable = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mPropertyTable->Init(8);
|
||||
}
|
||||
|
||||
nsDependentString propertyName(aPropertyName);
|
||||
if (!mPropertyTable->Put(propertyName, aValue))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mPropertyTable->Put(propertyName, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,9 +209,9 @@ nsTreeBodyFrame::Init(nsIContent* aContent,
|
|||
mIndentation = GetIndentation();
|
||||
mRowHeight = GetRowHeight();
|
||||
|
||||
NS_ENSURE_TRUE(mCreatedListeners.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
mCreatedListeners.Init();
|
||||
|
||||
NS_ENSURE_TRUE(mImageCache.Init(16), NS_ERROR_OUT_OF_MEMORY);
|
||||
mImageCache.Init(16);
|
||||
EnsureBoxObject();
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -234,8 +234,7 @@ nsresult nsZipWriter::ReadFile(nsIFile *aFile)
|
|||
mHeaders.Clear();
|
||||
return rv;
|
||||
}
|
||||
if (!mEntryHash.Put(header->mName, mHeaders.Count()))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mEntryHash.Put(header->mName, mHeaders.Count());
|
||||
if (!mHeaders.AppendObject(header))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -616,10 +615,7 @@ NS_IMETHODIMP nsZipWriter::RemoveEntry(const nsACString & aZipEntry,
|
|||
mCDSOffset -= shift;
|
||||
PRInt32 pos2 = pos + 1;
|
||||
while (pos2 < mHeaders.Count()) {
|
||||
if (!mEntryHash.Put(mHeaders[pos2]->mName, pos2-1)) {
|
||||
Cleanup();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mEntryHash.Put(mHeaders[pos2]->mName, pos2-1);
|
||||
mHeaders[pos2]->mOffset -= shift;
|
||||
pos2++;
|
||||
}
|
||||
|
@ -804,10 +800,8 @@ nsresult nsZipWriter::InternalAddEntryDirectory(const nsACString & aZipEntry,
|
|||
|
||||
mCDSDirty = true;
|
||||
mCDSOffset += header->GetFileHeaderLength();
|
||||
if (!mEntryHash.Put(header->mName, mHeaders.Count())) {
|
||||
Cleanup();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mEntryHash.Put(header->mName, mHeaders.Count());
|
||||
|
||||
if (!mHeaders.AppendObject(header)) {
|
||||
Cleanup();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -856,10 +850,7 @@ nsresult nsZipWriter::EntryCompleteCallback(nsZipHeader* aHeader,
|
|||
nsresult aStatus)
|
||||
{
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
if (!mEntryHash.Put(aHeader->mName, mHeaders.Count())) {
|
||||
SeekCDS();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mEntryHash.Put(aHeader->mName, mHeaders.Count());
|
||||
if (!mHeaders.AppendObject(aHeader)) {
|
||||
mEntryHash.Remove(aHeader->mName);
|
||||
SeekCDS();
|
||||
|
|
|
@ -1438,8 +1438,8 @@ Preferences::RegisterCallback(PrefChangedFunc aCallback,
|
|||
observer->AppendClosure(aClosure);
|
||||
nsresult rv = AddStrongObserver(observer, aPref);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return gObserverTable->Put(observer, observer) ? NS_OK :
|
||||
NS_ERROR_OUT_OF_MEMORY;
|
||||
gObserverTable->Put(observer, observer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -591,12 +591,7 @@ NS_IMETHODIMP nsPrefBranch::AddObserver(const char *aDomain, nsIObserver *aObser
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool putSucceeded = mObservers.Put(pCallback, pCallback);
|
||||
|
||||
if (!putSucceeded) {
|
||||
delete pCallback;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mObservers.Put(pCallback, pCallback);
|
||||
|
||||
// We must pass a fully qualified preference name to the callback
|
||||
// aDomain == nsnull is the only possible failure, and we trapped it with
|
||||
|
|
|
@ -336,8 +336,7 @@ nsProtocolProxyService::~nsProtocolProxyService()
|
|||
nsresult
|
||||
nsProtocolProxyService::Init()
|
||||
{
|
||||
if (!mFailedProxies.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mFailedProxies.Init();
|
||||
|
||||
// failure to access prefs is non-fatal
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch =
|
||||
|
|
|
@ -1182,16 +1182,15 @@ nsOfflineCacheDevice::Init()
|
|||
nsresult
|
||||
nsOfflineCacheDevice::InitActiveCaches()
|
||||
{
|
||||
NS_ENSURE_TRUE(mCaches.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mActiveCachesByGroup.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
mCaches.Init();
|
||||
mActiveCachesByGroup.Init();
|
||||
|
||||
nsresult rv = mActiveCaches.Init(5);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mActiveCaches.Init(5);
|
||||
|
||||
AutoResetStatement statement(mStatement_EnumerateGroups);
|
||||
|
||||
bool hasRows;
|
||||
rv = statement->ExecuteStep(&hasRows);
|
||||
nsresult rv = statement->ExecuteStep(&hasRows);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
while (hasRows)
|
||||
|
|
|
@ -72,8 +72,7 @@ nsEffectiveTLDService::Init()
|
|||
// 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. :-)
|
||||
if (!mHash.Init(ArrayLength(gEntries) - 1))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mHash.Init(ArrayLength(gEntries) - 1);
|
||||
|
||||
nsresult rv;
|
||||
mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv);
|
||||
|
|
|
@ -157,8 +157,7 @@ nsResProtocolHandler::~nsResProtocolHandler()
|
|||
nsresult
|
||||
nsResProtocolHandler::Init()
|
||||
{
|
||||
if (!mSubstitutions.Init(32))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
mSubstitutions.Init(32);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -362,7 +361,8 @@ nsResProtocolHandler::SetSubstitution(const nsACString& root, nsIURI *baseURI)
|
|||
nsresult rv = baseURI->GetScheme(scheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!scheme.Equals(NS_LITERAL_CSTRING("resource"))) {
|
||||
return mSubstitutions.Put(root, baseURI) ? NS_OK : NS_ERROR_UNEXPECTED;
|
||||
mSubstitutions.Put(root, baseURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// baseURI is a resource URI, let's resolve it first.
|
||||
|
@ -375,7 +375,8 @@ nsResProtocolHandler::SetSubstitution(const nsACString& root, nsIURI *baseURI)
|
|||
getter_AddRefs(newBaseURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return mSubstitutions.Put(root, newBaseURI) ? NS_OK : NS_ERROR_UNEXPECTED;
|
||||
mSubstitutions.Put(root, newBaseURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -110,11 +110,10 @@ class nsHtml5AtomTable
|
|||
~nsHtml5AtomTable();
|
||||
|
||||
/**
|
||||
* Must be called after the constructor before use. Returns true
|
||||
* when successful and false on OOM failure.
|
||||
* Must be called after the constructor before use.
|
||||
*/
|
||||
inline bool Init() {
|
||||
return mTable.Init();
|
||||
inline void Init() {
|
||||
mTable.Init();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ nsHtml5StringParser::nsHtml5StringParser()
|
|||
, mTokenizer(new nsHtml5Tokenizer(mTreeBuilder, false))
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StringParser);
|
||||
mAtomTable.Init(); // we aren't checking for OOM anyway...
|
||||
mAtomTable.Init();
|
||||
mTokenizer->setInterner(&mAtomTable);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,8 @@ nsRDFXMLSerializer::RegisterQName(nsIRDFResource* aResource)
|
|||
iter->mPrefix->ToUTF8String(qname);
|
||||
qname.Append(':');
|
||||
qname += StringTail(uri, uri.Length() - iter->mURI.Length());
|
||||
return mQNames.Put(aResource, qname) ? NS_OK : NS_ERROR_FAILURE;
|
||||
mQNames.Put(aResource, qname);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Okay, so we don't have it in our map. Try to make one up. This
|
||||
|
@ -265,7 +266,8 @@ nsRDFXMLSerializer::RegisterQName(nsIRDFResource* aResource)
|
|||
if (i == -1) {
|
||||
// Okay, just punt and assume there is _no_ namespace on
|
||||
// this thing...
|
||||
return mQNames.Put(aResource, uri) ? NS_OK : NS_ERROR_FAILURE;
|
||||
mQNames.Put(aResource, uri);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +279,8 @@ nsRDFXMLSerializer::RegisterQName(nsIRDFResource* aResource)
|
|||
qname.Append(':');
|
||||
qname += StringTail(uri, uri.Length() - (i + 1));
|
||||
|
||||
return mQNames.Put(aResource, qname) ? NS_OK : NS_ERROR_FAILURE;
|
||||
mQNames.Put(aResource, qname);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -114,8 +114,8 @@ nsStrictTransportSecurityService::Init()
|
|||
if (mObserverService)
|
||||
mObserverService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, false);
|
||||
|
||||
if (mInPrivateMode && !mPrivateModeHostTable.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (mInPrivateMode)
|
||||
mPrivateModeHostTable.Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -400,9 +400,8 @@ nsStrictTransportSecurityService::Observe(nsISupports *subject,
|
|||
// Indication to start recording stuff locally and not writing changes
|
||||
// out to the permission manager.
|
||||
|
||||
if (!mPrivateModeHostTable.IsInitialized()
|
||||
&& !mPrivateModeHostTable.Init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mPrivateModeHostTable.IsInitialized()) {
|
||||
mPrivateModeHostTable.Init();
|
||||
}
|
||||
mInPrivateMode = true;
|
||||
}
|
||||
|
|
|
@ -136,8 +136,7 @@ nsCertOverrideService::Init()
|
|||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
}
|
||||
|
||||
if (!mSettingsTable.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mSettingsTable.Init();
|
||||
|
||||
mOidTagForStoringNewHashes = SEC_OID_SHA256;
|
||||
|
||||
|
|
|
@ -497,8 +497,7 @@ nsCertTree::GetCertsByTypeFromCertList(CERTCertList *aCertList,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsTHashtable<nsCStringHashKey> allHostPortOverrideKeys;
|
||||
if (!allHostPortOverrideKeys.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
allHostPortOverrideKeys.Init();
|
||||
|
||||
if (aWantedType == nsIX509Cert::SERVER_CERT) {
|
||||
mOriginalOverrideService->
|
||||
|
|
|
@ -81,8 +81,7 @@ nsClientAuthRememberService::Init()
|
|||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
}
|
||||
|
||||
if (!mSettingsTable.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mSettingsTable.Init();
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
|
|
|
@ -71,9 +71,7 @@ public:
|
|||
StatementCache(nsCOMPtr<mozIStorageConnection>& aConnection)
|
||||
: mConnection(aConnection)
|
||||
{
|
||||
if (!mCachedStatements.Init()) {
|
||||
NS_ERROR("Out of memory!?");
|
||||
}
|
||||
mCachedStatements.Init();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,9 +92,7 @@ public:
|
|||
stmt = CreateStatement(aQuery);
|
||||
NS_ENSURE_TRUE(stmt, nsnull);
|
||||
|
||||
if (!mCachedStatements.Put(aQuery, stmt)) {
|
||||
NS_ERROR("Out of memory!?");
|
||||
}
|
||||
mCachedStatements.Put(aQuery, stmt);
|
||||
}
|
||||
return stmt.forget();
|
||||
}
|
||||
|
|
|
@ -309,8 +309,7 @@ AsyncBindingParams::BindByName(const nsACString &aName,
|
|||
{
|
||||
NS_ENSURE_FALSE(mLocked, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (!mNamedParameters.Put(aName, aValue))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mNamedParameters.Put(aName, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1423,8 +1423,7 @@ Connection::CreateFunction(const nsACString &aFunctionName,
|
|||
FunctionInfo info = { aFunction,
|
||||
Connection::FunctionInfo::SIMPLE,
|
||||
aNumArguments };
|
||||
NS_ENSURE_TRUE(mFunctions.Put(aFunctionName, info),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mFunctions.Put(aFunctionName, info);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1459,8 +1458,7 @@ Connection::CreateAggregateFunction(const nsACString &aFunctionName,
|
|||
FunctionInfo info = { aFunction,
|
||||
Connection::FunctionInfo::AGGREGATE,
|
||||
aNumArguments };
|
||||
NS_ENSURE_TRUE(mFunctions.Put(aFunctionName, info),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mFunctions.Put(aFunctionName, info);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ nsresult
|
|||
Row::initialize(sqlite3_stmt *aStatement)
|
||||
{
|
||||
// Initialize the hash table
|
||||
NS_ENSURE_TRUE(mNameHashtable.Init(), NS_ERROR_OUT_OF_MEMORY);
|
||||
mNameHashtable.Init();
|
||||
|
||||
// Get the number of results
|
||||
mNumCols = ::sqlite3_column_count(aStatement);
|
||||
|
|
|
@ -1938,8 +1938,7 @@ History::RegisterVisitedCallback(nsIURI* aURI,
|
|||
|
||||
// First, ensure that our hash table is setup.
|
||||
if (!mObservers.IsInitialized()) {
|
||||
NS_ENSURE_TRUE(mObservers.Init(VISIT_OBSERVERS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mObservers.Init(VISIT_OBSERVERS_INITIAL_CACHE_SIZE);
|
||||
}
|
||||
|
||||
// Obtain our array of observers for this URI.
|
||||
|
|
|
@ -140,12 +140,8 @@ nsFaviconService::Init()
|
|||
mDB = Database::GetDatabase();
|
||||
NS_ENSURE_STATE(mDB);
|
||||
|
||||
// Init failed favicon cache.
|
||||
if (!mFailedFavicons.Init(MAX_FAVICON_CACHE_SIZE))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!mUnassociatedIcons.Init(MAX_UNASSOCIATED_FAVICONS))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mFailedFavicons.Init(MAX_FAVICON_CACHE_SIZE);
|
||||
mUnassociatedIcons.Init(MAX_UNASSOCIATED_FAVICONS);
|
||||
|
||||
mOptimizedIconDimension = Preferences::GetInt(
|
||||
"places.favicons.optimizeToDimension", OPTIMIZED_FAVICON_DIMENSION
|
||||
|
@ -980,8 +976,7 @@ nsFaviconService::AddFailedFavicon(nsIURI* aFaviconURI)
|
|||
nsresult rv = aFaviconURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (! mFailedFavicons.Put(spec, mFailedFaviconSerial))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mFailedFavicons.Put(spec, mFailedFaviconSerial);
|
||||
mFailedFaviconSerial ++;
|
||||
|
||||
if (mFailedFavicons.Count() > MAX_FAVICON_CACHE_SIZE) {
|
||||
|
|
|
@ -2677,8 +2677,7 @@ nsNavBookmarks::EnsureKeywordsHash() {
|
|||
rv = stmt->GetString(1, keyword);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mBookmarkToKeywordHash.Put(itemId, keyword);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mBookmarkToKeywordHash.Put(itemId, keyword);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -341,16 +341,12 @@ nsNavHistory::Init()
|
|||
NS_ENSURE_STATE(mDB);
|
||||
|
||||
// recent events hash tables
|
||||
NS_ENSURE_TRUE(mRecentTyped.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mRecentLink.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ENSURE_TRUE(mRecentBookmark.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mRecentTyped.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE);
|
||||
mRecentLink.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE);
|
||||
mRecentBookmark.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE);
|
||||
|
||||
// Embed visits hash table.
|
||||
NS_ENSURE_TRUE(mEmbedVisits.Init(EMBED_VISITS_INITIAL_CACHE_SIZE),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
mEmbedVisits.Init(EMBED_VISITS_INITIAL_CACHE_SIZE);
|
||||
|
||||
/*****************************************************************************
|
||||
*** IMPORTANT NOTICE!
|
||||
|
|
|
@ -4347,8 +4347,7 @@ nsNavHistoryResult::Init(nsINavHistoryQuery** aQueries,
|
|||
rv = aOptions->GetSortingAnnotation(mSortingAnnotation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mBookmarkFolderObservers.Init(128))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mBookmarkFolderObservers.Init(128);
|
||||
|
||||
NS_ASSERTION(mRootNode->mIndentLevel == -1,
|
||||
"Root node's indent level initialized wrong");
|
||||
|
|
|
@ -4397,9 +4397,7 @@ nsUrlClassifierDBService::SetHashCompleter(const nsACString &tableName,
|
|||
nsIUrlClassifierHashCompleter *completer)
|
||||
{
|
||||
if (completer) {
|
||||
if (!mCompleters.Put(tableName, completer)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mCompleters.Put(tableName, completer);
|
||||
} else {
|
||||
mCompleters.Remove(tableName);
|
||||
}
|
||||
|
|
|
@ -697,8 +697,7 @@ nsresult SetExceptionHandler(nsILocalFile* aXREDirectory,
|
|||
new nsDataHashtable<nsCStringHashKey,nsCString>();
|
||||
NS_ENSURE_TRUE(crashReporterAPIData_Hash, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = crashReporterAPIData_Hash->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
crashReporterAPIData_Hash->Init();
|
||||
|
||||
notesField = new nsCString();
|
||||
NS_ENSURE_TRUE(notesField, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -1287,8 +1286,7 @@ nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data)
|
|||
|
||||
MutexAutoLock lock(*crashReporterAPILock);
|
||||
|
||||
rv = crashReporterAPIData_Hash->Put(key, escapedData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
crashReporterAPIData_Hash->Put(key, escapedData);
|
||||
|
||||
// now rebuild the file contents
|
||||
crashReporterAPIData->Truncate(0);
|
||||
|
|
|
@ -776,7 +776,8 @@ nsresult
|
|||
nsAppShell::AddObserver(const nsAString &aObserverKey, nsIObserver *aObserver)
|
||||
{
|
||||
NS_ASSERTION(aObserver != nsnull, "nsAppShell::AddObserver: aObserver is null!");
|
||||
return mObserversHash.Put(aObserverKey, aObserver) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
mObserversHash.Put(aObserverKey, aObserver);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -242,11 +242,7 @@ CategoryNode::Create(PLArenaPool* aArena)
|
|||
if (!node)
|
||||
return nsnull;
|
||||
|
||||
if (!node->mTable.Init()) {
|
||||
delete node;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
node->mTable.Init();
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,8 @@ nsNativeModuleLoader::Init()
|
|||
NS_ASSERTION(NS_IsMainThread(), "Startup not on main thread?");
|
||||
|
||||
LOG(PR_LOG_DEBUG, ("nsNativeModuleLoader::Init()"));
|
||||
|
||||
return mLibraries.Init() ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
mLibraries.Init();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class LoadModuleMainThreadRunnable : public nsRunnable
|
||||
|
|
|
@ -560,11 +560,12 @@ RegisterStaticAtoms(const nsStaticAtom* aAtoms, PRUint32 aAtomCount)
|
|||
|
||||
if (!gStaticAtomTable && !gStaticAtomTableSealed) {
|
||||
gStaticAtomTable = new nsDataHashtable<nsStringHashKey, nsIAtom*>();
|
||||
if (!gStaticAtomTable || !gStaticAtomTable->Init()) {
|
||||
if (!gStaticAtomTable) {
|
||||
delete gStaticAtomTable;
|
||||
gStaticAtomTable = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
gStaticAtomTable->Init();
|
||||
}
|
||||
|
||||
for (PRUint32 i=0; i<aAtomCount; i++) {
|
||||
|
|
|
@ -124,22 +124,16 @@ nsCheapSet<EntryType>::Put(const KeyType aVal)
|
|||
if (!table) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!table->Init()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
table->Init();
|
||||
EntryType *entry = GetSingleEntry();
|
||||
if (!table->PutEntry(entry->GetKey())) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
table->PutEntry(entry->GetKey());
|
||||
entry->~EntryType();
|
||||
mUnion.table = table;
|
||||
mState = MANY;
|
||||
}
|
||||
// Fall through.
|
||||
case MANY:
|
||||
if (!mUnion.table->PutEntry(aVal)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mUnion.table->PutEntry(aVal);
|
||||
return NS_OK;
|
||||
default:
|
||||
NS_NOTREACHED("bogus state");
|
||||
|
|
|
@ -81,9 +81,7 @@ NS_INTERFACE_MAP_END
|
|||
nsresult
|
||||
nsHashPropertyBag::Init()
|
||||
{
|
||||
// we can only assume that Init will fail only due to OOM.
|
||||
if (!mPropertyHash.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mPropertyHash.Init();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -119,9 +117,7 @@ nsHashPropertyBag::SetProperty(const nsAString& name, nsIVariant *value)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(value);
|
||||
|
||||
bool success = mPropertyHash.Put(name, value);
|
||||
if (!success)
|
||||
return NS_ERROR_FAILURE;
|
||||
mPropertyHash.Put(name, value);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ NS_IMETHODIMP
|
|||
nsProperties::Set(const char* prop, nsISupports* value)
|
||||
{
|
||||
NS_ENSURE_ARG(prop);
|
||||
|
||||
return Put(prop, value) ? NS_OK : NS_ERROR_FAILURE;
|
||||
Put(prop, value);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче