Commit e99936a5 authored by timothy@apple.com's avatar timothy@apple.com

Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting

        and stopping a profile from the Develop menu. Also prevents
        inserting an incorrect parent node as the new head after profiling
        is stopped from the Develop menu.

        Reviewed by Dan Bernstein.

        * profiler/Profile.cpp:
        (KJS::Profile::stopProfiling): If the current node is already the head
        then there is no more need to record future nodes in didExecute.
        (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
        into here since this was the only caller. When setting the total time
        keep any current total time while adding the self time of the head.
        (KJS::Profile::setupCurrentNodeAsStopped): Removed.
        * profiler/Profile.h: Removed setupCurrentNodeAsStopped.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 408f706f
2008-06-20 Timothy Hatcher <timothy@apple.com>
Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
and stopping a profile from the Develop menu. Also prevents
inserting an incorrect parent node as the new head after profiling
is stopped from the Develop menu.
Reviewed by Dan Bernstein.
* profiler/Profile.cpp:
(KJS::Profile::stopProfiling): If the current node is already the head
then there is no more need to record future nodes in didExecute.
(KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
into here since this was the only caller. When setting the total time
keep any current total time while adding the self time of the head.
(KJS::Profile::setupCurrentNodeAsStopped): Removed.
* profiler/Profile.h: Removed setupCurrentNodeAsStopped.
2008-06-20 Kevin Ollivier <kevino@theolliviers.com>
!USE(MULTIPLE_THREADS) on Darwin build fix
......
......@@ -65,6 +65,11 @@ void Profile::stopProfiling()
removeProfileStart();
removeProfileEnd();
// Already at the head, set m_currentNode to prevent
// didExecute from recording more nodes.
if (m_currentNode == m_head)
m_currentNode = 0;
m_stoppedProfiling = true;
}
......@@ -140,7 +145,9 @@ void Profile::didExecute(const CallIdentifier& callIdentifier)
m_head->insertNode(m_currentNode.get());
if (m_stoppedProfiling) {
setupCurrentNodeAsStopped();
m_currentNode->setTotalTime(m_currentNode->totalTime() + m_head->selfTime());
m_head->setSelfTime(0.0);
m_currentNode->stopProfiling();
m_currentNode = 0;
} else
m_currentNode = m_head;
......@@ -156,12 +163,6 @@ void Profile::didExecute(const CallIdentifier& callIdentifier)
m_currentNode = m_currentNode->didExecute();
}
void Profile::setupCurrentNodeAsStopped() {
m_currentNode->setTotalTime(m_head->selfTime());
m_head->setSelfTime(0.0);
m_currentNode->stopProfiling();
}
void Profile::forEach(UnaryFunction function)
{
ProfileNode* currentNode = m_head->firstChild();
......
......@@ -78,7 +78,6 @@ namespace KJS {
Profile(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient*);
void removeProfileStart();
void removeProfileEnd();
void setupCurrentNodeAsStopped();
UString m_title;
ExecState* m_originatingGlobalExec;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment