Backout db52b4916cde (Bug 673470). rs=dcamp a=mfinkle
This commit is contained in:
@@ -182,8 +182,6 @@ Classifier::Open(nsIFile& aCacheDirectory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
RegenActiveTables();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -216,7 +214,6 @@ Classifier::Reset()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mTableFreshness.Clear();
|
||||
RegenActiveTables();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -371,7 +368,6 @@ Classifier::ApplyUpdates(nsTArray<TableUpdate*>* aUpdates)
|
||||
}
|
||||
}
|
||||
aUpdates->Clear();
|
||||
RegenActiveTables();
|
||||
LOG(("Done applying updates."));
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
@@ -409,41 +405,6 @@ Classifier::DropStores()
|
||||
mLookupCaches.Clear();
|
||||
}
|
||||
|
||||
nsresult
|
||||
Classifier::RegenActiveTables()
|
||||
{
|
||||
mActiveTablesCache.Clear();
|
||||
|
||||
nsTArray<nsCString> foundTables;
|
||||
ScanStoreDir(foundTables);
|
||||
|
||||
for (uint32 i = 0; i < foundTables.Length(); i++) {
|
||||
nsAutoPtr<HashStore> store(new HashStore(nsCString(foundTables[i]), mStoreDirectory));
|
||||
if (!store)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = store->Open();
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
LookupCache *lookupCache = GetLookupCache(store->TableName());
|
||||
if (!lookupCache) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const ChunkSet &adds = store->AddChunks();
|
||||
const ChunkSet &subs = store->SubChunks();
|
||||
|
||||
if (adds.Length() == 0 && subs.Length() == 0)
|
||||
continue;
|
||||
|
||||
LOG(("Active table: %s", store->TableName().get()));
|
||||
mActiveTablesCache.AppendElement(store->TableName());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Classifier::ScanStoreDir(nsTArray<nsCString>& aTables)
|
||||
{
|
||||
@@ -477,7 +438,35 @@ Classifier::ScanStoreDir(nsTArray<nsCString>& aTables)
|
||||
nsresult
|
||||
Classifier::ActiveTables(nsTArray<nsCString>& aTables)
|
||||
{
|
||||
aTables = mActiveTablesCache;
|
||||
aTables.Clear();
|
||||
|
||||
nsTArray<nsCString> foundTables;
|
||||
ScanStoreDir(foundTables);
|
||||
|
||||
for (uint32 i = 0; i < foundTables.Length(); i++) {
|
||||
nsAutoPtr<HashStore> store(new HashStore(nsCString(foundTables[i]), mStoreDirectory));
|
||||
if (!store)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = store->Open();
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
LookupCache *lookupCache = GetLookupCache(store->TableName());
|
||||
if (!lookupCache) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const ChunkSet &adds = store->AddChunks();
|
||||
const ChunkSet &subs = store->SubChunks();
|
||||
|
||||
if (adds.Length() == 0 && subs.Length() == 0)
|
||||
continue;
|
||||
|
||||
LOG(("Active table: %s", store->TableName().get()));
|
||||
aTables.AppendElement(store->TableName());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user