mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team
This commit is contained in:
commit
37d2d6b3f3
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"branch": "",
|
||||
"revision": ""
|
||||
},
|
||||
"revision": "761b205f4e8b27f766af4eb35b0457b618d97c52",
|
||||
"revision": "8911c19f1f8d6fabd76c3892b62e6b87da9ff76e",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="990ddd9f96fd4bac333d1178e56985d09bb26173"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="adaeeb2970c9327e977711c4e18741cfea4baaa6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9422aca1931ba6c68784f9e80bb1b6a7fcfd92e3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -163,10 +163,7 @@ Site.prototype = {
|
||||
this._node.addEventListener("dragstart", this, false);
|
||||
this._node.addEventListener("dragend", this, false);
|
||||
this._node.addEventListener("mouseover", this, false);
|
||||
|
||||
let controls = this.node.querySelectorAll(".newtab-control");
|
||||
for (let i = 0; i < controls.length; i++)
|
||||
controls[i].addEventListener("click", this, false);
|
||||
this._node.addEventListener("click", this, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -178,19 +175,48 @@ Site.prototype = {
|
||||
sc.speculativeConnect(uri, null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Record interaction with site using telemetry.
|
||||
*/
|
||||
_recordSiteClicked: function Site_recordSiteClicked(aIndex) {
|
||||
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
|
||||
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
|
||||
aIndex > 8) {
|
||||
// We only want to get indices for the default configuration, everything
|
||||
// else goes in the same bucket.
|
||||
aIndex = 9;
|
||||
}
|
||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_SITE_CLICKED")
|
||||
.add(aIndex);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles site click events.
|
||||
*/
|
||||
_onClick: function Site_onClick(aEvent) {
|
||||
let target = aEvent.target;
|
||||
if (target.classList.contains("newtab-link") ||
|
||||
target.parentElement.classList.contains("newtab-link")) {
|
||||
this._recordSiteClicked(this.cell.index);
|
||||
return;
|
||||
}
|
||||
|
||||
aEvent.preventDefault();
|
||||
if (aEvent.target.classList.contains("newtab-control-block"))
|
||||
this.block();
|
||||
else if (this.isPinned())
|
||||
this.unpin();
|
||||
else
|
||||
this.pin();
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles all site events.
|
||||
*/
|
||||
handleEvent: function Site_handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "click":
|
||||
aEvent.preventDefault();
|
||||
if (aEvent.target.classList.contains("newtab-control-block"))
|
||||
this.block();
|
||||
else if (this.isPinned())
|
||||
this.unpin();
|
||||
else
|
||||
this.pin();
|
||||
this._onClick(aEvent);
|
||||
break;
|
||||
case "mouseover":
|
||||
this._node.removeEventListener("mouseover", this, false);
|
||||
|
@ -119,15 +119,14 @@ nsChromeRegistryChrome::Init()
|
||||
mSelectedLocale = NS_LITERAL_CSTRING("en-US");
|
||||
mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
|
||||
|
||||
if (!PL_DHashTableInit(&mPackagesHash, &kTableOps,
|
||||
nullptr, sizeof(PackageEntry), 16))
|
||||
return NS_ERROR_FAILURE;
|
||||
PL_DHashTableInit(&mPackagesHash, &kTableOps,
|
||||
nullptr, sizeof(PackageEntry), 16);
|
||||
|
||||
bool safeMode = false;
|
||||
nsCOMPtr<nsIXULRuntime> xulrun (do_GetService(XULAPPINFO_SERVICE_CONTRACTID));
|
||||
if (xulrun)
|
||||
xulrun->GetInSafeMode(&safeMode);
|
||||
|
||||
|
||||
nsCOMPtr<nsIPrefService> prefserv (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
nsCOMPtr<nsIPrefBranch> prefs;
|
||||
|
||||
|
@ -192,7 +192,6 @@ already_AddRefed<nsContentList>
|
||||
NS_GetContentList(nsINode* aRootNode,
|
||||
int32_t aMatchNameSpaceId,
|
||||
const nsAString& aTagname)
|
||||
|
||||
{
|
||||
NS_ASSERTION(aRootNode, "content list has to have a root");
|
||||
|
||||
@ -218,20 +217,16 @@ NS_GetContentList(nsINode* aRootNode,
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gContentListHashTable.ops) {
|
||||
bool success = PL_DHashTableInit(&gContentListHashTable,
|
||||
&hash_table_ops, nullptr,
|
||||
sizeof(ContentListHashEntry),
|
||||
16);
|
||||
|
||||
if (!success) {
|
||||
gContentListHashTable.ops = nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&gContentListHashTable,
|
||||
&hash_table_ops, nullptr,
|
||||
sizeof(ContentListHashEntry),
|
||||
16);
|
||||
}
|
||||
|
||||
|
||||
ContentListHashEntry *entry = nullptr;
|
||||
// First we look in our hashtable. Then we create a content list if needed
|
||||
if (gContentListHashTable.ops) {
|
||||
|
||||
|
||||
// A PL_DHASH_ADD is equivalent to a PL_DHASH_LOOKUP for cases
|
||||
// when the entry is already in the hashtable.
|
||||
entry = static_cast<ContentListHashEntry *>
|
||||
@ -339,14 +334,10 @@ GetFuncStringContentList(nsINode* aRootNode,
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gFuncStringContentListHashTable.ops) {
|
||||
bool success = PL_DHashTableInit(&gFuncStringContentListHashTable,
|
||||
&hash_table_ops, nullptr,
|
||||
sizeof(FuncStringContentListHashEntry),
|
||||
16);
|
||||
|
||||
if (!success) {
|
||||
gFuncStringContentListHashTable.ops = nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&gFuncStringContentListHashTable,
|
||||
&hash_table_ops, nullptr,
|
||||
sizeof(FuncStringContentListHashEntry),
|
||||
16);
|
||||
}
|
||||
|
||||
FuncStringContentListHashEntry *entry = nullptr;
|
||||
|
@ -413,12 +413,8 @@ nsContentUtils::Init()
|
||||
EventListenerManagerHashInitEntry
|
||||
};
|
||||
|
||||
if (!PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
|
||||
nullptr, sizeof(EventListenerManagerMapEntry), 16)) {
|
||||
sEventListenerManagersHash.ops = nullptr;
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
|
||||
nullptr, sizeof(EventListenerManagerMapEntry), 16);
|
||||
|
||||
RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
|
||||
}
|
||||
|
@ -9,9 +9,8 @@
|
||||
void
|
||||
nsContentSupportMap::Init()
|
||||
{
|
||||
if (!PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), PL_DHASH_MIN_SIZE))
|
||||
mMap.ops = nullptr;
|
||||
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), PL_DHASH_MIN_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -26,7 +25,7 @@ nsContentSupportMap::Remove(nsIContent* aElement)
|
||||
{
|
||||
if (!mMap.ops)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
||||
nsIContent* child = aElement;
|
||||
do {
|
||||
PL_DHashTableOperate(&mMap, child, PL_DHASH_REMOVE);
|
||||
|
@ -332,14 +332,16 @@ nsScriptNameSpaceManager::Init()
|
||||
GlobalNameHashInitEntry
|
||||
};
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops, nullptr,
|
||||
sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE);
|
||||
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE,
|
||||
fallible_t());
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mNavigatorNames, &hash_table_ops, nullptr,
|
||||
sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE);
|
||||
mIsInitialized = PL_DHashTableInit(&mNavigatorNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE,
|
||||
fallible_t());
|
||||
if (!mIsInitialized) {
|
||||
PL_DHashTableFinish(&mGlobalNames);
|
||||
|
||||
|
@ -37,9 +37,11 @@ skip-if = os == 'mac'
|
||||
[test_peerConnection_basicAudioVideoCombined.html]
|
||||
[test_peerConnection_basicVideo.html]
|
||||
[test_peerConnection_bug822674.html]
|
||||
[test_peerConnection_bug825703.html]
|
||||
[test_peerConnection_bug827843.html]
|
||||
[test_peerConnection_bug834153.html]
|
||||
[test_peerConnection_bug835370.html]
|
||||
[test_peerConnection_errorCallbacks.html]
|
||||
[test_peerConnection_offerRequiresReceiveAudio.html]
|
||||
[test_peerConnection_offerRequiresReceiveVideo.html]
|
||||
[test_peerConnection_offerRequiresReceiveVideoAudio.html]
|
||||
|
@ -1730,13 +1730,8 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
|
||||
|
||||
if (!sNPObjWrappers.ops) {
|
||||
// No hash yet (or any more), initialize it.
|
||||
|
||||
if (!PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(NPObjWrapperHashEntry), 16)) {
|
||||
NS_ERROR("Error initializing PLDHashTable!");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(NPObjWrapperHashEntry), 16);
|
||||
}
|
||||
|
||||
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
|
||||
|
@ -350,9 +350,7 @@ nsresult nsPluginStreamListenerPeer::Initialize(nsIURI *aURL,
|
||||
|
||||
mPendingRequests = 1;
|
||||
|
||||
mDataForwardToRequest = new nsHashtable(16, false);
|
||||
if (!mDataForwardToRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
mDataForwardToRequest = new nsHashtable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -366,7 +364,7 @@ nsresult
|
||||
nsPluginStreamListenerPeer::SetupPluginCacheFile(nsIChannel* channel)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
||||
bool useExistingCacheFile = false;
|
||||
nsRefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
||||
|
||||
|
@ -156,11 +156,9 @@ SetOrRemoveObject(PLDHashTable& table, nsIContent* aKey, nsISupports* aValue)
|
||||
{
|
||||
if (aValue) {
|
||||
// lazily create the table, but only when adding elements
|
||||
if (!table.ops &&
|
||||
!PL_DHashTableInit(&table, &ObjectTableOps, nullptr,
|
||||
sizeof(ObjectEntry), 16)) {
|
||||
table.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!table.ops) {
|
||||
PL_DHashTableInit(&table, &ObjectTableOps, nullptr,
|
||||
sizeof(ObjectEntry), 16);
|
||||
}
|
||||
aKey->SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
|
||||
return AddObjectEntry(table, aKey, aValue);
|
||||
|
@ -472,10 +472,8 @@ nsXBLDocumentInfo::ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocI
|
||||
if (flags == XBLBinding_Serialize_NoMoreBindings)
|
||||
break;
|
||||
|
||||
nsXBLPrototypeBinding* binding = new nsXBLPrototypeBinding();
|
||||
rv = binding->Read(stream, docInfo, doc, flags);
|
||||
rv = nsXBLPrototypeBinding::ReadNewBinding(stream, docInfo, doc, flags);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete binding;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -1039,6 +1039,23 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsXBLPrototypeBinding::ReadNewBinding(nsIObjectInputStream* aStream,
|
||||
nsXBLDocumentInfo* aDocInfo,
|
||||
nsIDocument* aDocument,
|
||||
uint8_t aFlags)
|
||||
{
|
||||
// If the Read() succeeds, |binding| will end up being owned by aDocInfo's
|
||||
// binding table. Otherwise, we must manually delete it.
|
||||
nsXBLPrototypeBinding* binding = new nsXBLPrototypeBinding();
|
||||
nsresult rv = binding->Read(aStream, aDocInfo, aDocument, aFlags);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete binding;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
WriteInterfaceID(const nsIID& aKey, nsIContent* aData, void* aClosure)
|
||||
{
|
||||
|
@ -145,8 +145,14 @@ public:
|
||||
return &mKeyHandlers;
|
||||
}
|
||||
|
||||
private:
|
||||
nsresult Read(nsIObjectInputStream* aStream,
|
||||
nsXBLDocumentInfo* aDocInfo,
|
||||
nsIDocument* aDocument,
|
||||
uint8_t aFlags);
|
||||
|
||||
/**
|
||||
* Read this binding from the stream aStream into the xbl document aDocument.
|
||||
* Read a new binding from the stream aStream into the xbl document aDocument.
|
||||
* aDocInfo should be the xbl document info for the binding document.
|
||||
* aFlags can contain XBLBinding_Serialize_InheritStyle to indicate that
|
||||
* mInheritStyle flag should be set, and XBLBinding_Serialize_IsFirstBinding
|
||||
@ -154,10 +160,11 @@ public:
|
||||
* XBLBinding_Serialize_ChromeOnlyContent indicates that
|
||||
* nsXBLPrototypeBinding::mChromeOnlyContent should be true.
|
||||
*/
|
||||
nsresult Read(nsIObjectInputStream* aStream,
|
||||
nsXBLDocumentInfo* aDocInfo,
|
||||
nsIDocument* aDocument,
|
||||
uint8_t aFlags);
|
||||
public:
|
||||
static nsresult ReadNewBinding(nsIObjectInputStream* aStream,
|
||||
nsXBLDocumentInfo* aDocInfo,
|
||||
nsIDocument* aDocument,
|
||||
uint8_t aFlags);
|
||||
|
||||
/**
|
||||
* Write this binding to the stream.
|
||||
|
@ -42,9 +42,8 @@ nsCommandParams::~nsCommandParams()
|
||||
nsresult
|
||||
nsCommandParams::Init()
|
||||
{
|
||||
if (!PL_DHashTableInit(&mValuesHash, &sHashOps, (void *)this, sizeof(HashEntry), 4))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PL_DHashTableInit(&mValuesHash, &sHashOps, (void *)this, sizeof(HashEntry), 4);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -605,12 +605,7 @@ public:
|
||||
nullptr
|
||||
};
|
||||
|
||||
if (!PL_DHashTableInit(&mMap, &mOps, nullptr,
|
||||
sizeof(FNCMapEntry), 0))
|
||||
{
|
||||
mMap.ops = nullptr;
|
||||
LOG(("initializing the map failed"));
|
||||
}
|
||||
PL_DHashTableInit(&mMap, &mOps, nullptr, sizeof(FNCMapEntry), 0);
|
||||
|
||||
NS_ABORT_IF_FALSE(XRE_GetProcessType() == GeckoProcessType_Default,
|
||||
"StartupCacheFontNameCache should only be used in chrome process");
|
||||
|
@ -862,6 +862,10 @@ GenericNaN()
|
||||
return mozilla::SpecificNaN<double>(0, 0x8000000000000ULL);
|
||||
}
|
||||
|
||||
/* MSVC with PGO miscompiles this function. */
|
||||
#if defined(_MSC_VER)
|
||||
# pragma optimize("g", off)
|
||||
#endif
|
||||
static inline double
|
||||
CanonicalizeNaN(double d)
|
||||
{
|
||||
@ -869,6 +873,9 @@ CanonicalizeNaN(double d)
|
||||
return GenericNaN();
|
||||
return d;
|
||||
}
|
||||
#if defined(_MSC_VER)
|
||||
# pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* JS::Value is the interface for a single JavaScript Engine value. A few
|
||||
|
@ -495,6 +495,14 @@ class ParseNode
|
||||
bool isDefn() const { return pn_defn; }
|
||||
void setDefn(bool enabled) { pn_defn = enabled; }
|
||||
|
||||
static const unsigned NumDefinitionFlagBits = 10;
|
||||
static const unsigned NumListFlagBits = 10;
|
||||
static const unsigned NumBlockIdBits = 22;
|
||||
static_assert(NumDefinitionFlagBits == NumListFlagBits,
|
||||
"Assumed below to achieve consistent blockid offset");
|
||||
static_assert(NumDefinitionFlagBits + NumBlockIdBits <= 32,
|
||||
"This is supposed to fit in a single uint32_t");
|
||||
|
||||
TokenPos pn_pos; /* two 16-bit pairs here, for 64 bits */
|
||||
int32_t pn_offset; /* first generated bytecode offset */
|
||||
ParseNode *pn_next; /* intrinsic link in parent PN_LIST */
|
||||
@ -505,8 +513,8 @@ class ParseNode
|
||||
ParseNode *head; /* first node in list */
|
||||
ParseNode **tail; /* ptr to ptr to last node in list */
|
||||
uint32_t count; /* number of nodes in list */
|
||||
uint32_t xflags:12, /* extra flags, see below */
|
||||
blockid:20; /* see name variant below */
|
||||
uint32_t xflags:NumListFlagBits, /* see PNX_* below */
|
||||
blockid:NumBlockIdBits; /* see name variant below */
|
||||
} list;
|
||||
struct { /* ternary: if, for(;;), ?: */
|
||||
ParseNode *kid1; /* condition, discriminant, etc. */
|
||||
@ -541,9 +549,9 @@ class ParseNode
|
||||
UpvarCookie cookie; /* upvar cookie with absolute frame
|
||||
level (not relative skip), possibly
|
||||
in current frame */
|
||||
uint32_t dflags:12, /* definition/use flags, see below */
|
||||
blockid:20; /* block number, for subset dominance
|
||||
computation */
|
||||
uint32_t dflags:NumDefinitionFlagBits, /* see PND_* below */
|
||||
blockid:NumBlockIdBits; /* block number, for subset dominance
|
||||
computation */
|
||||
} name;
|
||||
struct {
|
||||
double value; /* aligned numeric literal value */
|
||||
@ -643,38 +651,42 @@ class ParseNode
|
||||
#define PND_LET 0x01 /* let (block-scoped) binding */
|
||||
#define PND_CONST 0x02 /* const binding (orthogonal to let) */
|
||||
#define PND_ASSIGNED 0x04 /* set if ever LHS of assignment */
|
||||
#define PND_PLACEHOLDER 0x10 /* placeholder definition for lexdep */
|
||||
#define PND_BOUND 0x20 /* bound to a stack or global slot */
|
||||
#define PND_DEOPTIMIZED 0x40 /* former pn_used name node, pn_lexdef
|
||||
#define PND_PLACEHOLDER 0x08 /* placeholder definition for lexdep */
|
||||
#define PND_BOUND 0x10 /* bound to a stack or global slot */
|
||||
#define PND_DEOPTIMIZED 0x20 /* former pn_used name node, pn_lexdef
|
||||
still valid, but this use no longer
|
||||
optimizable via an upvar opcode */
|
||||
#define PND_CLOSED 0x80 /* variable is closed over */
|
||||
#define PND_DEFAULT 0x100 /* definition is an arg with a default */
|
||||
#define PND_IMPLICITARGUMENTS 0x200 /* the definition is a placeholder for
|
||||
#define PND_CLOSED 0x40 /* variable is closed over */
|
||||
#define PND_DEFAULT 0x80 /* definition is an arg with a default */
|
||||
#define PND_IMPLICITARGUMENTS 0x100 /* the definition is a placeholder for
|
||||
'arguments' that has been converted
|
||||
into a definition after the function
|
||||
body has been parsed. */
|
||||
#define PND_EMITTEDFUNCTION 0x400 /* hoisted function that was emitted */
|
||||
#define PND_EMITTEDFUNCTION 0x200 /* hoisted function that was emitted */
|
||||
|
||||
static_assert(PND_EMITTEDFUNCTION < (1 << NumDefinitionFlagBits), "Not enough bits");
|
||||
|
||||
/* Flags to propagate from uses to definition. */
|
||||
#define PND_USE2DEF_FLAGS (PND_ASSIGNED | PND_CLOSED)
|
||||
|
||||
/* PN_LIST pn_xflags bits. */
|
||||
#define PNX_POPVAR 0x04 /* PNK_VAR or PNK_CONST last result
|
||||
#define PNX_POPVAR 0x01 /* PNK_VAR or PNK_CONST last result
|
||||
needs popping */
|
||||
#define PNX_GROUPINIT 0x08 /* var [a, b] = [c, d]; unit list */
|
||||
#define PNX_FUNCDEFS 0x10 /* contains top-level function statements */
|
||||
#define PNX_SETCALL 0x20 /* call expression in lvalue context */
|
||||
#define PNX_DESTRUCT 0x40 /* destructuring special cases:
|
||||
#define PNX_GROUPINIT 0x02 /* var [a, b] = [c, d]; unit list */
|
||||
#define PNX_FUNCDEFS 0x04 /* contains top-level function statements */
|
||||
#define PNX_SETCALL 0x08 /* call expression in lvalue context */
|
||||
#define PNX_DESTRUCT 0x10 /* destructuring special cases:
|
||||
1. shorthand syntax used, at present
|
||||
object destructuring ({x,y}) only;
|
||||
2. code evaluating destructuring
|
||||
arguments occurs before function
|
||||
body */
|
||||
#define PNX_SPECIALARRAYINIT 0x80 /* one or more of
|
||||
#define PNX_SPECIALARRAYINIT 0x20 /* one or more of
|
||||
1. array initialiser has holes
|
||||
2. array initializer has spread node */
|
||||
#define PNX_NONCONST 0x100 /* initialiser has non-constants */
|
||||
#define PNX_NONCONST 0x40 /* initialiser has non-constants */
|
||||
|
||||
static_assert(PNX_NONCONST < (1 << NumListFlagBits), "Not enough bits");
|
||||
|
||||
unsigned frameLevel() const {
|
||||
JS_ASSERT(pn_arity == PN_CODE || pn_arity == PN_NAME);
|
||||
|
@ -65,15 +65,17 @@ typedef Handle<NestedScopeObject*> HandleNestedScopeObject;
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
static const unsigned BlockIdLimit = 1 << ParseNode::NumBlockIdBits;
|
||||
|
||||
template <typename ParseHandler>
|
||||
bool
|
||||
GenerateBlockId(TokenStream &ts, ParseContext<ParseHandler> *pc, uint32_t &blockid)
|
||||
{
|
||||
if (pc->blockidGen == JS_BIT(20)) {
|
||||
if (pc->blockidGen == BlockIdLimit) {
|
||||
ts.reportError(JSMSG_NEED_DIET, "program");
|
||||
return false;
|
||||
}
|
||||
JS_ASSERT(pc->blockidGen < JS_BIT(20));
|
||||
JS_ASSERT(pc->blockidGen < BlockIdLimit);
|
||||
blockid = pc->blockidGen++;
|
||||
return true;
|
||||
}
|
||||
@ -5825,7 +5827,7 @@ static bool
|
||||
AdjustBlockId(TokenStream &ts, ParseNode *pn, unsigned adjust, ParseContext<ParseHandler> *pc)
|
||||
{
|
||||
JS_ASSERT(pn->isArity(PN_LIST) || pn->isArity(PN_CODE) || pn->isArity(PN_NAME));
|
||||
if (JS_BIT(20) - pn->pn_blockid <= adjust + 1) {
|
||||
if (BlockIdLimit - pn->pn_blockid <= adjust + 1) {
|
||||
ts.reportError(JSMSG_NEED_DIET, "program");
|
||||
return false;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ Function("\
|
||||
for each(l in[(let(c)([])\
|
||||
for each(l in[]))(let(c)w for(u in[]))(let(u)w for(l in[]))(let(c)w for(u in[]))\
|
||||
(let(u)w for each(l in[]))(let(c)w for(u in[]))(let(u)w for(l in[]))(let(c)w for(u in[]))\
|
||||
(let(u)w for each(l in[]))(let(c)w for(u in[]))(let(u)w for(l in[]))(let(c)w for(u in[]))\
|
||||
(let(l)w for(l in[]))(let(u)w for(l in['']))(let(c)w for(u in[]))(let(u)w for(l in[]))\
|
||||
(let(c)w for(l in[]))(let(l)w for(l in[]))(let(c)w for(l in[]))(let(u)w for(l in[]))\
|
||||
(let(c)w for(l in[]))(let(u)w for each(l in[x]))(let(w,x)w for(u in[]))]){}\
|
||||
|
17
js/src/jit-test/tests/gc/bug-975959.js
Normal file
17
js/src/jit-test/tests/gc/bug-975959.js
Normal file
@ -0,0 +1,17 @@
|
||||
try {
|
||||
y = z = [];
|
||||
y[1] = x
|
||||
for (var e, x = [];; d) {}
|
||||
} catch (e) {}
|
||||
try {
|
||||
Object.defineProperty(this, "y", {
|
||||
get: function() {
|
||||
z.filterPar(function() {})
|
||||
}
|
||||
})(1 instanceof 2)
|
||||
} catch (e) {}
|
||||
y
|
||||
verifyprebarriers()
|
||||
y
|
||||
verifyprebarriers()
|
||||
y
|
@ -1840,29 +1840,6 @@ CodeGenerator::visitPostWriteBarrierV(LPostWriteBarrierV *lir)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGenerator::visitPostWriteBarrierAllSlots(LPostWriteBarrierAllSlots *lir)
|
||||
{
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
OutOfLineCallPostWriteBarrier *ool = new(alloc()) OutOfLineCallPostWriteBarrier(lir, lir->object());
|
||||
if (!addOutOfLineCode(ool))
|
||||
return false;
|
||||
|
||||
const Nursery &nursery = GetIonContext()->runtime->gcNursery();
|
||||
|
||||
if (lir->object()->isConstant()) {
|
||||
JS_ASSERT(!nursery.isInside(&lir->object()->toConstant()->toObject()));
|
||||
return true;
|
||||
}
|
||||
|
||||
Register objreg = ToRegister(lir->object());
|
||||
masm.branchPtr(Assembler::Below, objreg, ImmWord(nursery.start()), ool->entry());
|
||||
masm.branchPtr(Assembler::AboveOrEqual, objreg, ImmWord(nursery.heapEnd()), ool->entry());
|
||||
masm.bind(ool->rejoin());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGenerator::visitCallNative(LCallNative *call)
|
||||
{
|
||||
|
@ -113,7 +113,6 @@ class CodeGenerator : public CodeGeneratorSpecific
|
||||
bool visitMonitorTypes(LMonitorTypes *lir);
|
||||
bool visitPostWriteBarrierO(LPostWriteBarrierO *lir);
|
||||
bool visitPostWriteBarrierV(LPostWriteBarrierV *lir);
|
||||
bool visitPostWriteBarrierAllSlots(LPostWriteBarrierAllSlots *lir);
|
||||
bool visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier *ool);
|
||||
bool visitCallNative(LCallNative *call);
|
||||
bool emitCallInvokeFunction(LInstruction *call, Register callereg,
|
||||
|
@ -654,14 +654,13 @@ MacroAssembler::newGCThing(const Register &result, gc::AllocKind allocKind, Labe
|
||||
jump(fail);
|
||||
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
const Nursery &nursery = GetIonContext()->runtime->gcNursery();
|
||||
if (nursery.isEnabled() &&
|
||||
allocKind <= gc::FINALIZE_OBJECT_LAST &&
|
||||
initialHeap != gc::TenuredHeap)
|
||||
{
|
||||
// Always use nursery allocation if it is possible to do so. The jit
|
||||
// assumes a nursery pointer is returned to avoid barriers.
|
||||
if (allocKind <= gc::FINALIZE_OBJECT_LAST && initialHeap != gc::TenuredHeap) {
|
||||
// Inline Nursery::allocate. No explicit check for nursery.isEnabled()
|
||||
// is needed, as the comparison with the nursery's end will always fail
|
||||
// in such cases.
|
||||
const Nursery &nursery = GetIonContext()->runtime->gcNursery();
|
||||
loadPtr(AbsoluteAddress(nursery.addressOfPosition()), result);
|
||||
addPtr(Imm32(thingSize), result);
|
||||
branchPtr(Assembler::BelowOrEqual, AbsoluteAddress(nursery.addressOfCurrentEnd()), result, fail);
|
||||
|
@ -5418,24 +5418,6 @@ class LPostWriteBarrierV : public LInstructionHelper<0, 1 + BOX_PIECES, 1>
|
||||
}
|
||||
};
|
||||
|
||||
// Generational write barrier used when writing to multiple slots in an object.
|
||||
class LPostWriteBarrierAllSlots : public LInstructionHelper<0, 1, 0>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(PostWriteBarrierAllSlots)
|
||||
|
||||
LPostWriteBarrierAllSlots(const LAllocation &obj) {
|
||||
setOperand(0, obj);
|
||||
}
|
||||
|
||||
const MPostWriteBarrier *mir() const {
|
||||
return mir_->toPostWriteBarrier();
|
||||
}
|
||||
const LAllocation *object() {
|
||||
return getOperand(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Guard against an object's identity.
|
||||
class LGuardObjectIdentity : public LInstructionHelper<0, 1, 0>
|
||||
{
|
||||
|
@ -179,7 +179,6 @@
|
||||
_(MonitorTypes) \
|
||||
_(PostWriteBarrierO) \
|
||||
_(PostWriteBarrierV) \
|
||||
_(PostWriteBarrierAllSlots) \
|
||||
_(InitializedLength) \
|
||||
_(SetInitializedLength) \
|
||||
_(NeuterCheck) \
|
||||
|
@ -2264,11 +2264,6 @@ bool
|
||||
LIRGenerator::visitPostWriteBarrier(MPostWriteBarrier *ins)
|
||||
{
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
if (!ins->hasValue()) {
|
||||
LPostWriteBarrierAllSlots *lir =
|
||||
new(alloc()) LPostWriteBarrierAllSlots(useRegisterOrConstant(ins->object()));
|
||||
return add(lir, ins) && assignSafepoint(lir, ins);
|
||||
}
|
||||
switch (ins->value()->type()) {
|
||||
case MIRType_Object: {
|
||||
LPostWriteBarrierO *lir = new(alloc()) LPostWriteBarrierO(useRegisterOrConstant(ins->object()),
|
||||
|
@ -8885,14 +8885,10 @@ class MMonitorTypes : public MUnaryInstruction, public BoxInputsPolicy
|
||||
|
||||
// Given a value being written to another object, update the generational store
|
||||
// buffer if the value is in the nursery and object is in the tenured heap.
|
||||
class MPostWriteBarrier
|
||||
: public MBinaryInstruction,
|
||||
public ObjectPolicy<0>
|
||||
class MPostWriteBarrier : public MBinaryInstruction, public ObjectPolicy<0>
|
||||
{
|
||||
bool hasValue_;
|
||||
|
||||
MPostWriteBarrier(MDefinition *obj, MDefinition *value)
|
||||
: MBinaryInstruction(obj, value), hasValue_(true)
|
||||
: MBinaryInstruction(obj, value)
|
||||
{
|
||||
setGuard();
|
||||
}
|
||||
@ -8912,12 +8908,10 @@ class MPostWriteBarrier
|
||||
return getOperand(0);
|
||||
}
|
||||
|
||||
bool hasValue() const {
|
||||
return hasValue_;
|
||||
}
|
||||
MDefinition *value() const {
|
||||
return getOperand(1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool isConsistentFloat32Use(MUse *use) const {
|
||||
// During lowering, values that neither have object nor value MIR type
|
||||
|
@ -5523,12 +5523,12 @@ AutoMaybeTouchDeadZones::AutoMaybeTouchDeadZones(JSObject *obj)
|
||||
|
||||
AutoMaybeTouchDeadZones::~AutoMaybeTouchDeadZones()
|
||||
{
|
||||
runtime->gcManipulatingDeadZones = manipulatingDeadZones;
|
||||
|
||||
if (inIncremental && runtime->gcObjectsMarkedInDeadZones != markCount) {
|
||||
JS::PrepareForFullGC(runtime);
|
||||
js::GC(runtime, GC_NORMAL, JS::gcreason::TRANSPLANT);
|
||||
}
|
||||
|
||||
runtime->gcManipulatingDeadZones = manipulatingDeadZones;
|
||||
}
|
||||
|
||||
AutoSuppressGC::AutoSuppressGC(ExclusiveContext *cx)
|
||||
|
@ -12,7 +12,7 @@ var actual;
|
||||
* with 2^19 blocks, then test 2^20 - 1 blocks, finally test the limit.
|
||||
*/
|
||||
var s = "{}";
|
||||
for (var i = 0; i < 19; i++)
|
||||
for (var i = 0; i < 21; i++)
|
||||
s += s;
|
||||
|
||||
try {
|
||||
|
@ -169,11 +169,8 @@ nsFrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame)
|
||||
NS_PRECONDITION(nsGkAtoms::placeholderFrame == aPlaceholderFrame->GetType(),
|
||||
"unexpected frame type");
|
||||
if (!mPlaceholderMap.ops) {
|
||||
if (!PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps, nullptr,
|
||||
sizeof(PlaceholderMapEntry), 16)) {
|
||||
mPlaceholderMap.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps, nullptr,
|
||||
sizeof(PlaceholderMapEntry), 16);
|
||||
}
|
||||
PlaceholderMapEntry *entry = static_cast<PlaceholderMapEntry*>(PL_DHashTableOperate(&mPlaceholderMap,
|
||||
aPlaceholderFrame->GetOutOfFlowFrame(),
|
||||
|
@ -3202,7 +3202,7 @@ struct CascadeEnumData {
|
||||
mSheetType(aSheetType)
|
||||
{
|
||||
if (!PL_DHashTableInit(&mRulesByWeight, &gRulesByWeightOps, nullptr,
|
||||
sizeof(RuleByWeightEntry), 64))
|
||||
sizeof(RuleByWeightEntry), 64, fallible_t()))
|
||||
mRulesByWeight.ops = nullptr;
|
||||
|
||||
// Initialize our arena
|
||||
|
@ -477,12 +477,8 @@ already_AddRefed<nsMappedAttributes>
|
||||
nsHTMLStyleSheet::UniqueMappedAttributes(nsMappedAttributes* aMapped)
|
||||
{
|
||||
if (!mMappedAttrTable.ops) {
|
||||
bool res = PL_DHashTableInit(&mMappedAttrTable, &MappedAttrTable_Ops,
|
||||
nullptr, sizeof(MappedAttrTableEntry), 16);
|
||||
if (!res) {
|
||||
mMappedAttrTable.ops = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&mMappedAttrTable, &MappedAttrTable_Ops,
|
||||
nullptr, sizeof(MappedAttrTableEntry), 16);
|
||||
}
|
||||
MappedAttrTableEntry *entry = static_cast<MappedAttrTableEntry*>
|
||||
(PL_DHashTableOperate(&mMappedAttrTable, aMapped, PL_DHASH_ADD));
|
||||
@ -515,13 +511,8 @@ nsIStyleRule*
|
||||
nsHTMLStyleSheet::LangRuleFor(const nsString& aLanguage)
|
||||
{
|
||||
if (!mLangRuleTable.ops) {
|
||||
bool res = PL_DHashTableInit(&mLangRuleTable, &LangRuleTable_Ops,
|
||||
nullptr, sizeof(LangRuleTableEntry), 16);
|
||||
if (!res) {
|
||||
NS_ASSERTION(false, "out of memory");
|
||||
mLangRuleTable.ops = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&mLangRuleTable, &LangRuleTable_Ops,
|
||||
nullptr, sizeof(LangRuleTableEntry), 16);
|
||||
}
|
||||
LangRuleTableEntry *entry = static_cast<LangRuleTableEntry*>
|
||||
(PL_DHashTableOperate(&mLangRuleTable, &aLanguage, PL_DHASH_ADD));
|
||||
|
@ -75,12 +75,9 @@ SpanningCellSorter::AddCell(int32_t aColSpan, int32_t aRow, int32_t aCol)
|
||||
i->next = mArray[index];
|
||||
mArray[index] = i;
|
||||
} else {
|
||||
if (!mHashTable.entryCount &&
|
||||
!PL_DHashTableInit(&mHashTable, &HashTableOps, nullptr,
|
||||
sizeof(HashTableEntry), PL_DHASH_MIN_SIZE)) {
|
||||
NS_NOTREACHED("table init failed");
|
||||
mHashTable.entryCount = 0;
|
||||
return false;
|
||||
if (!mHashTable.entryCount) {
|
||||
PL_DHashTableInit(&mHashTable, &HashTableOps, nullptr,
|
||||
sizeof(HashTableEntry), PL_DHASH_MIN_SIZE);
|
||||
}
|
||||
HashTableEntry *entry = static_cast<HashTableEntry*>
|
||||
(PL_DHashTableOperate(&mHashTable, NS_INT32_TO_PTR(aColSpan),
|
||||
|
@ -149,8 +149,8 @@ nsresult PREF_Init()
|
||||
{
|
||||
if (!gHashTable.ops) {
|
||||
if (!PL_DHashTableInit(&gHashTable, &pref_HashTableOps, nullptr,
|
||||
sizeof(PrefHashEntry),
|
||||
PREF_HASHTABLE_INITIAL_SIZE)) {
|
||||
sizeof(PrefHashEntry), PREF_HASHTABLE_INITIAL_SIZE,
|
||||
fallible_t())) {
|
||||
gHashTable.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -1168,12 +1168,8 @@ nsresult nsLoadGroup::Init()
|
||||
RequestHashInitEntry
|
||||
};
|
||||
|
||||
if (!PL_DHashTableInit(&mRequests, &hash_table_ops, nullptr,
|
||||
sizeof(RequestMapEntry), 16)) {
|
||||
mRequests.ops = nullptr;
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PL_DHashTableInit(&mRequests, &hash_table_ops, nullptr,
|
||||
sizeof(RequestMapEntry), 16);
|
||||
|
||||
mConnectionInfo = new nsLoadGroupConnectionInfo();
|
||||
|
||||
|
5
netwerk/cache/nsCacheEntry.cpp
vendored
5
netwerk/cache/nsCacheEntry.cpp
vendored
@ -407,10 +407,11 @@ nsCacheEntryHashTable::Init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
initialized = PL_DHashTableInit(&table, &ops, nullptr,
|
||||
sizeof(nsCacheEntryHashTableEntry), 512);
|
||||
sizeof(nsCacheEntryHashTableEntry),
|
||||
512, fallible_t());
|
||||
|
||||
if (!initialized) rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
5
netwerk/cache/nsDiskCacheBinding.cpp
vendored
5
netwerk/cache/nsDiskCacheBinding.cpp
vendored
@ -150,10 +150,9 @@ nsresult
|
||||
nsDiskCacheBindery::Init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
initialized = PL_DHashTableInit(&table, &ops, nullptr, sizeof(HashTableEntry), 0);
|
||||
PL_DHashTableInit(&table, &ops, nullptr, sizeof(HashTableEntry), 0);
|
||||
initialized = true;
|
||||
|
||||
if (!initialized) rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,9 @@ nsHttp::CreateAtomTable()
|
||||
// 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.
|
||||
if (!PL_DHashTableInit(&sAtomTable, &ops, nullptr, sizeof(PLDHashEntryStub),
|
||||
NUM_HTTP_ATOMS + 10)) {
|
||||
if (!PL_DHashTableInit(&sAtomTable, &ops, nullptr,
|
||||
sizeof(PLDHashEntryStub),
|
||||
NUM_HTTP_ATOMS + 10, fallible_t())) {
|
||||
sAtomTable.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -91,13 +91,15 @@ nsHTMLEntities::AddRefTable(void)
|
||||
if (!gTableRefCnt) {
|
||||
if (!PL_DHashTableInit(&gEntityToUnicode, &EntityToUnicodeOps,
|
||||
nullptr, sizeof(EntityNodeEntry),
|
||||
uint32_t(NS_HTML_ENTITY_COUNT / 0.75))) {
|
||||
uint32_t(NS_HTML_ENTITY_COUNT / 0.75),
|
||||
fallible_t())) {
|
||||
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))) {
|
||||
uint32_t(NS_HTML_ENTITY_COUNT / 0.75),
|
||||
fallible_t())) {
|
||||
PL_DHashTableFinish(&gEntityToUnicode);
|
||||
gEntityToUnicode.ops = gUnicodeToEntity.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -780,22 +780,17 @@ InMemoryDataSource::InMemoryDataSource(nsISupports* aOuter)
|
||||
nsresult
|
||||
InMemoryDataSource::Init()
|
||||
{
|
||||
if (!PL_DHashTableInit(&mForwardArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry),
|
||||
PL_DHASH_MIN_SIZE)) {
|
||||
mForwardArcs.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&mReverseArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry),
|
||||
PL_DHASH_MIN_SIZE)) {
|
||||
mReverseArcs.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PL_DHashTableInit(&mForwardArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry),
|
||||
PL_DHASH_MIN_SIZE);
|
||||
|
||||
PL_DHashTableInit(&mReverseArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry),
|
||||
PL_DHASH_MIN_SIZE);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (! gLog)
|
||||
|
@ -756,31 +756,21 @@ RDFServiceImpl::Init()
|
||||
if (! mNamedDataSources)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (!PL_DHashTableInit(&mResources, &gResourceTableOps, nullptr,
|
||||
sizeof(ResourceHashEntry), PL_DHASH_MIN_SIZE)) {
|
||||
mResources.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&mLiterals, &gLiteralTableOps, nullptr,
|
||||
sizeof(LiteralHashEntry), PL_DHASH_MIN_SIZE)) {
|
||||
mLiterals.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&mInts, &gIntTableOps, nullptr,
|
||||
sizeof(IntHashEntry), PL_DHASH_MIN_SIZE)) {
|
||||
mInts.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&mDates, &gDateTableOps, nullptr,
|
||||
sizeof(DateHashEntry), PL_DHASH_MIN_SIZE)) {
|
||||
mDates.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&mBlobs, &gBlobTableOps, nullptr,
|
||||
sizeof(BlobHashEntry), PL_DHASH_MIN_SIZE)) {
|
||||
mBlobs.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PL_DHashTableInit(&mResources, &gResourceTableOps, nullptr,
|
||||
sizeof(ResourceHashEntry), PL_DHASH_MIN_SIZE);
|
||||
|
||||
PL_DHashTableInit(&mLiterals, &gLiteralTableOps, nullptr,
|
||||
sizeof(LiteralHashEntry), PL_DHASH_MIN_SIZE);
|
||||
|
||||
PL_DHashTableInit(&mInts, &gIntTableOps, nullptr,
|
||||
sizeof(IntHashEntry), PL_DHASH_MIN_SIZE);
|
||||
|
||||
PL_DHashTableInit(&mDates, &gDateTableOps, nullptr,
|
||||
sizeof(DateHashEntry), PL_DHASH_MIN_SIZE);
|
||||
|
||||
PL_DHashTableInit(&mBlobs, &gBlobTableOps, nullptr,
|
||||
sizeof(BlobHashEntry), PL_DHASH_MIN_SIZE);
|
||||
|
||||
mDefaultResourceFactory = do_GetClassObject(kRDFDefaultResourceCID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -187,7 +187,7 @@ nsresult nsCertTree::InitCompareHash()
|
||||
{
|
||||
ClearCompareHash();
|
||||
if (!PL_DHashTableInit(&mCompareCache, &gMapOps, nullptr,
|
||||
sizeof(CompareCacheHashEntryPtr), 128)) {
|
||||
sizeof(CompareCacheHashEntryPtr), 128, fallible_t())) {
|
||||
mCompareCache.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -4011,6 +4011,12 @@
|
||||
"kind": "boolean",
|
||||
"description": "Number of times about:newtab was shown from opening a new tab or window."
|
||||
},
|
||||
"NEWTAB_PAGE_SITE_CLICKED": {
|
||||
"expires_in_version": "35",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Track click count on about:newtab tiles per index (0-8). For non-default row or column configurations all clicks into the '9' bucket."
|
||||
},
|
||||
"PANORAMA_INITIALIZATION_TIME_MS": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
|
@ -128,10 +128,8 @@ nsDocLoader::nsDocLoader()
|
||||
RequestInfoHashInitEntry
|
||||
};
|
||||
|
||||
if (!PL_DHashTableInit(&mRequestInfoHash, &hash_table_ops, nullptr,
|
||||
sizeof(nsRequestInfo), 16)) {
|
||||
mRequestInfoHash.ops = nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&mRequestInfoHash, &hash_table_ops, nullptr,
|
||||
sizeof(nsRequestInfo), 16);
|
||||
|
||||
ClearInternalProgress();
|
||||
|
||||
|
@ -738,10 +738,8 @@ public:
|
||||
void Init()
|
||||
{
|
||||
MOZ_ASSERT(IsEmpty(), "Failed to call GCGraph::Clear");
|
||||
if (!PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps, nullptr,
|
||||
sizeof(PtrToNodeEntry), 32768)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps, nullptr,
|
||||
sizeof(PtrToNodeEntry), 32768);
|
||||
}
|
||||
|
||||
void Clear()
|
||||
|
@ -506,11 +506,9 @@ NS_SizeOfAtomTablesIncludingThis(MallocSizeOf aMallocSizeOf) {
|
||||
static inline void
|
||||
EnsureTableExists()
|
||||
{
|
||||
if (!gAtomTable.ops &&
|
||||
!PL_DHashTableInit(&gAtomTable, &AtomTableOps, 0,
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_SIZE)) {
|
||||
// Initialization failed.
|
||||
NS_ABORT_OOM(ATOM_HASHTABLE_INITIAL_SIZE * sizeof(AtomTableEntry));
|
||||
if (!gAtomTable.ops) {
|
||||
PL_DHashTableInit(&gAtomTable, &AtomTableOps, 0,
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,21 +118,20 @@ nsHashKey::Write(nsIObjectOutputStream* aStream) const
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsHashtable::nsHashtable(uint32_t aInitSize, bool threadSafe)
|
||||
nsHashtable::nsHashtable(uint32_t aInitSize, bool aThreadSafe)
|
||||
: mLock(nullptr), mEnumerating(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHashtable);
|
||||
|
||||
bool result = PL_DHashTableInit(&mHashtable, &hashtableOps, nullptr,
|
||||
sizeof(HTEntry), aInitSize);
|
||||
|
||||
sizeof(HTEntry), aInitSize, fallible_t());
|
||||
NS_ASSERTION(result, "Hashtable failed to initialize");
|
||||
|
||||
// make sure we detect this later
|
||||
if (!result)
|
||||
mHashtable.ops = nullptr;
|
||||
|
||||
if (threadSafe) {
|
||||
if (aThreadSafe) {
|
||||
mLock = PR_NewLock();
|
||||
if (mLock == nullptr) {
|
||||
// Cannot create a lock. If running on a multiprocessing system
|
||||
@ -142,7 +141,6 @@ nsHashtable::nsHashtable(uint32_t aInitSize, bool threadSafe)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsHashtable::~nsHashtable() {
|
||||
MOZ_COUNT_DTOR(nsHashtable);
|
||||
if (mHashtable.ops)
|
||||
@ -344,7 +342,8 @@ nsHashtable::nsHashtable(nsIObjectInputStream* aStream,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool status =
|
||||
PL_DHashTableInit(&mHashtable, &hashtableOps,
|
||||
nullptr, sizeof(HTEntry), count);
|
||||
nullptr, sizeof(HTEntry), count,
|
||||
fallible_t());
|
||||
if (!status) {
|
||||
mHashtable.ops = nullptr;
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -101,7 +101,7 @@ class nsHashtable {
|
||||
bool mEnumerating;
|
||||
|
||||
public:
|
||||
nsHashtable(uint32_t aSize = 16, bool threadSafe = false);
|
||||
nsHashtable(uint32_t aSize = 16, bool aThreadSafe = false);
|
||||
virtual ~nsHashtable();
|
||||
|
||||
int32_t Count(void) { return mHashtable.entryCount; }
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsUnicharInputStream.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#define PL_ARENA_CONST_ALIGN_MASK 3
|
||||
#include "nsPersistentProperties.h"
|
||||
@ -338,9 +339,9 @@ NS_METHOD nsPropertiesParser::SegmentWriter(nsIUnicharInputStream* aStream,
|
||||
uint32_t aCount,
|
||||
uint32_t *aWriteCount)
|
||||
{
|
||||
nsPropertiesParser *parser =
|
||||
nsPropertiesParser *parser =
|
||||
static_cast<nsPropertiesParser *>(aClosure);
|
||||
|
||||
|
||||
parser->ParseBuffer(aFromSegment, aCount);
|
||||
|
||||
*aWriteCount = aCount;
|
||||
@ -446,7 +447,10 @@ nsPersistentProperties::nsPersistentProperties()
|
||||
: mIn(nullptr)
|
||||
{
|
||||
mSubclass = static_cast<nsIPersistentProperties*>(this);
|
||||
mTable.ops = nullptr;
|
||||
|
||||
PL_DHashTableInit(&mTable, &property_HashTableOps, nullptr,
|
||||
sizeof(PropertyTableEntry), 20);
|
||||
|
||||
PL_INIT_ARENA_POOL(&mArena, "PersistentPropertyArena", 2048);
|
||||
}
|
||||
|
||||
@ -457,33 +461,13 @@ nsPersistentProperties::~nsPersistentProperties()
|
||||
PL_DHashTableFinish(&mTable);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPersistentProperties::Init()
|
||||
{
|
||||
if (!PL_DHashTableInit(&mTable, &property_HashTableOps, nullptr,
|
||||
sizeof(PropertyTableEntry), 20)) {
|
||||
mTable.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsPersistentProperties* props = new nsPersistentProperties();
|
||||
if (props == nullptr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(props);
|
||||
nsresult rv = props->Init();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = props->QueryInterface(aIID, aResult);
|
||||
|
||||
NS_RELEASE(props);
|
||||
return rv;
|
||||
nsRefPtr<nsPersistentProperties> props = new nsPersistentProperties();
|
||||
return props->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties)
|
||||
@ -513,7 +497,7 @@ nsPersistentProperties::Load(nsIInputStream *aIn)
|
||||
// We may have an unprocessed value at this point
|
||||
// if the last line did not have a proper line ending.
|
||||
if (parser.GetState() == eParserState_Value) {
|
||||
nsAutoString oldValue;
|
||||
nsAutoString oldValue;
|
||||
parser.FinishValueState(oldValue);
|
||||
}
|
||||
|
||||
@ -662,13 +646,8 @@ nsPropertyElement::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsPropertyElement* propElem = new nsPropertyElement();
|
||||
if (propElem == nullptr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(propElem);
|
||||
nsresult rv = propElem->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(propElem);
|
||||
return rv;
|
||||
nsRefPtr<nsPropertyElement> propElem = new nsPropertyElement();
|
||||
return propElem->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPropertyElement, nsIPropertyElement)
|
||||
@ -702,4 +681,3 @@ nsPropertyElement::SetValue(const nsAString& aValue)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -19,7 +19,6 @@ class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
|
||||
{
|
||||
public:
|
||||
nsPersistentProperties();
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIPROPERTIES
|
||||
|
@ -138,9 +138,9 @@ nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[], int32_t Count
|
||||
if (!mNameArray)
|
||||
return false;
|
||||
|
||||
if (!PL_DHashTableInit(&mNameTable,
|
||||
&nametable_CaseInsensitiveHashTableOps,
|
||||
nullptr, sizeof(NameTableEntry), Count)) {
|
||||
if (!PL_DHashTableInit(&mNameTable, &nametable_CaseInsensitiveHashTableOps,
|
||||
nullptr, sizeof(NameTableEntry), Count,
|
||||
fallible_t())) {
|
||||
mNameTable.ops = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
@ -404,9 +404,7 @@ nsTHashtable<EntryType>::Init(uint32_t aInitSize)
|
||||
s_InitEntry
|
||||
};
|
||||
|
||||
if (!PL_DHashTableInit(&mTable, &sOps, nullptr, sizeof(EntryType), aInitSize)) {
|
||||
NS_ABORT_OOM(sizeof(EntryType) * aInitSize);
|
||||
}
|
||||
PL_DHashTableInit(&mTable, &sOps, nullptr, sizeof(EntryType), aInitSize);
|
||||
}
|
||||
|
||||
// static definitions
|
||||
|
@ -173,7 +173,7 @@ PL_NewDHashTable(const PLDHashTableOps *ops, void *data, uint32_t entrySize,
|
||||
PLDHashTable *table = (PLDHashTable *) malloc(sizeof *table);
|
||||
if (!table)
|
||||
return nullptr;
|
||||
if (!PL_DHashTableInit(table, ops, data, entrySize, capacity)) {
|
||||
if (!PL_DHashTableInit(table, ops, data, entrySize, capacity, fallible_t())) {
|
||||
free(table);
|
||||
return nullptr;
|
||||
}
|
||||
@ -188,8 +188,9 @@ PL_DHashTableDestroy(PLDHashTable *table)
|
||||
}
|
||||
|
||||
bool
|
||||
PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
|
||||
uint32_t entrySize, uint32_t capacity)
|
||||
PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops,
|
||||
void *data, uint32_t entrySize, uint32_t capacity,
|
||||
const fallible_t& )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (entrySize > 16 * sizeof(void *)) {
|
||||
@ -232,6 +233,22 @@ PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
|
||||
uint32_t entrySize, uint32_t capacity)
|
||||
{
|
||||
if (!PL_DHashTableInit(table, ops, data, entrySize, capacity, fallible_t())) {
|
||||
if (capacity > PL_DHASH_MAX_SIZE) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
uint32_t nbytes;
|
||||
if (!SizeOfEntryStore(capacity, entrySize, &nbytes)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
NS_ABORT_OOM(nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute max and min load numbers (entry counts). We have a secondary max
|
||||
* that allows us to overload a table reasonably if it cannot be grown further
|
||||
|
@ -8,6 +8,7 @@
|
||||
/*
|
||||
* Double hashing, a la Knuth 6.
|
||||
*/
|
||||
#include "mozilla/fallible.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Types.h"
|
||||
#include "nscore.h"
|
||||
@ -399,11 +400,22 @@ PL_DHashTableDestroy(PLDHashTable *table);
|
||||
* Initialize table with ops, data, entrySize, and capacity. Capacity is a
|
||||
* guess for the smallest table size at which the table will usually be less
|
||||
* than 75% loaded (the table will grow or shrink as needed; capacity serves
|
||||
* only to avoid inevitable early growth from PL_DHASH_MIN_SIZE).
|
||||
* only to avoid inevitable early growth from PL_DHASH_MIN_SIZE). This will
|
||||
* crash if it can't allocate enough memory, or if entrySize or capacity are
|
||||
* too large.
|
||||
*/
|
||||
NS_COM_GLUE void
|
||||
PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
|
||||
uint32_t entrySize, uint32_t capacity);
|
||||
|
||||
/*
|
||||
* Initialize table. This is the same as PL_DHashTableInit, except that it
|
||||
* returns a boolean indicating success, rather than crashing on failure.
|
||||
*/
|
||||
NS_COM_GLUE bool
|
||||
PL_DHashTableInit(PLDHashTable *table, const PLDHashTableOps *ops, void *data,
|
||||
uint32_t entrySize, uint32_t capacity);
|
||||
uint32_t entrySize, uint32_t capacity,
|
||||
const mozilla::fallible_t& ) MOZ_WARN_UNUSED_RESULT;
|
||||
|
||||
/*
|
||||
* Finalize table's data, free its entry storage using table->ops->freeTable,
|
||||
|
@ -21,7 +21,8 @@ static bool test_pldhash_Init_capacity_ok()
|
||||
// platforms.
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(PLDHashEntryStub), PL_DHASH_MAX_SIZE);
|
||||
sizeof(PLDHashEntryStub), PL_DHASH_MAX_SIZE,
|
||||
mozilla::fallible_t());
|
||||
if (ok)
|
||||
PL_DHashTableFinish(&t);
|
||||
|
||||
@ -33,7 +34,8 @@ static bool test_pldhash_Init_capacity_too_large()
|
||||
// Try the smallest too-large capacity.
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(PLDHashEntryStub), PL_DHASH_MAX_SIZE + 1);
|
||||
sizeof(PLDHashEntryStub), PL_DHASH_MAX_SIZE + 1,
|
||||
mozilla::fallible_t());
|
||||
// Don't call PL_DHashTableDestroy(), it's not safe after Init failure.
|
||||
|
||||
return !ok; // expected to fail
|
||||
@ -56,7 +58,8 @@ static bool test_pldhash_Init_overflow()
|
||||
// |nullptr| for |ops| is ok because it's unused due to the failure.
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, /* ops = */nullptr, nullptr,
|
||||
sizeof(OneKBEntry), PL_DHASH_MAX_SIZE);
|
||||
sizeof(OneKBEntry), PL_DHASH_MAX_SIZE,
|
||||
mozilla::fallible_t());
|
||||
|
||||
return !ok; // expected to fail
|
||||
}
|
||||
@ -86,7 +89,8 @@ static bool test_pldhash_grow_to_max_capacity()
|
||||
};
|
||||
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, &ops, nullptr, sizeof(PLDHashEntryStub), 256);
|
||||
bool ok = PL_DHashTableInit(&t, &ops, nullptr, sizeof(PLDHashEntryStub), 256,
|
||||
mozilla::fallible_t());
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user