diff --git a/toolkit/components/url-classifier/LookupCache.cpp b/toolkit/components/url-classifier/LookupCache.cpp index 7f86398e1459..9702385b68ab 100644 --- a/toolkit/components/url-classifier/LookupCache.cpp +++ b/toolkit/components/url-classifier/LookupCache.cpp @@ -174,9 +174,6 @@ nsresult LookupCache::Build(const AddPrefixArray& aAddPrefixes, const AddCompleteArray& aAddCompletes) { - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_COMPLETIONS, - static_cast(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(aAddPrefixes.Length())); + Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_COMPLETIONS, + static_cast(mCompletions.Length())); nsresult rv = ConstructPrefixSet(aAddPrefixes); NS_ENSURE_SUCCESS(rv, rv); mPrimed = true; + Telemetry::Accumulate(Telemetry::URLCLASSIFIER_LC_PREFIXES, + static_cast(aAddPrefixes.Length())); + return NS_OK; } @@ -683,11 +683,8 @@ LookupCache::ConstructPrefixSet(const AddPrefixArray& aAddPrefixes) { Telemetry::AutoTimer timer; - FallibleTArray array; - nsresult rv = array.SetCapacity(aAddPrefixes.Length()); - if (NS_FAILED(rv)) { - goto error_bailout; - } + nsTArray 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; }