Backed out changeset 77d3d487c68d (bug 943021) for bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 06 Jan 2014 10:39:00 -0500
changeset 162237 c467462fae8e0fb61578c19646f16f5998dc423f
parent 162236 2068b0f801c9e3d680aeff54bddcaddebab13624
child 162238 1a5a6071b1a3a392ae7b7889c4c9cf1590ded1d9
push id25941
push userkwierso@gmail.com
push dateTue, 07 Jan 2014 01:20:54 +0000
treeherdermozilla-central@ce917d3dd7c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs943021
milestone29.0a1
backs out77d3d487c68d98f4e984d78046312c6d265eb2b9
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 77d3d487c68d (bug 943021) for bustage. CLOSED TREE
toolkit/components/url-classifier/Entries.h
toolkit/components/url-classifier/HashStore.cpp
--- a/toolkit/components/url-classifier/Entries.h
+++ b/toolkit/components/url-classifier/Entries.h
@@ -235,20 +235,20 @@ struct SubComplete {
     if (cmp != 0)
       return cmp;
     if (addChunk != aOther.addChunk)
       return addChunk - aOther.addChunk;
     return subChunk - aOther.subChunk;
   }
 };
 
-typedef FallibleTArray<AddPrefix>   AddPrefixArray;
-typedef FallibleTArray<AddComplete> AddCompleteArray;
-typedef FallibleTArray<SubPrefix>   SubPrefixArray;
-typedef FallibleTArray<SubComplete> SubCompleteArray;
+typedef nsTArray<AddPrefix>   AddPrefixArray;
+typedef nsTArray<AddComplete> AddCompleteArray;
+typedef nsTArray<SubPrefix>   SubPrefixArray;
+typedef nsTArray<SubComplete> SubCompleteArray;
 
 /**
  * Compares chunks by their add chunk, then their prefix.
  */
 template<class T>
 class EntryCompare {
 public:
   typedef T elem_type;
@@ -259,41 +259,41 @@ public:
   }
 };
 
 /**
  * Sort an array of store entries.  nsTArray::Sort uses Equal/LessThan
  * to sort, this does a single Compare so it's a bit quicker over the
  * large sorts we do.
  */
-template<class T, class Alloc>
+template<class T>
 void
-EntrySort(nsTArray_Impl<T, Alloc>& aArray)
+EntrySort(nsTArray<T>& aArray)
 {
   qsort(aArray.Elements(), aArray.Length(), sizeof(T),
         EntryCompare<T>::Compare);
 }
 
-template<class T, class Alloc>
+template<class T>
 nsresult
-ReadTArray(nsIInputStream* aStream, nsTArray_Impl<T, Alloc>* aArray, uint32_t aNumElements)
+ReadTArray(nsIInputStream* aStream, nsTArray<T>* aArray, uint32_t aNumElements)
 {
   if (!aArray->SetLength(aNumElements))
     return NS_ERROR_OUT_OF_MEMORY;
 
   void *buffer = aArray->Elements();
   nsresult rv = NS_ReadInputStreamToBuffer(aStream, &buffer,
                                            (aNumElements * sizeof(T)));
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
 
-template<class T, class Alloc>
+template<class T>
 nsresult
-WriteTArray(nsIOutputStream* aStream, nsTArray_Impl<T, Alloc>& aArray)
+WriteTArray(nsIOutputStream* aStream, nsTArray<T>& aArray)
 {
   uint32_t written;
   return aStream->Write(reinterpret_cast<char*>(aArray.Elements()),
                         aArray.Length() * sizeof(T),
                         &written);
 }
 
 } // namespace safebrowsing
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -428,19 +428,19 @@ HashStore::BeginUpdate()
   mInUpdate = true;
 
   return NS_OK;
 }
 
 template<class T>
 static nsresult
 Merge(ChunkSet* aStoreChunks,
-      FallibleTArray<T>* aStorePrefixes,
+      nsTArray<T>* aStorePrefixes,
       ChunkSet& aUpdateChunks,
-      FallibleTArray<T>& aUpdatePrefixes,
+      nsTArray<T>& aUpdatePrefixes,
       bool aAllowMerging = false)
 {
   EntrySort(aUpdatePrefixes);
 
   T* updateIter = aUpdatePrefixes.Elements();
   T* updateEnd = aUpdatePrefixes.Elements() + aUpdatePrefixes.Length();
 
   T* storeIter = aStorePrefixes->Elements();
@@ -533,17 +533,17 @@ HashStore::ClearCompletes()
   mAddCompletes.Clear();
   mSubCompletes.Clear();
 
   UpdateHeader();
 }
 
 template<class T>
 static void
-ExpireEntries(FallibleTArray<T>* aEntries, ChunkSet& aExpirations)
+ExpireEntries(nsTArray<T>* aEntries, ChunkSet& aExpirations)
 {
   T* addIter = aEntries->Elements();
   T* end = aEntries->Elements() + aEntries->Length();
 
   for (T *iter = addIter; iter != end; iter++) {
     if (!aExpirations.Has(iter->Chunk())) {
       *addIter = *iter;
       addIter++;
@@ -570,20 +570,18 @@ HashStore::Expire()
   return NS_OK;
 }
 
 template<class T>
 nsresult DeflateWriteTArray(nsIOutputStream* aStream, nsTArray<T>& aIn)
 {
   uLongf insize = aIn.Length() * sizeof(T);
   uLongf outsize = compressBound(insize);
-  FallibleTArray<char> outBuff;
-  if (!outBuff.SetLength(outsize)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  nsTArray<char> outBuff;
+  outBuff.SetLength(outsize);
 
   int zerr = compress(reinterpret_cast<Bytef*>(outBuff.Elements()),
                       &outsize,
                       reinterpret_cast<const Bytef*>(aIn.Elements()),
                       insize);
   if (zerr != Z_OK) {
     return NS_ERROR_FAILURE;
   }
@@ -713,19 +711,17 @@ nsresult
 HashStore::ReadAddPrefixes()
 {
   FallibleTArray<uint32_t> chunks;
   uint32_t count = mHeader.numAddPrefixes;
 
   nsresult rv = ByteSliceRead(mInputStream, &chunks, count);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (!mAddPrefixes.SetCapacity(count)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  mAddPrefixes.SetCapacity(count);
   for (uint32_t i = 0; i < count; i++) {
     AddPrefix *add = mAddPrefixes.AppendElement();
     add->prefix.FromUint32(0);
     add->addChunk = chunks[i];
   }
 
   return NS_OK;
 }
@@ -742,19 +738,17 @@ HashStore::ReadSubPrefixes()
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = ByteSliceRead(mInputStream, &subchunks, count);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = ByteSliceRead(mInputStream, &prefixes, count);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (!mSubPrefixes.SetCapacity(count)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  mSubPrefixes.SetCapacity(count);
   for (uint32_t i = 0; i < count; i++) {
     SubPrefix *sub = mSubPrefixes.AppendElement();
     sub->addChunk = addchunks[i];
     sub->prefix.FromUint32(prefixes[i]);
     sub->subChunk = subchunks[i];
   }
 
   return NS_OK;
@@ -853,17 +847,17 @@ HashStore::WriteFile()
   rv = safeOut->Finish();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 template <class T>
 static void
-Erase(FallibleTArray<T>* array, T* iterStart, T* iterEnd)
+Erase(nsTArray<T>* array, T* iterStart, T* iterEnd)
 {
   uint32_t start = iterStart - array->Elements();
   uint32_t count = iterEnd - iterStart;
 
   if (count > 0) {
     array->RemoveElementsAt(start, count);
   }
 }
@@ -873,17 +867,17 @@ Erase(FallibleTArray<T>* array, T* iterS
 // copies, the inputs are processing in parallel, so |subs| and |adds|
 // should be compatibly ordered (either by SBAddPrefixLess or
 // SBAddPrefixHashLess).
 //
 // |predAS| provides add < sub, |predSA| provides sub < add, for the
 // tightest compare appropriate (see calls in SBProcessSubs).
 template<class TSub, class TAdd>
 static void
-KnockoutSubs(FallibleTArray<TSub>* aSubs, FallibleTArray<TAdd>* aAdds)
+KnockoutSubs(nsTArray<TSub>* aSubs, nsTArray<TAdd>* aAdds)
 {
   // Keep a pair of output iterators for writing kept items.  Due to
   // deletions, these may lag the main iterators.  Using erase() on
   // individual items would result in O(N^2) copies.  Using a list
   // would work around that, at double or triple the memory cost.
   TAdd* addOut = aAdds->Elements();
   TAdd* addIter = aAdds->Elements();
 
@@ -916,17 +910,17 @@ KnockoutSubs(FallibleTArray<TSub>* aSubs
   Erase(aAdds, addOut, addIter);
   Erase(aSubs, subOut, subIter);
 }
 
 // Remove items in |removes| from |fullHashes|.  |fullHashes| and
 // |removes| should be ordered by SBAddPrefix component.
 template <class T>
 static void
-RemoveMatchingPrefixes(const SubPrefixArray& aSubs, FallibleTArray<T>* aFullHashes)
+RemoveMatchingPrefixes(const SubPrefixArray& aSubs, nsTArray<T>* aFullHashes)
 {
   // Where to store kept items.
   T* out = aFullHashes->Elements();
   T* hashIter = out;
   T* hashEnd = aFullHashes->Elements() + aFullHashes->Length();
 
   SubPrefix const * removeIter = aSubs.Elements();
   SubPrefix const * removeEnd = aSubs.Elements() + aSubs.Length();