diff options
Diffstat (limited to 'WebKit/gtk/webkit/webkitwebinspector.cpp')
-rw-r--r-- | WebKit/gtk/webkit/webkitwebinspector.cpp | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/WebKit/gtk/webkit/webkitwebinspector.cpp b/WebKit/gtk/webkit/webkitwebinspector.cpp index b8f8d9e..8e1c8c0 100644 --- a/WebKit/gtk/webkit/webkitwebinspector.cpp +++ b/WebKit/gtk/webkit/webkitwebinspector.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 Gustavo Noronha Silva - * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2008, 2009 Holger Hans Peter Freyther * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -75,12 +75,13 @@ enum { PROP_WEB_VIEW, PROP_INSPECTED_URI, + PROP_JAVASCRIPT_PROFILING_ENABLED }; G_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT) struct _WebKitWebInspectorPrivate { - InspectorClient* inspectorClient; + WebCore::Page* page; WebKitWebView* inspector_view; gchar* inspected_uri; }; @@ -274,6 +275,23 @@ static void webkit_web_inspector_class_init(WebKitWebInspectorClass* klass) NULL, WEBKIT_PARAM_READABLE)); + /** + * WebKitWebInspector:javascript-profiling-enabled + * + * This is enabling JavaScript profiling in the Inspector. This means + * that Console.profiles will return the profiles. + * + * Since: 1.1.1 + */ + g_object_class_install_property(gobject_class, + PROP_JAVASCRIPT_PROFILING_ENABLED, + g_param_spec_boolean( + "javascript-profiling-enabled", + "Enable JavaScript profiling", + "Profile the executed JavaScript.", + FALSE, + WEBKIT_PARAM_READWRITE)); + g_type_class_add_private(klass, sizeof(WebKitWebInspectorPrivate)); } @@ -298,7 +316,19 @@ static void webkit_web_inspector_finalize(GObject* object) static void webkit_web_inspector_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { + WebKitWebInspector* web_inspector = WEBKIT_WEB_INSPECTOR(object); + WebKitWebInspectorPrivate* priv = web_inspector->priv; + switch(prop_id) { + case PROP_JAVASCRIPT_PROFILING_ENABLED: { + bool enabled = g_value_get_boolean(value); + WebCore::InspectorController* controller = priv->page->inspectorController(); + if (enabled) + controller->enableProfiler(); + else + controller->disableProfiler(); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -317,6 +347,9 @@ static void webkit_web_inspector_get_property(GObject* object, guint prop_id, GV case PROP_INSPECTED_URI: g_value_set_string(value, priv->inspected_uri); break; + case PROP_JAVASCRIPT_PROFILING_ENABLED: + g_value_set_boolean(value, priv->page->inspectorController()->profilerEnabled()); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -388,11 +421,11 @@ const gchar* webkit_web_inspector_get_inspected_uri(WebKitWebInspector *web_insp } void -webkit_web_inspector_set_inspector_client(WebKitWebInspector* web_inspector, WebKit::InspectorClient* inspectorClient) +webkit_web_inspector_set_inspector_client(WebKitWebInspector* web_inspector, WebCore::Page* page) { WebKitWebInspectorPrivate* priv = web_inspector->priv; - priv->inspectorClient = inspectorClient; + priv->page = page; } } |