summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-06-15 09:06:43 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-06-15 09:31:31 (GMT)
commitc411f16870f112c3407c28c22b617f613a82cff4 (patch)
tree29a1bcd590c8b31af2aab445bfe8a978dc5bf582 /src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp
parent3d77b56b32a0c53ec0bbfaa07236fedb900ff336 (diff)
downloadQt-c411f16870f112c3407c28c22b617f613a82cff4.zip
Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.gz
Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.bz2
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-15062009 ( 65232bf00dc494ebfd978f998c88f58d18ecce1e )
Diffstat (limited to 'src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp51
1 files changed, 47 insertions, 4 deletions
diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp
index 8d00783..5b5c340 100644
--- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp
@@ -26,6 +26,8 @@
#include "config.h"
#include "JavaScriptProfileNode.h"
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
#include "JSDOMBinding.h"
#include <profiler/ProfileNode.h>
#include <JavaScriptCore/APICast.h>
@@ -46,7 +48,7 @@ namespace WebCore {
typedef HashMap<ProfileNode*, JSObject*> ProfileNodeMap;
static ProfileNodeMap& profileNodeCache()
-{
+{
DEFINE_STATIC_LOCAL(ProfileNodeMap, staticProfileNodes, ());
return staticProfileNodes;
}
@@ -162,7 +164,7 @@ static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSString
return JSValueMakeUndefined(ctx);
JSRetainPtr<JSStringRef> pushString(Adopt, JSStringCreateWithUTF8CString("push"));
-
+
JSValueRef pushProperty = JSObjectGetProperty(ctx, result, pushString.get(), exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
@@ -171,8 +173,9 @@ static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSString
if (exception && *exception)
return JSValueMakeUndefined(ctx);
+ ExecState* exec = toJS(ctx);
for (Vector<RefPtr<ProfileNode> >::const_iterator it = children.begin(); it != children.end(); ++it) {
- JSValueRef arg0 = toRef(toJS(toJS(ctx), (*it).get() ));
+ JSValueRef arg0 = toRef(exec, toJS(exec, (*it).get() ));
JSObjectCallAsFunction(ctx, pushFunction, result, 1, &arg0, exception);
if (exception && *exception)
return JSValueMakeUndefined(ctx);
@@ -181,6 +184,30 @@ static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSString
return result;
}
+static JSValueRef getParent(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*)
+{
+ JSC::JSLock lock(false);
+
+ if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
+ return JSValueMakeUndefined(ctx);
+
+ ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
+ ExecState* exec = toJS(ctx);
+ return toRef(exec, toJS(exec, profileNode->parent()));
+}
+
+static JSValueRef getHead(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*)
+{
+ JSC::JSLock lock(false);
+
+ if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
+ return JSValueMakeUndefined(ctx);
+
+ ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
+ ExecState* exec = toJS(ctx);
+ return toRef(exec, toJS(exec, profileNode->head()));
+}
+
static JSValueRef getVisible(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*)
{
JSC::JSLock lock(false);
@@ -192,6 +219,17 @@ static JSValueRef getVisible(JSContextRef ctx, JSObjectRef thisObject, JSStringR
return JSValueMakeBoolean(ctx, profileNode->visible());
}
+static JSValueRef getCallUID(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*)
+{
+ JSC::JSLock lock(false);
+
+ if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass()))
+ return JSValueMakeUndefined(ctx);
+
+ ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(thisObject));
+ return JSValueMakeNumber(ctx, profileNode->callIdentifier().hash());
+}
+
static void finalize(JSObjectRef object)
{
ProfileNode* profileNode = static_cast<ProfileNode*>(JSObjectGetPrivate(object));
@@ -211,7 +249,10 @@ JSClassRef ProfileNodeClass()
{ "selfPercent", getSelfPercent, 0, kJSPropertyAttributeNone },
{ "numberOfCalls", getNumberOfCalls, 0, kJSPropertyAttributeNone },
{ "children", getChildren, 0, kJSPropertyAttributeNone },
+ { "parent", getParent, 0, kJSPropertyAttributeNone },
+ { "head", getHead, 0, kJSClassAttributeNone },
{ "visible", getVisible, 0, kJSPropertyAttributeNone },
+ { "callUID", getCallUID, 0, kJSPropertyAttributeNone },
{ 0, 0, 0, 0 }
};
@@ -224,7 +265,7 @@ JSClassRef ProfileNodeClass()
return profileNodeClass;
}
-JSValuePtr toJS(ExecState* exec, ProfileNode* profileNode)
+JSValue toJS(ExecState* exec, ProfileNode* profileNode)
{
if (!profileNode)
return jsNull();
@@ -241,3 +282,5 @@ JSValuePtr toJS(ExecState* exec, ProfileNode* profileNode)
}
} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)