本文整理汇总了C++中Zone::getUniqueIdInfallible方法的典型用法代码示例。如果您正苦于以下问题:C++ Zone::getUniqueIdInfallible方法的具体用法?C++ Zone::getUniqueIdInfallible怎么用?C++ Zone::getUniqueIdInfallible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::getUniqueIdInfallible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/* static */ bool
MovableCellHasher<T>::match(const Key& k, const Lookup& l)
{
// Return true if both are null or false if only one is null.
if (!k)
return !l;
if (!l)
return false;
MOZ_ASSERT(k);
MOZ_ASSERT(l);
MOZ_ASSERT(CurrentThreadCanAccessZone(l->zoneFromAnyThread()) ||
l->zoneFromAnyThread()->isSelfHostingZone());
Zone* zone = k->zoneFromAnyThread();
if (zone != l->zoneFromAnyThread())
return false;
MOZ_ASSERT(zone->hasUniqueId(k));
MOZ_ASSERT(zone->hasUniqueId(l));
// Since both already have a uid (from hash), the get is infallible.
return zone->getUniqueIdInfallible(k) == zone->getUniqueIdInfallible(l);
}
示例2:
/* static */ bool
MovableCellHasher<T>::match(const Key& k, const Lookup& l)
{
// Return true if both are null or false if only one is null.
if (!k)
return !l;
if (!l)
return false;
MOZ_ASSERT(k);
MOZ_ASSERT(l);
MOZ_ASSERT(CurrentThreadCanAccessZone(l->zoneFromAnyThread()) ||
l->zoneFromAnyThread()->isSelfHostingZone());
Zone* zone = k->zoneFromAnyThread();
if (zone != l->zoneFromAnyThread())
return false;
#ifdef DEBUG
// Incremental table sweeping means that existing table entries may no
// longer have unique IDs. We fail the match in that case and the entry is
// removed from the table later on.
if (!zone->hasUniqueId(k)) {
Key key = k;
MOZ_ASSERT(IsAboutToBeFinalizedUnbarriered(&key));
}
MOZ_ASSERT(zone->hasUniqueId(l));
#endif
uint64_t keyId;
if (!zone->maybeGetUniqueId(k, &keyId)) {
// Key is dead and cannot match lookup which must be live.
return false;
}
return keyId == zone->getUniqueIdInfallible(l);
}