Bug 1312339 - LookupResult to support variable length partial hash. r=francois

MozReview-Commit-ID: DKwNCNKJAW
This commit is contained in:
Henry Chang
2016-12-16 14:34:32 +08:00
parent d5ec95208d
commit b9d5f5080f
7 changed files with 68 additions and 41 deletions

View File

@@ -421,9 +421,11 @@ LookupCacheV2::ClearAll()
nsresult
LookupCacheV2::Has(const Completion& aCompletion,
bool* aHas, bool* aComplete)
bool* aHas, bool* aComplete,
uint32_t* aMatchLength)
{
*aHas = *aComplete = false;
*aMatchLength = 0;
uint32_t prefix = aCompletion.ToUint32();
@@ -435,6 +437,7 @@ LookupCacheV2::Has(const Completion& aCompletion,
if (found) {
*aHas = true;
*aMatchLength = PREFIX_SIZE;
}
if ((mGetHashCache.BinaryIndexOf(aCompletion) != nsTArray<Completion>::NoIndex) ||
@@ -442,6 +445,7 @@ LookupCacheV2::Has(const Completion& aCompletion,
LOG(("Complete in %s", mTableName.get()));
*aComplete = true;
*aHas = true;
*aMatchLength = COMPLETE_SIZE;
}
return NS_OK;