本文整理汇总了C++中nsCOMArray::AppendElement方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMArray::AppendElement方法的具体用法?C++ nsCOMArray::AppendElement怎么用?C++ nsCOMArray::AppendElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMArray
的用法示例。
在下文中一共展示了nsCOMArray::AppendElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
inDOMView::AppendKidsToArray(nsINodeList* aKids,
nsCOMArray<nsIDOMNode>& aArray)
{
for (uint32_t i = 0, len = aKids->Length(); i < len; ++i) {
nsIContent* kid = aKids->Item(i);
uint16_t nodeType = kid->NodeType();
NS_ASSERTION(nodeType && nodeType <= nsINode::NOTATION_NODE,
"Unknown node type. "
"Were new types added to the spec?");
// As of DOM Level 2 Core and Traversal, each NodeFilter constant
// is defined as the lower nth bit in the NodeFilter bitmask,
// where n is the numeric constant of the nodeType it represents.
// If this invariant ever changes, we will need to update the
// following line.
uint32_t filterForNodeType = 1 << (nodeType - 1);
if (mWhatToShow & filterForNodeType) {
if ((nodeType == nsINode::TEXT_NODE ||
nodeType == nsINode::COMMENT_NODE) &&
!mShowWhitespaceNodes) {
nsCOMPtr<nsIContent> content = do_QueryInterface(kid);
auto data = static_cast<nsGenericDOMDataNode*>(content.get());
NS_ASSERTION(data, "Does not implement nsIDOMCharacterData!");
if (InspectorUtils::IsIgnorableWhitespace(*data)) {
continue;
}
}
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(kid);
aArray.AppendElement(node.forget());
}
}
}
示例2: ImportStats
bool
nsPerformanceSnapshot::IterPerformanceStatsCallbackInternal(JSContext* cx, const js::PerformanceData& stats, const uint64_t uid) {
nsCOMPtr<nsIPerformanceStats> result = ImportStats(cx, stats, uid);
if (result) {
mComponentsData.AppendElement(result);
}
return true;
}
示例3: ImportStats
bool
nsPerformanceSnapshot::IterPerformanceStatsCallbackInternal(JSContext* cx,
const js::PerformanceData& stats, const uint64_t id,
const uint64_t* parentId) {
nsCOMPtr<nsIPerformanceStats> parent = parentId ? mCachedStats.Get(*parentId) : nullptr;
nsCOMPtr<nsIPerformanceStats> result = ImportStats(cx, stats, id, parent);
if (result) {
mComponentsData.AppendElement(result);
mCachedStats.Put(id, result);
}
return true;
}
示例4: monitor
void
XPTInterfaceInfoManager::GetScriptableInterfaces(nsCOMArray<nsIInterfaceInfo>& aInterfaces)
{
// I didn't want to incur the size overhead of using nsHashtable just to
// make building an enumerator easier. So, this code makes a snapshot of
// the table using an nsISupportsArray and builds an enumerator for that.
// We can afford this transient cost.
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
aInterfaces.SetCapacity(mWorkingSet.mNameTable.Count());
for (auto iter = mWorkingSet.mNameTable.Iter(); !iter.Done(); iter.Next()) {
xptiInterfaceEntry* entry = iter.UserData();
if (entry->GetScriptableFlag()) {
nsCOMPtr<nsIInterfaceInfo> ii = entry->InterfaceInfo();
aInterfaces.AppendElement(ii);
}
}
}
示例5:
void
nsPerformanceSnapshot::AppendComponentsStats(nsIPerformanceStats* stats)
{
mComponentsData.AppendElement(stats);
}