Ignore:
Timestamp:
Jun 21, 2008, 12:04:22 AM (17 years ago)
Author:
[email protected]
Message:

Use member function pointers for the Profile::forEach function.
Eliminating a few static functions and simplified things a little.

Reviewed by Alexey Proskuryakov.

  • JavaScriptCore.exp: Change the symbol for forEach.
  • profiler/Profile.cpp: (KJS::Profile::forEach): Use a member function pointer.
  • profiler/Profile.h: (KJS::Profile::sortTotalTimeDescending): Pass a function pointer. (KJS::Profile::sortTotalTimeAscending): Ditto. (KJS::Profile::sortSelfTimeDescending): Ditto. (KJS::Profile::sortSelfTimeAscending): Ditto. (KJS::Profile::sortCallsDescending): Ditto.
  • profiler/ProfileNode.h: (KJS::ProfileNode::sortTotalTimeDescending): No longer static. (KJS::ProfileNode::sortTotalTimeAscending): Ditto. (KJS::ProfileNode::sortSelfTimeDescending): Ditto. (KJS::ProfileNode::sortSelfTimeAscending): Ditto. (KJS::ProfileNode::sortCallsDescending): Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/profiler/Profile.cpp

    r34710 r34712  
    3838static const char* NonJSExecution = "(idle)";
    3939
    40 static void calculateVisibleTotalTime(ProfileNode* n) { n->calculateVisibleTotalTime(); }
    41 static void restoreAll(ProfileNode* n) { n->restore(); }
    42 static void stopProfiling(ProfileNode* n) { n->stopProfiling(); }
    43 
    4440PassRefPtr<Profile> Profile::create(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient* client)
    4541{
     
    6258void Profile::stopProfiling()
    6359{
    64     forEach(KJS::stopProfiling);
     60    forEach(&ProfileNode::stopProfiling);
    6561    removeProfileStart();
    6662    removeProfileEnd();
     
    164160}
    165161
    166 void Profile::forEach(UnaryFunction function)
     162void Profile::forEach(void (ProfileNode::*function)())
    167163{
    168164    ProfileNode* currentNode = m_head->firstChild();
     
    172168    ProfileNode* endNode = m_head->traverseNextNodePostOrder();
    173169    while (currentNode && currentNode != endNode) {
    174         function(currentNode);
     170        (currentNode->*function)();
    175171        currentNode = currentNode->traverseNextNodePostOrder();
    176172    }
     
    188184
    189185    // Set the visible time of all nodes so that the %s display correctly.
    190     forEach(KJS::calculateVisibleTotalTime);
     186    forEach(&ProfileNode::calculateVisibleTotalTime);
    191187}
    192188
     
    208204void Profile::restoreAll()
    209205{
    210     forEach(KJS::restoreAll);
     206    forEach(&ProfileNode::restore);
    211207}
    212208
Note: See TracChangeset for help on using the changeset viewer.