本文整理汇总了C++中XPCNativeSet::GetInterfaceArray方法的典型用法代码示例。如果您正苦于以下问题:C++ XPCNativeSet::GetInterfaceArray方法的具体用法?C++ XPCNativeSet::GetInterfaceArray怎么用?C++ XPCNativeSet::GetInterfaceArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPCNativeSet
的用法示例。
在下文中一共展示了XPCNativeSet::GetInterfaceArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ccx
static bool
XPC_WN_Shared_Proto_Enumerate(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
if (!self)
return false;
XPCNativeSet* set = self->GetSet();
if (!set)
return false;
XPCCallContext ccx(cx);
if (!ccx.IsValid())
return false;
uint16_t interface_count = set->GetInterfaceCount();
XPCNativeInterface** interfaceArray = set->GetInterfaceArray();
for (uint16_t i = 0; i < interface_count; i++) {
XPCNativeInterface* iface = interfaceArray[i];
uint16_t member_count = iface->GetMemberCount();
for (uint16_t k = 0; k < member_count; k++) {
if (!xpc_ForcePropertyResolve(cx, obj, iface->GetMemberAt(k)->GetName()))
return false;
}
}
return true;
}
示例2: return
bool
NativeSetMap::Entry::Match(const PLDHashEntryHdr* entry, const void* key)
{
auto Key = static_cast<const XPCNativeSetKey*>(key);
XPCNativeSet* SetInTable = ((Entry*)entry)->key_value;
XPCNativeSet* Set = Key->GetBaseSet();
XPCNativeInterface* Addition = Key->GetAddition();
if (!Set) {
// This is a special case to deal with the invariant that says:
// "All sets have exactly one nsISupports interface and it comes first."
// See XPCNativeSet::NewInstance for details.
//
// Though we might have a key that represents only one interface, we
// know that if that one interface were contructed into a set then
// it would end up really being a set with two interfaces (except for
// the case where the one interface happened to be nsISupports).
return (SetInTable->GetInterfaceCount() == 1 &&
SetInTable->GetInterfaceAt(0) == Addition) ||
(SetInTable->GetInterfaceCount() == 2 &&
SetInTable->GetInterfaceAt(1) == Addition);
}
if (!Addition && Set == SetInTable)
return true;
uint16_t count = Set->GetInterfaceCount();
if (count + (Addition ? 1 : 0) != SetInTable->GetInterfaceCount())
return false;
XPCNativeInterface** CurrentInTable = SetInTable->GetInterfaceArray();
XPCNativeInterface** Current = Set->GetInterfaceArray();
for (uint16_t i = 0; i < count; i++) {
if (*(Current++) != *(CurrentInTable++))
return false;
}
return !Addition || Addition == *(CurrentInTable++);
}