Backout 91eed468cff8 (Bug 726002) due to broken error handling.
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Mon, 13 Feb 2012 17:04:46 +0100
changeset 86727 442b3399ff1a7a4e7b7f54643714675e3c5d29ae
parent 86726 bd04ba7c9996460fd6c83f6afb2c5047612d0082
child 86728 8609c5263f73a03a177677149a837c8cb53b97fb
push idunknown
push userunknown
push dateunknown
bugs726002
milestone13.0a1
backs out91eed468cff8ac7a39af869a53236d4da3393986
Backout 91eed468cff8 (Bug 726002) due to broken error handling.
toolkit/components/url-classifier/LookupCache.cpp
--- a/toolkit/components/url-classifier/LookupCache.cpp
+++ b/toolkit/components/url-classifier/LookupCache.cpp
@@ -169,33 +169,33 @@ LookupCache::Reset()
   return NS_OK;
 }
 
 
 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++) {
     mCompletions.AppendElement(aAddCompletes[i].CompleteHash());
   }
   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;
 }
 
 #if defined(DEBUG) && defined(PR_LOGGING)
 void
 LookupCache::Dump()
 {
   if (!LOG_ENABLED())
@@ -678,36 +678,33 @@ bool LookupCache::IsPrimed()
   return mPrimed;
 }
 
 nsresult
 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());
   }
 
   // clear old tree
   if (array.IsEmpty()) {
     // DB is empty, but put a sentinel to show that we looked
     array.AppendElement(0);
   }
   // PrefixSet requires sorted order
   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;
   }
 
 #ifdef DEBUG
   PRUint32 size;
   size = mPrefixSet->SizeOfIncludingThis(moz_malloc_size_of);
   LOG(("SB tree done, size = %d bytes\n", size));