Bug 1333328 - Remove mTableFreshness and gFreshnessGuarantee. r=francois

Functions and Preference related to mTableFreshness and gFreshnessGuarantee
could be removed since we will no longer require them.

MozReview-Commit-ID: IAa0UHLSQ56
This commit is contained in:
DimiL
2017-05-04 11:13:21 +08:00
parent a0b8501692
commit 769f299a32
8 changed files with 3 additions and 139 deletions

View File

@@ -292,7 +292,6 @@ Classifier::Reset()
CreateStoreDirectory();
mTableFreshness.Clear();
RegenActiveTables();
};
@@ -311,8 +310,6 @@ Classifier::ResetTables(ClearType aType, const nsTArray<nsCString>& aTables)
{
for (uint32_t i = 0; i < aTables.Length(); i++) {
LOG(("Resetting table: %s", aTables[i].get()));
// Spoil this table by marking it as no known freshness
mTableFreshness.Remove(aTables[i]);
LookupCache *cache = GetLookupCache(aTables[i]);
if (cache) {
// Remove any cached Completes for this table if clear type is Clear_Cache
@@ -619,8 +616,6 @@ Classifier::RemoveUpdateIntermediaries()
}
mNewLookupCaches.Clear();
mNewTableFreshness.Clear();
// Remove the "old" directory. (despite its looking-new name)
if (NS_FAILED(mUpdatingDirectory->Remove(true))) {
// If the directory is locked from removal for some reason,
@@ -685,21 +680,16 @@ Classifier::SwapInNewTablesAndCleanup()
// up later.
MergeNewLookupCaches();
// Step 3. Merge mTableFreshnessForUpdate.
for (auto itr = mNewTableFreshness.ConstIter(); !itr.Done(); itr.Next()) {
mTableFreshness.Put(itr.Key(), itr.Data());
}
// Step 4. Re-generate active tables based on on-disk tables.
// Step 3. Re-generate active tables based on on-disk tables.
rv = RegenActiveTables();
if (NS_FAILED(rv)) {
LOG(("Failed to re-generate active tables!"));
}
// Step 5. Clean up intermediaries for update.
// Step 4. Clean up intermediaries for update.
RemoveUpdateIntermediaries();
// Step 6. Invalidate cached tableRequest request.
// Step 5. Invalidate cached tableRequest request.
mIsTableRequestResultOutdated = true;
LOG(("Done swap in updated tables."));
@@ -895,23 +885,6 @@ Classifier::ApplyFullHashes(nsTArray<TableUpdate*>* aUpdates)
return NS_OK;
}
int64_t
Classifier::GetLastUpdateTime(const nsACString& aTableName)
{
int64_t age;
bool found = mTableFreshness.Get(aTableName, &age);
return found ? (age * PR_MSEC_PER_SEC) : 0;
}
void
Classifier::SetLastUpdateTime(const nsACString &aTable,
uint64_t updateTime)
{
LOG(("Marking table %s as last updated on %" PRIu64,
PromiseFlatCString(aTable).get(), updateTime));
mTableFreshness.Put(aTable, updateTime / PR_MSEC_PER_SEC);
}
void
Classifier::DropStores()
{
@@ -1302,9 +1275,7 @@ Classifier::UpdateHashStore(nsTArray<TableUpdate*>* aUpdates,
rv = lookupCache->WriteFile();
NS_ENSURE_SUCCESS(rv, NS_ERROR_UC_UPDATE_FAIL_TO_WRITE_DISK);
int64_t now = (PR_Now() / PR_USEC_PER_SEC);
LOG(("Successfully updated %s", store.TableName().get()));
mNewTableFreshness.Put(store.TableName(), now);
return NS_OK;
}
@@ -1403,10 +1374,7 @@ Classifier::UpdateTableV4(nsTArray<TableUpdate*>* aUpdates,
NS_ENSURE_SUCCESS(rv, NS_ERROR_UC_UPDATE_FAIL_TO_WRITE_DISK);
}
int64_t now = (PR_Now() / PR_USEC_PER_SEC);
LOG(("Successfully updated %s\n", PromiseFlatCString(aTable).get()));
mNewTableFreshness.Put(aTable, now);
return NS_OK;
}