Ignore:
Timestamp:
May 13, 2008, 12:35:31 PM (17 years ago)
Author:
[email protected]
Message:

2008-05-13 Kevin McCullough <[email protected]>

Reviewed by Sam.

<rdar://problem/5770054> JavaScript profiler (10928)

  • Made some functions static (as per Adam) and changed from using raw pointers to RefPtr for making these JavaScript Objects.
  • profiler/FunctionCallProfile.cpp: (KJS::FunctionCallProfile::addChild): (KJS::FunctionCallProfile::findChild):
  • profiler/FunctionCallProfile.h: (KJS::FunctionCallProfile::create):
  • profiler/Profile.cpp: (KJS::Profile::Profile): (KJS::Profile::willExecute): (KJS::Profile::didExecute): (KJS::functionNameCountPairComparator):
  • profiler/Profile.h: (KJS::Profile::create): (KJS::Profile::title): (KJS::Profile::callTree):
  • profiler/Profiler.cpp: (KJS::Profiler::startProfiling):
  • profiler/Profiler.h: (KJS::Profiler::allProfiles): (KJS::Profiler::clearProfiles):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/profiler/FunctionCallProfile.h

    r32760 r33382  
    3232#include <kjs/ustring.h>
    3333#include <wtf/Deque.h>
     34#include <wtf/RefCounted.h>
     35#include <wtf/RefPtr.h>
    3436#include <wtf/StrHash.h>
    3537
     
    3840    class FunctionCallProfile;
    3941
    40     typedef Deque<FunctionCallProfile*>::const_iterator StackIterator;
     42    typedef Deque<RefPtr<FunctionCallProfile> >::const_iterator StackIterator;
    4143    typedef HashCountedSet<UString::Rep*> FunctionCallHashCount;
    4244
    43     class FunctionCallProfile {
     45    class FunctionCallProfile : public RefCounted<FunctionCallProfile> {
    4446    public:
    45         FunctionCallProfile(const UString& name);       
    46         ~FunctionCallProfile();
     47        static PassRefPtr<FunctionCallProfile> create(const UString& name) { return adoptRef(new FunctionCallProfile(name)); }
    4748
    4849        void willExecute();
    4950        void didExecute(Vector<UString> stackNames, unsigned int stackIndex);
    5051
    51         void addChild(FunctionCallProfile* child);
     52        void addChild(RefPtr<FunctionCallProfile>& child);
    5253        FunctionCallProfile* findChild(const UString& name);
    5354
     
    5758        double milliSecs() const { return m_timeSum; }
    5859        unsigned numberOfCalls() const { return m_numberOfCalls; }
     60        const Deque<RefPtr<FunctionCallProfile> >& children() { return m_children; }
    5961
    6062        void printDataInspectorStyle(int indentLevel) const;
     
    6264
    6365    private:
     66        FunctionCallProfile(const UString& name);
     67
    6468        void endAndRecordCall();
    6569   
     
    6973        unsigned m_numberOfCalls;
    7074
    71         Deque<FunctionCallProfile*> m_children;
     75        Deque<RefPtr<FunctionCallProfile> > m_children;
    7276    };
    7377
Note: See TracChangeset for help on using the changeset viewer.