2008-05-13 Kevin McCullough <kmccullough@apple.com>
authorkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2008 21:18:02 +0000 (21:18 +0000)
committerkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2008 21:18:02 +0000 (21:18 +0000)
        Reviewed by Geoff.

        <rdar://problem/5770054> JavaScript profiler (10928)
        Use PassRefPtrs instead of RefPtrs when appropriate.

        * profiler/FunctionCallProfile.cpp:
        (KJS::FunctionCallProfile::addChild):
        * profiler/FunctionCallProfile.h:
        * profiler/Profile.h:
        (KJS::Profile::callTree):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@33388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/profiler/FunctionCallProfile.cpp
JavaScriptCore/profiler/FunctionCallProfile.h
JavaScriptCore/profiler/Profile.h

index b320ee6..0750cef 100644 (file)
@@ -1,5 +1,18 @@
 2008-05-13  Kevin McCullough  <kmccullough@apple.com>
 
+        Reviewed by Geoff.
+
+        <rdar://problem/5770054> JavaScript profiler (10928)
+        Use PassRefPtrs instead of RefPtrs when appropriate.
+
+        * profiler/FunctionCallProfile.cpp:
+        (KJS::FunctionCallProfile::addChild):
+        * profiler/FunctionCallProfile.h:
+        * profiler/Profile.h:
+        (KJS::Profile::callTree):
+
+2008-05-13  Kevin McCullough  <kmccullough@apple.com>
+
         Reviewed by Sam.
 
         <rdar://problem/5770054> JavaScript profiler (10928)
index 7dd10f6..f8510a2 100644 (file)
@@ -65,17 +65,17 @@ void FunctionCallProfile::didExecute(Vector<UString> stackNames, unsigned int st
     }
 }
 
-void FunctionCallProfile::addChild(RefPtr<FunctionCallProfile>& child)
+void FunctionCallProfile::addChild(PassRefPtr<FunctionCallProfile> prpChild)
 {
-    if (!child)
-        return;
+    ASSERT(prpChild);
 
+    RefPtr<FunctionCallProfile> child = prpChild;
     for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) {
         if ((*currentChild)->functionName() == child->functionName())
             return;
     }
 
-    m_children.append(child);
+    m_children.append(child.release());
 }
 
 FunctionCallProfile* FunctionCallProfile::findChild(const UString& name)
index a1018c3..43cf44a 100644 (file)
@@ -49,7 +49,7 @@ namespace KJS {
         void willExecute();
         void didExecute(Vector<UString> stackNames, unsigned int stackIndex);
 
-        void addChild(RefPtr<FunctionCallProfile>& child);
+        void addChild(PassRefPtr<FunctionCallProfile> prpChild);
         FunctionCallProfile* findChild(const UString& name);
 
         void stopProfiling();
index 2eca295..8456579 100644 (file)
@@ -45,7 +45,7 @@ namespace KJS {
 
         void stopProfiling() { m_callTree->stopProfiling(); };
         const UString& title() const { return m_title; };
-        RefPtr<FunctionCallProfile> callTree() const { return m_callTree; };
+        FunctionCallProfile* callTree() const { return m_callTree.get(); };
 
         void printDataInspectorStyle() const;
         void printDataSampleStyle() const;