Backed out changeset 77d3d487c68d (bug 943021) for bustage.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-01-06 10:39:00 -05:00
Родитель 6d74ecbafb
Коммит 48287b7b55
2 изменённых файлов: 20 добавлений и 26 удалений

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

@ -240,10 +240,10 @@ struct SubComplete {
}
};
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.
@ -264,17 +264,17 @@ public:
* 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;
@ -286,9 +286,9 @@ ReadTArray(nsIInputStream* aStream, nsTArray_Impl<T, Alloc>* aArray, uint32_t aN
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()),

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

@ -433,9 +433,9 @@ HashStore::BeginUpdate()
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);
@ -538,7 +538,7 @@ HashStore::ClearCompletes()
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();
@ -575,10 +575,8 @@ 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,
@ -718,9 +716,7 @@ HashStore::ReadAddPrefixes()
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);
@ -747,9 +743,7 @@ HashStore::ReadSubPrefixes()
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];
@ -858,7 +852,7 @@ HashStore::WriteFile()
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;
@ -878,7 +872,7 @@ Erase(FallibleTArray<T>* array, T* iterStart, T* iterEnd)
// 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
@ -921,7 +915,7 @@ KnockoutSubs(FallibleTArray<TSub>* aSubs, FallibleTArray<TAdd>* aAdds)
// |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();