2008-05-13 Kevin McCullough <kmccullough@apple.com>
[WebKit-https.git] / JavaScriptCore / profiler / Profile.cpp
index 74abad7..624209b 100644 (file)
@@ -42,13 +42,13 @@ Profile::Profile(const UString& title)
 {
     // FIXME: When multi-threading is supported this will be a vector and calls
     // into the profiler will need to know which thread it is executing on.
-    m_callTree.set(new FunctionCallProfile("Thread_1"));
+    m_callTree = FunctionCallProfile::create("Thread_1");
 }
 
 void Profile::willExecute(const Vector<UString>& callStackNames)
 {
-    FunctionCallProfile* callTreeInsertionPoint = 0;
-    FunctionCallProfile* foundNameInTree = m_callTree.get();
+    RefPtr<FunctionCallProfile> callTreeInsertionPoint;
+    RefPtr<FunctionCallProfile> foundNameInTree = m_callTree;
     NameIterator callStackLocation = callStackNames.begin();
 
     while (callStackLocation != callStackNames.end() && foundNameInTree) {
@@ -59,8 +59,8 @@ void Profile::willExecute(const Vector<UString>& callStackNames)
 
     if (!foundNameInTree) {   // Insert remains of the stack into the call tree.
         --callStackLocation;
-        for (FunctionCallProfile* next; callStackLocation != callStackNames.end(); ++callStackLocation) {
-            next = new FunctionCallProfile(*callStackLocation);
+        for (RefPtr<FunctionCallProfile> next; callStackLocation != callStackNames.end(); ++callStackLocation) {
+            next = FunctionCallProfile::create(*callStackLocation);
             callTreeInsertionPoint->addChild(next);
             callTreeInsertionPoint = next;
         }
@@ -68,7 +68,7 @@ void Profile::willExecute(const Vector<UString>& callStackNames)
         foundNameInTree->willExecute();
 }
 
-void Profile::didExecute(Vector<UString> stackNames)
+void Profile::didExecute(const Vector<UString>& stackNames)
 {
     m_callTree->didExecute(stackNames, 0);    
 }
@@ -81,7 +81,7 @@ void Profile::printDataInspectorStyle() const
 
 typedef pair<UString::Rep*, unsigned> NameCountPair;
 
-static inline bool functionNameCountPairComparator(const NameCountPair a, const NameCountPair b)
+static inline bool functionNameCountPairComparator(const NameCountPair& a, const NameCountPair& b)
 {
     return a.second > b.second;
 }