Bug 1315097 - Build the provider dictionary on the main thread to be used everywhere. r=francois,gcp

MozReview-Commit-ID: Ft1deSNKuVB
This commit is contained in:
Henry Chang
2016-11-04 17:54:05 +08:00
parent 944046ef21
commit 7f94b8915f
15 changed files with 225 additions and 113 deletions

View File

@@ -42,9 +42,12 @@ namespace safebrowsing {
const int LookupCacheV2::VER = 2;
LookupCache::LookupCache(const nsACString& aTableName, nsIFile* aRootStoreDir)
LookupCache::LookupCache(const nsACString& aTableName,
const nsACString& aProvider,
nsIFile* aRootStoreDir)
: mPrimed(false)
, mTableName(aTableName)
, mProvider(aProvider)
, mRootStoreDirectory(aRootStoreDir)
{
UpdateRootDirHandle(mRootStoreDirectory);
@@ -72,6 +75,7 @@ LookupCache::UpdateRootDirHandle(nsIFile* aNewRootStoreDirectory)
rv = Classifier::GetPrivateStoreDirectory(mRootStoreDirectory,
mTableName,
mProvider,
getter_AddRefs(mStoreDirectory));
if (NS_FAILED(rv)) {
@@ -478,7 +482,7 @@ LookupCacheV2::GetPrefixes(FallibleTArray<uint32_t>& aAddPrefixes)
nsresult
LookupCacheV2::ReadCompletions()
{
HashStore store(mTableName, mRootStoreDirectory);
HashStore store(mTableName, mProvider, mRootStoreDirectory);
nsresult rv = store.Open();
NS_ENSURE_SUCCESS(rv, rv);