Backout 91eed468cff8 (Bug 726002) due to broken error handling.

This commit is contained in:
Gian-Carlo Pascutto 2012-02-13 17:04:46 +01:00
Родитель 3264914f26
Коммит 2299271477
1 изменённых файлов: 8 добавлений и 11 удалений

Просмотреть файл

@ -174,9 +174,6 @@ nsresult
LookupCache::Build(const AddPrefixArray& aAddPrefixes,
const AddCompleteArray& aAddCompletes)
{
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_COMPLETIONS,
static_cast<PRUint32>(aAddCompletes.Length()));
mCompletions.Clear();
mCompletions.SetCapacity(aAddCompletes.Length());
for (uint32 i = 0; i < aAddCompletes.Length(); i++) {
@ -184,13 +181,16 @@ LookupCache::Build(const AddPrefixArray& aAddPrefixes,
}
mCompletions.Sort();
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_PREFIXES,
static_cast<PRUint32>(aAddPrefixes.Length()));
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_COMPLETIONS,
static_cast<PRUint32>(mCompletions.Length()));
nsresult rv = ConstructPrefixSet(aAddPrefixes);
NS_ENSURE_SUCCESS(rv, rv);
mPrimed = true;
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_PREFIXES,
static_cast<PRUint32>(aAddPrefixes.Length()));
return NS_OK;
}
@ -683,11 +683,8 @@ LookupCache::ConstructPrefixSet(const AddPrefixArray& aAddPrefixes)
{
Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_CONSTRUCT_TIME> timer;
FallibleTArray<PRUint32> array;
nsresult rv = array.SetCapacity(aAddPrefixes.Length());
if (NS_FAILED(rv)) {
goto error_bailout;
}
nsTArray<PRUint32> array;
array.SetCapacity(aAddPrefixes.Length());
for (uint32 i = 0; i < aAddPrefixes.Length(); i++) {
array.AppendElement(aAddPrefixes[i].PrefixHash().ToUint32());
@ -702,7 +699,7 @@ LookupCache::ConstructPrefixSet(const AddPrefixArray& aAddPrefixes)
array.Sort();
// construct new one, replace old entries
rv = mPrefixSet->SetPrefixes(array.Elements(), array.Length());
nsresult rv = mPrefixSet->SetPrefixes(array.Elements(), array.Length());
if (NS_FAILED(rv)) {
goto error_bailout;
}