mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1336909 - Restrict URLCLASSIFIER_PREFIX_MATCH to profiles that have working V4. r=francois
MozReview-Commit-ID: L3lKgiohalH --HG-- extra : rebase_source : 1ac11242c4db4b129fdb316deee92dd514b65f49
This commit is contained in:
parent
e08f101402
commit
1f53a466a3
@ -452,6 +452,16 @@ Classifier::Check(const nsACString& aSpec,
|
||||
}
|
||||
}
|
||||
|
||||
// Only record telemetry when both v2 and v4 have data.
|
||||
bool isV2Empty = true, isV4Empty = true;
|
||||
for (auto&& cache : cacheArray) {
|
||||
bool& ref = LookupCache::Cast<LookupCacheV2>(cache) ? isV2Empty : isV4Empty;
|
||||
ref = ref ? cache->IsEmpty() : false;
|
||||
if (!isV2Empty && !isV4Empty) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PrefixMatch matchingStatistics = PrefixMatch::eNoMatch;
|
||||
|
||||
// Now check each lookup fragment against the entries in the DB.
|
||||
@ -506,8 +516,10 @@ Classifier::Check(const nsACString& aSpec,
|
||||
}
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_PREFIX_MATCH,
|
||||
static_cast<uint8_t>(matchingStatistics));
|
||||
if (!isV2Empty && !isV4Empty) {
|
||||
Telemetry::Accumulate(Telemetry::URLCLASSIFIER_PREFIX_MATCH,
|
||||
static_cast<uint8_t>(matchingStatistics));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -470,6 +470,14 @@ LookupCacheV2::IsHashEntryConfirmed(const Completion& aEntry,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LookupCacheV2::IsEmpty()
|
||||
{
|
||||
bool isEmpty;
|
||||
mPrefixSet->IsEmpty(&isEmpty);
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
nsresult
|
||||
LookupCacheV2::Build(AddPrefixArray& aAddPrefixes,
|
||||
AddCompleteArray& aAddCompletes)
|
||||
|
@ -148,6 +148,8 @@ public:
|
||||
uint32_t aFreshnessGuarantee,
|
||||
bool* aConfirmed) = 0;
|
||||
|
||||
virtual bool IsEmpty() = 0;
|
||||
|
||||
virtual void ClearAll();
|
||||
|
||||
template<typename T>
|
||||
@ -200,6 +202,8 @@ public:
|
||||
uint32_t aFreshnessGuarantee,
|
||||
bool* aConfirmed) override;
|
||||
|
||||
virtual bool IsEmpty() override;
|
||||
|
||||
nsresult Build(AddPrefixArray& aAddPrefixes,
|
||||
AddCompleteArray& aAddCompletes);
|
||||
|
||||
|
@ -117,6 +117,14 @@ LookupCacheV4::IsHashEntryConfirmed(const Completion& aEntry,
|
||||
*aConfirmed = true;
|
||||
}
|
||||
|
||||
bool
|
||||
LookupCacheV4::IsEmpty()
|
||||
{
|
||||
bool isEmpty;
|
||||
mVLPrefixSet->IsEmpty(&isEmpty);
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
nsresult
|
||||
LookupCacheV4::Build(PrefixStringMap& aPrefixMap)
|
||||
{
|
||||
|
@ -33,6 +33,8 @@ public:
|
||||
uint32_t aFreshnessGuarantee,
|
||||
bool* aConfirmed) override;
|
||||
|
||||
virtual bool IsEmpty() override;
|
||||
|
||||
nsresult Build(PrefixStringMap& aPrefixMap);
|
||||
|
||||
nsresult GetPrefixes(PrefixStringMap& aPrefixMap);
|
||||
|
Loading…
Reference in New Issue
Block a user