Bug 1531354 - P4. Skip reading hashstore in RegenActiveTables. r=gcp

For Safe Browsing V2, Data for lookup(LookupCache) and data for update(HashStore)
are now separated. |RegenActiveTables| doesn't need to check the chunk
number in HashStore.

Differential Revision: https://phabricator.services.mozilla.com/D34575

--HG--
extra : moz-landing-system : lando
This commit is contained in:
dlee 2019-06-21 23:11:06 +00:00
Родитель b57c5c8716
Коммит 82f987f7c9
1 изменённых файлов: 6 добавлений и 23 удалений

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

@ -861,11 +861,10 @@ nsresult Classifier::RegenActiveTables() {
mActiveTablesCache.Clear();
nsTArray<nsCString> foundTables;
ScanStoreDir(mRootStoreDirectory, foundTables);
for (uint32_t i = 0; i < foundTables.Length(); i++) {
nsCString table(foundTables[i]);
nsresult rv = ScanStoreDir(mRootStoreDirectory, foundTables);
Unused << NS_WARN_IF(NS_FAILED(rv));
for (const auto& table : foundTables) {
RefPtr<const LookupCache> lookupCache = GetLookupCache(table);
if (!lookupCache) {
LOG(("Inactive table (no cache): %s", table.get()));
@ -877,25 +876,9 @@ nsresult Classifier::RegenActiveTables() {
continue;
}
if (LookupCache::Cast<const LookupCacheV4>(lookupCache)) {
LOG(("Active v4 table: %s", table.get()));
} else {
HashStore store(table, GetProvider(table), mRootStoreDirectory);
nsresult rv = store.Open();
if (NS_FAILED(rv)) {
continue;
}
const ChunkSet& adds = store.AddChunks();
const ChunkSet& subs = store.SubChunks();
if (adds.Length() == 0 && subs.Length() == 0) {
continue;
}
LOG(("Active v2 table: %s", store.TableName().get()));
}
LOG(("Active %s table: %s",
LookupCache::Cast<const LookupCacheV4>(lookupCache) ? "v4" : "v2",
table.get()));
mActiveTablesCache.AppendElement(table);
}