Changeset 218089 in webkit
- Timestamp:
- Jun 11, 2017 11:05:05 PM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 deleted
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r218068 r218089 1 2017-06-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Remove WKInspectorClientGtk 4 https://bugs.webkit.org/show_bug.cgi?id=173142 5 6 Reviewed by Michael Catanzaro. 7 8 It's only used internally in GTk+ API, we can simplify it by using a C++ client instead. 9 10 * PlatformGTK.cmake: 11 * UIProcess/API/C/gtk/WKInspectorClientGtk.cpp: Removed. 12 * UIProcess/API/C/gtk/WKInspectorClientGtk.h: Removed. 13 * UIProcess/API/gtk/WebKitPrivate.h: 14 * UIProcess/API/gtk/WebKitWebInspector.cpp: 15 (_WebKitWebInspectorPrivate::~_WebKitWebInspectorPrivate): 16 (webkitWebInspectorCreate): 17 * UIProcess/WebInspectorProxy.cpp: 18 * UIProcess/WebInspectorProxy.h: 19 * UIProcess/gtk/WebInspectorClientGtk.cpp: Removed. 20 * UIProcess/gtk/WebInspectorProxyClient.h: Renamed from Source/WebKit2/UIProcess/gtk/WebInspectorClientGtk.h. 21 * UIProcess/gtk/WebInspectorProxyGtk.cpp: 22 (WebKit::WebInspectorProxy::setClient): 23 (WebKit::WebInspectorProxy::createInspectorWindow): 24 (WebKit::WebInspectorProxy::platformDidClose): 25 (WebKit::WebInspectorProxy::platformBringToFront): 26 (WebKit::WebInspectorProxy::platformInspectedURLChanged): 27 (WebKit::WebInspectorProxy::platformAttach): 28 (WebKit::WebInspectorProxy::platformDetach): 29 (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): 30 (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth): 31 (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged): 32 1 33 2017-06-11 Tim Horton <timothy_horton@apple.com> 2 34 -
trunk/Source/WebKit2/PlatformGTK.cmake
r218064 r218089 110 110 UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp 111 111 112 UIProcess/API/C/gtk/WKInspectorClientGtk.cpp113 112 UIProcess/API/C/gtk/WKTextCheckerGtk.cpp 114 113 UIProcess/API/C/gtk/WKView.cpp … … 337 336 UIProcess/gtk/WebColorPickerGtk.cpp 338 337 UIProcess/gtk/WebContextMenuProxyGtk.cpp 339 UIProcess/gtk/WebInspectorClientGtk.cpp340 338 UIProcess/gtk/WebInspectorProxyGtk.cpp 341 339 UIProcess/gtk/WebKitInspectorWindow.cpp -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h
r218064 r218089 36 36 #include <WebKit/WKIconDatabase.h> 37 37 #include <WebKit/WKInspector.h> 38 #include <WebKit/WKInspectorClientGtk.h>39 38 #include <WebKit/WKRetainPtr.h> 40 39 #include <WebKit/WKSerializedScriptValue.h> -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebInspector.cpp
r217960 r218089 22 22 23 23 #include "WebInspectorProxy.h" 24 #include "WebInspectorProxyClient.h" 24 25 #include "WebKitWebInspectorPrivate.h" 25 26 #include <glib/gi18n-lib.h> … … 79 80 ~_WebKitWebInspectorPrivate() 80 81 { 81 WKInspectorSetInspectorClientGtk(toAPI(webInspector.get()), 0);82 webInspector->setClient(nullptr); 82 83 } 83 84 … … 282 283 } 283 284 284 static bool openWindow(WKInspectorRef, const void* clientInfo) 285 { 286 gboolean returnValue; 287 g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[OPEN_WINDOW], 0, &returnValue); 288 return returnValue; 289 } 290 291 static void didClose(WKInspectorRef, const void* clientInfo) 292 { 293 g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[CLOSED], 0); 294 } 295 296 static bool bringToFront(WKInspectorRef, const void* clientInfo) 297 { 298 gboolean returnValue; 299 g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[BRING_TO_FRONT], 0, &returnValue); 300 return returnValue; 301 } 302 303 static void inspectedURLChanged(WKInspectorRef, WKStringRef url, const void* clientInfo) 304 { 305 WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo); 306 CString uri = toImpl(url)->string().utf8(); 307 if (uri == inspector->priv->inspectedURI) 308 return; 309 inspector->priv->inspectedURI = uri; 310 g_object_notify(G_OBJECT(inspector), "inspected-uri"); 311 } 312 313 static bool attach(WKInspectorRef, const void* clientInfo) 314 { 315 gboolean returnValue; 316 g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[ATTACH], 0, &returnValue); 317 return returnValue; 318 } 319 320 static bool detach(WKInspectorRef, const void* clientInfo) 321 { 322 gboolean returnValue; 323 g_signal_emit(WEBKIT_WEB_INSPECTOR(clientInfo), signals[DETACH], 0, &returnValue); 324 return returnValue; 325 } 326 327 static void didChangeAttachedHeight(WKInspectorRef, unsigned height, const void* clientInfo) 328 { 329 WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo); 330 if (inspector->priv->attachedHeight == height) 331 return; 332 inspector->priv->attachedHeight = height; 333 g_object_notify(G_OBJECT(inspector), "attached-height"); 334 } 335 336 static void didChangeAttachAvailability(WKInspectorRef, bool available, const void* clientInfo) 337 { 338 WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(clientInfo); 339 if (inspector->priv->canAttach == available) 340 return; 341 inspector->priv->canAttach = available; 342 g_object_notify(G_OBJECT(clientInfo), "can-attach"); 343 } 285 class WebKitInspectorClient final : public WebInspectorProxyClient { 286 public: 287 explicit WebKitInspectorClient(WebKitWebInspector* inspector) 288 : m_inspector(inspector) 289 { 290 } 291 292 private: 293 bool openWindow(WebInspectorProxy&) override 294 { 295 gboolean returnValue; 296 g_signal_emit(m_inspector, signals[OPEN_WINDOW], 0, &returnValue); 297 return returnValue; 298 } 299 300 void didClose(WebInspectorProxy&) override 301 { 302 g_signal_emit(m_inspector, signals[CLOSED], 0); 303 } 304 305 bool bringToFront(WebInspectorProxy&) override 306 { 307 gboolean returnValue; 308 g_signal_emit(m_inspector, signals[BRING_TO_FRONT], 0, &returnValue); 309 return returnValue; 310 } 311 312 void inspectedURLChanged(WebInspectorProxy&, const String& url) override 313 { 314 CString uri = url.utf8(); 315 if (uri == m_inspector->priv->inspectedURI) 316 return; 317 m_inspector->priv->inspectedURI = uri; 318 g_object_notify(G_OBJECT(m_inspector), "inspected-uri"); 319 } 320 321 bool attach(WebInspectorProxy&) override 322 { 323 gboolean returnValue; 324 g_signal_emit(m_inspector, signals[ATTACH], 0, &returnValue); 325 return returnValue; 326 } 327 328 bool detach(WebInspectorProxy&) override 329 { 330 gboolean returnValue; 331 g_signal_emit(m_inspector, signals[DETACH], 0, &returnValue); 332 return returnValue; 333 } 334 335 void didChangeAttachedHeight(WebInspectorProxy&, unsigned height) override 336 { 337 if (m_inspector->priv->attachedHeight == height) 338 return; 339 m_inspector->priv->attachedHeight = height; 340 g_object_notify(G_OBJECT(m_inspector), "attached-height"); 341 } 342 343 void didChangeAttachedWidth(WebInspectorProxy&, unsigned width) override 344 { 345 } 346 347 void didChangeAttachAvailability(WebInspectorProxy&, bool available) override 348 { 349 if (m_inspector->priv->canAttach == available) 350 return; 351 m_inspector->priv->canAttach = available; 352 g_object_notify(G_OBJECT(m_inspector), "can-attach"); 353 } 354 355 WebKitWebInspector* m_inspector; 356 }; 344 357 345 358 WebKitWebInspector* webkitWebInspectorCreate(WebInspectorProxy* webInspector) … … 347 360 WebKitWebInspector* inspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL)); 348 361 inspector->priv->webInspector = webInspector; 349 350 WKInspectorClientGtkV0 wkInspectorClientGtk = { 351 { 352 0, // version 353 inspector, // clientInfo 354 }, 355 openWindow, 356 didClose, 357 bringToFront, 358 inspectedURLChanged, 359 attach, 360 detach, 361 didChangeAttachedHeight, 362 nullptr, // didChangeAttachedWidth 363 didChangeAttachAvailability 364 }; 365 WKInspectorSetInspectorClientGtk(toAPI(webInspector), &wkInspectorClientGtk.base); 366 362 webInspector->setClient(std::make_unique<WebKitInspectorClient>(inspector)); 367 363 return inspector; 368 364 } -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
r217924 r218089 48 48 #include <wtf/NeverDestroyed.h> 49 49 50 #if PLATFORM(GTK) 51 #include "WebInspectorProxyClient.h" 52 #endif 53 50 54 using namespace WebCore; 51 55 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h
r217924 r218089 50 50 #endif 51 51 52 #if PLATFORM(GTK)53 #include "WebInspectorClientGtk.h"54 #endif55 56 52 namespace WebCore { 57 53 class URL; … … 61 57 62 58 class WebFrameProxy; 59 class WebInspectorProxyClient; 63 60 class WebPageProxy; 64 61 class WebPreferences; … … 116 113 #if PLATFORM(GTK) 117 114 GtkWidget* inspectorView() const { return m_inspectorView; }; 118 void initializeInspectorClientGtk(const WKInspectorClientGtkBase*);115 void setClient(std::unique_ptr<WebInspectorProxyClient>&&); 119 116 #endif 120 117 … … 243 240 String m_urlString; 244 241 #elif PLATFORM(GTK) 245 WebInspectorClientGtkm_client;242 std::unique_ptr<WebInspectorProxyClient> m_client; 246 243 GtkWidget* m_inspectorView { nullptr }; 247 244 GtkWidget* m_inspectorWindow { nullptr }; -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyClient.h
r218086 r218089 26 26 #pragma once 27 27 28 #include "APIClient.h"29 #include "WKInspectorClientGtk.h"30 28 #include <wtf/text/WTFString.h> 31 32 namespace API {33 class Object;34 35 template<> struct ClientTraits<WKInspectorClientGtkBase> {36 typedef std::tuple<WKInspectorClientGtkV0> Versions;37 };38 }39 29 40 30 namespace WebKit { … … 42 32 class WebInspectorProxy; 43 33 44 class WebInspector ClientGtk : public API::Client<WKInspectorClientGtkBase>{34 class WebInspectorProxyClient { 45 35 public: 46 bool openWindow(WebInspectorProxy*);47 v oid didClose(WebInspectorProxy*);48 bool bringToFront(WebInspectorProxy*);49 v oid inspectedURLChanged(WebInspectorProxy*, const String& url);50 bool attach(WebInspectorProxy*);51 bool detach(WebInspectorProxy*);52 v oid didChangeAttachedHeight(WebInspectorProxy*, unsigned height);53 v oid didChangeAttachedWidth(WebInspectorProxy*, unsigned width);54 v oid didChangeAttachAvailability(WebInspectorProxy*, bool available);36 virtual bool openWindow(WebInspectorProxy&) = 0; 37 virtual void didClose(WebInspectorProxy&) = 0; 38 virtual bool bringToFront(WebInspectorProxy&) = 0; 39 virtual void inspectedURLChanged(WebInspectorProxy&, const String& url) = 0; 40 virtual bool attach(WebInspectorProxy&) = 0; 41 virtual bool detach(WebInspectorProxy&) = 0; 42 virtual void didChangeAttachedHeight(WebInspectorProxy&, unsigned height) = 0; 43 virtual void didChangeAttachedWidth(WebInspectorProxy&, unsigned width) = 0; 44 virtual void didChangeAttachAvailability(WebInspectorProxy&, bool available) = 0; 55 45 }; 56 46 -
trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
r215732 r218089 30 30 #include "WebInspectorProxy.h" 31 31 32 #include "WebInspectorProxyClient.h" 32 33 #include "WebKitInspectorWindow.h" 33 34 #include "WebKitWebViewBasePrivate.h" … … 57 58 } 58 59 59 void WebInspectorProxy:: initializeInspectorClientGtk(const WKInspectorClientGtkBase* inspectorClient)60 { 61 m_client .initialize(inspectorClient);60 void WebInspectorProxy::setClient(std::unique_ptr<WebInspectorProxyClient>&& client) 61 { 62 m_client = WTFMove(client); 62 63 } 63 64 … … 143 144 void WebInspectorProxy::createInspectorWindow() 144 145 { 145 if (m_client .openWindow(this))146 if (m_client && m_client->openWindow(*this)) 146 147 return; 147 148 … … 185 186 g_signal_handlers_disconnect_by_func(m_inspectorView, reinterpret_cast<void*>(inspectorViewDestroyed), this); 186 187 187 m_client.didClose(this); 188 if (m_client) 189 m_client->didClose(*this); 188 190 189 191 if (m_inspectorWindow) { … … 209 211 void WebInspectorProxy::platformBringToFront() 210 212 { 211 if (m_client .bringToFront(this))213 if (m_client && m_client->bringToFront(*this)) 212 214 return; 213 215 … … 233 235 { 234 236 m_inspectedURLString = url; 235 m_client.inspectedURLChanged(this, url); 237 if (m_client) 238 m_client->inspectedURLChanged(*this, url); 236 239 237 240 if (m_inspectorWindow) … … 286 289 } 287 290 288 if (m_client .attach(this))291 if (m_client && m_client->attach(*this)) 289 292 return; 290 293 … … 299 302 300 303 GRefPtr<GtkWidget> inspectorView = m_inspectorView; 301 if ( !m_client.detach(this)) {304 if (m_client && !m_client->detach(*this)) { 302 305 // Detach is called when m_isAttached is true, but it could called before 303 306 // the inspector is opened if the inspector is shown/closed quickly. So, … … 325 328 return; 326 329 327 m_client.didChangeAttachedHeight(this, height); 330 if (m_client) 331 m_client->didChangeAttachedHeight(*this, height); 328 332 webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(inspectedPage()->viewWidget()), height); 329 333 } … … 334 338 return; 335 339 336 m_client.didChangeAttachedWidth(this, width); 340 if (m_client) 341 m_client->didChangeAttachedWidth(*this, width); 337 342 webkitWebViewBaseSetInspectorViewSize(WEBKIT_WEB_VIEW_BASE(inspectedPage()->viewWidget()), width); 338 343 } … … 355 360 void WebInspectorProxy::platformAttachAvailabilityChanged(bool available) 356 361 { 357 m_client.didChangeAttachAvailability(this, available); 362 if (m_client) 363 m_client->didChangeAttachAvailability(*this, available); 358 364 } 359 365
Note: See TracChangeset
for help on using the changeset viewer.