mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1547351
- add IsEmpty and fix OrInsert signature for nsBaseHashtable. r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D38597 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c6d6d1dfde
commit
57498bb3b4
@ -203,7 +203,7 @@ void nsFrameMessageManager::AddMessageListener(const nsAString& aMessageName,
|
||||
MessageListener& aListener,
|
||||
bool aListenWhenClosed,
|
||||
ErrorResult& aError) {
|
||||
auto listeners = mListeners.LookupForAdd(aMessageName).OrInsert([]() {
|
||||
auto& listeners = mListeners.LookupForAdd(aMessageName).OrInsert([]() {
|
||||
return new nsAutoTObserverArray<nsMessageListenerInfo, 1>();
|
||||
});
|
||||
uint32_t len = listeners->Length();
|
||||
@ -272,7 +272,7 @@ void nsFrameMessageManager::AddWeakMessageListener(
|
||||
}
|
||||
#endif
|
||||
|
||||
auto listeners = mListeners.LookupForAdd(aMessageName).OrInsert([]() {
|
||||
auto& listeners = mListeners.LookupForAdd(aMessageName).OrInsert([]() {
|
||||
return new nsAutoTObserverArray<nsMessageListenerInfo, 1>();
|
||||
});
|
||||
uint32_t len = listeners->Length();
|
||||
|
@ -71,6 +71,12 @@ class nsBaseHashtable
|
||||
*/
|
||||
uint32_t Count() const { return nsTHashtable<EntryType>::Count(); }
|
||||
|
||||
/**
|
||||
* Return whether the table is empty.
|
||||
* @return whether empty
|
||||
*/
|
||||
bool IsEmpty() const { return nsTHashtable<EntryType>::IsEmpty(); }
|
||||
|
||||
/**
|
||||
* retrieve the value for a key.
|
||||
* @param aKey the key to retreive
|
||||
@ -286,7 +292,7 @@ class nsBaseHashtable
|
||||
}
|
||||
|
||||
template <class F>
|
||||
UserDataType OrInsert(F func) {
|
||||
DataType& OrInsert(F func) {
|
||||
MOZ_ASSERT(mTableGeneration == mTable.GetGeneration());
|
||||
MOZ_ASSERT(mEntry);
|
||||
if (!mExistingEntry) {
|
||||
|
Loading…
Reference in New Issue
Block a user