本文整理汇总了C++中ProfileNode类的典型用法代码示例。如果您正苦于以下问题:C++ ProfileNode类的具体用法?C++ ProfileNode怎么用?C++ ProfileNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProfileNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitDeviceComboBox
void CVCDlg::InitDeviceComboBox()
{
ProfileNode* pRoot = ProfileMgr::GetInstance()->GetRootProfile();
int nChildCount = ((pRoot == NULL) ? 0 : pRoot->GetChildCount());
std::string szText;
AttribMap* pAttribMap = NULL;
for(int i = 0; i < nChildCount; i++)
{
ProfileNode* pProfile = (ProfileNode*)pRoot->GetChild(i);
pAttribMap = (AttribMap*)pProfile->GetData();
if(!pAttribMap->Get(PF_ATTRIB_DESC, szText))
{
pAttribMap->Get(PF_ATTRIB_NAME, szText);
}
LIST_ITEM item;
item.strText = CFL_A2T(szText.c_str());
item.vpItemData = pProfile;
m_deviceComboBox.AddItem(&item);
}
if(nChildCount > 0)
{
m_deviceComboBox.SetCurSel(0);
OnCategorySelChanged();
}
}
示例2: getLineNumber
static JSValueRef getLineNumber(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
return JSValueMakeUndefined(ctx);
ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(ctx, profileNode->lineNumber());
}
示例3: getURL
static JSValueRef getURL(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
return JSValueMakeUndefined(ctx);
ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
JSRetainPtr<JSStringRef> urlString(Adopt, JSStringCreateWithCharacters(profileNode->url().data(), profileNode->url().size()));
return JSValueMakeString(ctx, urlString.get());
}
示例4: while
ProfileNode* ProfileNode::traverseNextNodePostOrder() const
{
ProfileNode* next = m_nextSibling;
if (!next)
return m_parent;
while (ProfileNode* firstChild = next->firstChild())
next = firstChild;
return next;
}
示例5: getSelfTime
static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
KJS::JSLock lock(false);
if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
return JSValueMakeUndefined(ctx);
ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(ctx, profileNode->selfTime());
}
示例6: removeProfileStart
// The console.profile that started this ProfileGenerator will be the first child.
void ProfileGenerator::removeProfileStart()
{
ProfileNode* currentNode = nullptr;
for (ProfileNode* next = m_rootNode.get(); next; next = next->firstChild())
currentNode = next;
if (currentNode->callIdentifier().functionName() != "profile")
return;
currentNode->parent()->removeChild(currentNode);
}
示例7: forEach
void Profile::focus(const ProfileNode* profileNode)
{
if (!profileNode || !m_head)
return;
bool processChildren;
const CallIdentifier& callIdentifier = profileNode->callIdentifier();
for (ProfileNode* currentNode = m_head.get(); currentNode; currentNode = currentNode->traverseNextNodePreOrder(processChildren))
processChildren = currentNode->focus(callIdentifier);
// Set the visible time of all nodes so that the %s display correctly.
forEach(&ProfileNode::calculateVisibleTotalTime);
}
示例8: setTreeVisible
void ProfileNode::setTreeVisible(ProfileNode* node, bool visible)
{
ProfileNode* nodeParent = node->parent();
ProfileNode* nodeSibling = node->nextSibling();
node->setParent(0);
node->setNextSibling(0);
for (ProfileNode* currentNode = node; currentNode; currentNode = currentNode->traverseNextNodePreOrder())
currentNode->setVisible(visible);
node->setParent(nodeParent);
node->setNextSibling(nodeSibling);
}
示例9: beginNode
void Profile::beginNode(const char* name)
{
ProfileNode* parent = m_stack.back();
ProfileNode* node = parent->findChild(name);
if (!node)
{
parent->m_children.push_back(ProfileNode(name));
node = &(parent->m_children.back());
}
beginNode(*node);
}
示例10: exclude
void Profile::exclude(const ProfileNode* profileNode)
{
if (!profileNode || !m_head)
return;
const CallIdentifier& callIdentifier = profileNode->callIdentifier();
for (ProfileNode* currentNode = m_head.get(); currentNode; currentNode = currentNode->traverseNextNodePreOrder())
currentNode->exclude(callIdentifier);
// Set the visible time of the head so the %s display correctly.
m_head->setVisibleTotalTime(m_head->totalTime() - m_head->selfTime());
m_head->setVisibleSelfTime(0.0);
}
示例11: focus
bool ProfileNode::focus(const CallIdentifier& callIdentifier)
{
if (!m_visible)
return false;
if (m_callIdentifier != callIdentifier) {
m_visible = false;
return true;
}
for (ProfileNode* currentParent = m_parent; currentParent; currentParent = currentParent->parent())
currentParent->setVisible(true);
return false;
}
示例12: getChildren
static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
KJS::JSLock lock(false);
if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
return JSValueMakeUndefined(ctx);
ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
const Vector<RefPtr<ProfileNode> >& children = profileNode->children();
JSObjectRef global = JSContextGetGlobalObject(ctx);
JSRetainPtr<JSStringRef> arrayString(Adopt, JSStringCreateWithUTF8CString("Array"));
JSValueRef arrayProperty = JSObjectGetProperty(ctx, global, arrayString.get(), exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
JSObjectRef arrayConstructor = JSValueToObject(ctx, arrayProperty, exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
JSObjectRef result = JSObjectCallAsConstructor(ctx, arrayConstructor, 0, 0, exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
JSRetainPtr<JSStringRef> pushString(Adopt, JSStringCreateWithUTF8CString("push"));
JSValueRef pushProperty = JSObjectGetProperty(ctx, result, pushString.get(), exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
JSObjectRef pushFunction = JSValueToObject(ctx, pushProperty, exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
for (Vector<RefPtr<ProfileNode> >::const_iterator it = children.begin(); it != children.end(); ++it) {
JSValueRef arg0 = toRef(toJS(toJS(ctx), (*it).get() ));
JSObjectCallAsFunction(ctx, pushFunction, result, 1, &arg0, exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
}
return result;
}
示例13: if
const ProfileNode* ProfileNode::findNextInTree(void) const {
if (firstChild) {
return firstChild;
} else if (nextSibling) {
return nextSibling;
} else {
ProfileNode* pParent = parent;
while (!pParent->isRoot()) {
if (pParent->nextSibling) return pParent->nextSibling;
else pParent = pParent->parent;
}
return NULL;
}
}
示例14: removeProfileEnd
// The console.profileEnd that stopped this ProfileGenerator will be the last child.
void ProfileGenerator::removeProfileEnd()
{
ProfileNode* currentNode = nullptr;
for (ProfileNode* next = m_rootNode.get(); next; next = next->lastChild())
currentNode = next;
if (currentNode->callIdentifier().functionName() != "profileEnd")
return;
ASSERT(currentNode->callIdentifier() == (currentNode->parent()->children()[currentNode->parent()->children().size() - 1])->callIdentifier());
currentNode->parent()->removeChild(currentNode);
}
示例15: removeProfileStart
// The console.ProfileGenerator that started this ProfileGenerator will be the first child.
void ProfileGenerator::removeProfileStart()
{
ProfileNode* currentNode = 0;
for (ProfileNode* next = m_head.get(); next; next = next->firstChild())
currentNode = next;
if (currentNode->callIdentifier().m_name != "profile")
return;
// Attribute the time of the node aobut to be removed to the self time of its parent
currentNode->parent()->setSelfTime(currentNode->parent()->selfTime() + currentNode->totalTime());
currentNode->parent()->removeChild(currentNode);
}