Title: [131600] trunk/Source/WebKit2
Revision
131600
Author
[email protected]
Date
2012-10-17 08:31:45 -0700 (Wed, 17 Oct 2012)

Log Message

[GTK] Don't use the C API internally in WebKitWebInspector
https://bugs.webkit.org/show_bug.cgi?id=96786

Reviewed by Gustavo Noronha Silva.

Using the C++ classes directly instead of the C API wrappers we
avoid a lot of toImpl/toAPI casts, string conversions and
allocations. The code is also a lot simpler and easier to read.

* UIProcess/API/gtk/WebKitWebInspector.cpp:
(_WebKitWebInspectorPrivate):
(webkitWebInspectorFinalize):
(webkitWebInspectorCreate):
(webkit_web_inspector_get_web_view):
(webkit_web_inspector_is_attached):
(webkit_web_inspector_attach):
(webkit_web_inspector_detach):
(webkit_web_inspector_show):
(webkit_web_inspector_close):
(webkit_web_inspector_get_attached_height):
* UIProcess/API/gtk/WebKitWebInspectorPrivate.h:
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkit_web_view_get_inspector):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (131599 => 131600)


--- trunk/Source/WebKit2/ChangeLog	2012-10-17 15:30:16 UTC (rev 131599)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-17 15:31:45 UTC (rev 131600)
@@ -1,5 +1,31 @@
 2012-10-17  Carlos Garcia Campos  <[email protected]>
 
+        [GTK] Don't use the C API internally in WebKitWebInspector
+        https://bugs.webkit.org/show_bug.cgi?id=96786
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Using the C++ classes directly instead of the C API wrappers we
+        avoid a lot of toImpl/toAPI casts, string conversions and
+        allocations. The code is also a lot simpler and easier to read.
+
+        * UIProcess/API/gtk/WebKitWebInspector.cpp:
+        (_WebKitWebInspectorPrivate):
+        (webkitWebInspectorFinalize):
+        (webkitWebInspectorCreate):
+        (webkit_web_inspector_get_web_view):
+        (webkit_web_inspector_is_attached):
+        (webkit_web_inspector_attach):
+        (webkit_web_inspector_detach):
+        (webkit_web_inspector_show):
+        (webkit_web_inspector_close):
+        (webkit_web_inspector_get_attached_height):
+        * UIProcess/API/gtk/WebKitWebInspectorPrivate.h:
+        * UIProcess/API/gtk/WebKitWebView.cpp:
+        (webkit_web_view_get_inspector):
+
+2012-10-17  Carlos Garcia Campos  <[email protected]>
+
         [GTK] Don't use the C API internally in WebKitGeolocation classes
         https://bugs.webkit.org/show_bug.cgi?id=96778
 

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp (131599 => 131600)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp	2012-10-17 15:30:16 UTC (rev 131599)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp	2012-10-17 15:31:45 UTC (rev 131600)
@@ -27,8 +27,6 @@
 #include <wtf/gobject/GRefPtr.h>
 #include <wtf/text/CString.h>
 
-using namespace WebKit;
-
 enum {
     OPEN_WINDOW,
     BRING_TO_FRONT,
@@ -47,7 +45,7 @@
 };
 
 struct _WebKitWebInspectorPrivate {
-    WKRetainPtr<WKInspectorRef> wkInspector;
+    RefPtr<WebInspectorProxy> webInspector;
     CString inspectedURI;
     unsigned attachedHeight;
 };
@@ -75,7 +73,7 @@
 static void webkitWebInspectorFinalize(GObject* object)
 {
     WebKitWebInspectorPrivate* priv = WEBKIT_WEB_INSPECTOR(object)->priv;
-    WKInspectorSetInspectorClientGtk(priv->wkInspector.get(), 0);
+    WKInspectorSetInspectorClientGtk(toAPI(priv->webInspector.get()), 0);
     priv->~WebKitWebInspectorPrivate();
     G_OBJECT_CLASS(webkit_web_inspector_parent_class)->finalize(object);
 }
@@ -295,10 +293,10 @@
     g_object_notify(G_OBJECT(inspector), "attached-height");
 }
 
-WebKitWebInspector* webkitWebInspectorCreate(WKInspectorRef wkInspector)
+WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector)
 {
     WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL));
-    inspector->priv->wkInspector = wkInspector;
+    inspector->priv->webInspector = webInspector;
 
     WKInspectorClientGtk wkInspectorClientGtk = {
         kWKInspectorClientGtkCurrentVersion,
@@ -311,7 +309,7 @@
         detach,
         didChangeAttachedHeight
     };
-    WKInspectorSetInspectorClientGtk(wkInspector, &wkInspectorClientGtk);
+    WKInspectorSetInspectorClientGtk(toAPI(webInspector), &wkInspectorClientGtk);
 
     return inspector;
 }
@@ -330,7 +328,7 @@
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector), 0);
 
-    return WEBKIT_WEB_VIEW_BASE(toImpl(inspector->priv->wkInspector.get())->inspectorView());
+    return WEBKIT_WEB_VIEW_BASE(inspector->priv->webInspector->inspectorView());
 }
 
 /**
@@ -364,7 +362,7 @@
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector), FALSE);
 
-    return WKInspectorIsAttached(inspector->priv->wkInspector.get());
+    return inspector->priv->webInspector->isAttached();
 }
 
 /**
@@ -378,9 +376,9 @@
 {
     g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector));
 
-    if (WKInspectorIsAttached(inspector->priv->wkInspector.get()))
+    if (inspector->priv->webInspector->isAttached())
         return;
-    WKInspectorAttach(inspector->priv->wkInspector.get());
+    inspector->priv->webInspector->attach();
 }
 
 /**
@@ -394,9 +392,9 @@
 {
     g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector));
 
-    if (!WKInspectorIsAttached(inspector->priv->wkInspector.get()))
+    if (!inspector->priv->webInspector->isAttached())
         return;
-    WKInspectorDetach(inspector->priv->wkInspector.get());
+    inspector->priv->webInspector->detach();
 }
 
 /**
@@ -409,7 +407,7 @@
 {
     g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector));
 
-    WKInspectorShow(inspector->priv->wkInspector.get());
+    inspector->priv->webInspector->show();
 }
 
 /**
@@ -422,7 +420,7 @@
 {
     g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector));
 
-    WKInspectorClose(inspector->priv->wkInspector.get());
+    inspector->priv->webInspector->close();
 }
 
 /**
@@ -439,7 +437,7 @@
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_INSPECTOR(inspector), 0);
 
-    if (!WKInspectorIsAttached(inspector->priv->wkInspector.get()))
+    if (!inspector->priv->webInspector->isAttached())
         return 0;
     return inspector->priv->attachedHeight;
 }

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspectorPrivate.h (131599 => 131600)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspectorPrivate.h	2012-10-17 15:30:16 UTC (rev 131599)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspectorPrivate.h	2012-10-17 15:31:45 UTC (rev 131600)
@@ -23,6 +23,8 @@
 #include "WebKitPrivate.h"
 #include "WebKitWebInspector.h"
 
-WebKitWebInspector* webkitWebInspectorCreate(WKInspectorRef);
+using namespace WebKit;
 
+WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy*);
+
 #endif // WebKitWebInspectorPrivate_h

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (131599 => 131600)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2012-10-17 15:30:16 UTC (rev 131599)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp	2012-10-17 15:31:45 UTC (rev 131600)
@@ -2569,7 +2569,7 @@
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
 
     if (!webView->priv->inspector)
-        webView->priv->inspector = adoptGRef(webkitWebInspectorCreate(toAPI(getPage(webView)->inspector())));
+        webView->priv->inspector = adoptGRef(webkitWebInspectorCreate(getPage(webView)->inspector()));
 
     return webView->priv->inspector.get();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to