+class AddParentForConsoleStartFunctor {
+public:
+ AddParentForConsoleStartFunctor(ExecState* exec, RefPtr<ProfileNode>& rootNode, RefPtr<ProfileNode>& currentNode, double startTime)
+ : m_exec(exec)
+ , m_hasSkippedFirstFrame(false)
+ , m_foundParent(false)
+ , m_rootNode(rootNode)
+ , m_currentNode(currentNode)
+ , m_startTime(startTime)
+ {
+ }
+
+ bool foundParent() const { return m_foundParent; }
+
+ StackVisitor::Status operator()(StackVisitor& visitor)
+ {
+ if (!m_hasSkippedFirstFrame) {
+ m_hasSkippedFirstFrame = true;
+ return StackVisitor::Continue;
+ }
+
+ unsigned line = 0;
+ unsigned column = 0;
+ visitor->computeLineAndColumn(line, column);
+ m_currentNode = ProfileNode::create(m_exec, LegacyProfiler::createCallIdentifier(m_exec, visitor->callee(), visitor->sourceURL(), line, column), m_rootNode.get());
+ m_currentNode->appendCall(ProfileNode::Call(m_startTime));
+ m_rootNode->spliceNode(m_currentNode.get());
+
+ m_foundParent = true;
+ return StackVisitor::Done;
+ }
+
+private:
+ ExecState* m_exec;
+ bool m_hasSkippedFirstFrame;
+ bool m_foundParent;
+ RefPtr<ProfileNode>& m_rootNode;
+ RefPtr<ProfileNode>& m_currentNode;
+ double m_startTime;
+};
+
+void ProfileGenerator::addParentForConsoleStart(ExecState* exec, double startTime)