зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1376477 - Use Lookup instead of Get+Remove to avoid unnecessary hashtable lookups. Replace Get with Contains to avoid ref-counting. r=froydnj
MozReview-Commit-ID: G4F2pAnNA73
This commit is contained in:
Родитель
e0fc464fa9
Коммит
30c6d6295a
|
@ -44,13 +44,11 @@ nsProperties::Undefine(const char* prop)
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> value;
|
||||
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
if (auto entry = nsProperties_HashBase::Lookup(prop)) {
|
||||
entry.Remove();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Remove(prop);
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -60,8 +58,7 @@ nsProperties::Has(const char* prop, bool* result)
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> value;
|
||||
*result = nsProperties_HashBase::Get(prop, getter_AddRefs(value));
|
||||
*result = nsProperties_HashBase::Contains(prop);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче