зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1434206 - Make LookupCache objects const as much as possible. r=gcp
MozReview-Commit-ID: AqC6NUh6ifm --HG-- extra : rebase_source : a125989490e7988021215f47d17d3cb3b0303651
This commit is contained in:
Родитель
8f19e9f805
Коммит
5a2649faf7
|
@ -873,7 +873,7 @@ void
|
|||
Classifier::GetCacheInfo(const nsACString& aTable,
|
||||
nsIUrlClassifierCacheInfo** aCache)
|
||||
{
|
||||
RefPtr<LookupCache> lookupCache = GetLookupCache(aTable);
|
||||
RefPtr<const LookupCache> lookupCache = GetLookupCache(aTable);
|
||||
if (!lookupCache) {
|
||||
return;
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ Classifier::RegenActiveTables()
|
|||
for (uint32_t i = 0; i < foundTables.Length(); i++) {
|
||||
nsCString table(foundTables[i]);
|
||||
|
||||
RefPtr<LookupCache> lookupCache = GetLookupCache(table);
|
||||
RefPtr<const LookupCache> lookupCache = GetLookupCache(table);
|
||||
if (!lookupCache) {
|
||||
LOG(("Inactive table (no cache): %s", table.get()));
|
||||
continue;
|
||||
|
@ -909,7 +909,7 @@ Classifier::RegenActiveTables()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (LookupCache::Cast<LookupCacheV4>(lookupCache)) {
|
||||
if (LookupCache::Cast<const LookupCacheV4>(lookupCache)) {
|
||||
LOG(("Active v4 table: %s", table.get()));
|
||||
} else {
|
||||
HashStore store(table, GetProvider(table), mRootStoreDirectory);
|
||||
|
|
|
@ -243,7 +243,7 @@ LookupCache::ClearAll()
|
|||
}
|
||||
|
||||
void
|
||||
LookupCache::GetCacheInfo(nsIUrlClassifierCacheInfo** aCache)
|
||||
LookupCache::GetCacheInfo(nsIUrlClassifierCacheInfo** aCache) const
|
||||
{
|
||||
MOZ_ASSERT(aCache);
|
||||
|
||||
|
@ -508,7 +508,7 @@ nsCString GetFormattedTimeString(int64_t aCurTimeSec)
|
|||
}
|
||||
|
||||
void
|
||||
LookupCache::DumpCache()
|
||||
LookupCache::DumpCache() const
|
||||
{
|
||||
if (!LOG_ENABLED()) {
|
||||
return;
|
||||
|
@ -778,7 +778,7 @@ LookupCacheV2::ConstructPrefixSet(AddPrefixArray& aAddPrefixes)
|
|||
|
||||
#if defined(DEBUG)
|
||||
void
|
||||
LookupCacheV2::DumpCompletions()
|
||||
LookupCacheV2::DumpCompletions() const
|
||||
{
|
||||
if (!LOG_ENABLED())
|
||||
return;
|
||||
|
|
|
@ -212,10 +212,10 @@ public:
|
|||
bool IsInCache(uint32_t key) const { return mFullHashCache.Get(key); };
|
||||
|
||||
#if DEBUG
|
||||
void DumpCache();
|
||||
void DumpCache() const;
|
||||
#endif
|
||||
|
||||
void GetCacheInfo(nsIUrlClassifierCacheInfo** aCache);
|
||||
void GetCacheInfo(nsIUrlClassifierCacheInfo** aCache) const;
|
||||
|
||||
virtual nsresult Open();
|
||||
virtual nsresult Init() = 0;
|
||||
|
@ -233,6 +233,10 @@ public:
|
|||
static T* Cast(LookupCache* aThat) {
|
||||
return ((aThat && T::VER == aThat->Ver()) ? reinterpret_cast<T*>(aThat) : nullptr);
|
||||
}
|
||||
template<typename T>
|
||||
static const T* Cast(const LookupCache* aThat) {
|
||||
return ((aThat && T::VER == aThat->Ver()) ? reinterpret_cast<const T*>(aThat) : nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
nsresult LoadPrefixSet();
|
||||
|
@ -297,7 +301,7 @@ public:
|
|||
int64_t aExpirySec = 0);
|
||||
|
||||
#if DEBUG
|
||||
void DumpCompletions();
|
||||
void DumpCompletions() const;
|
||||
#endif
|
||||
|
||||
static const int VER;
|
||||
|
|
Загрузка…
Ссылка в новой задаче