Changeset 113028 in webkit
- Timestamp:
- Apr 3, 2012 6:24:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r113027 r113028 1 2012-04-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 Enable and connect the WebInspectorServer with WebKit2 pages. 4 https://bugs.webkit.org/show_bug.cgi?id=73094 5 6 Reviewed by Simon Hausmann. 7 8 Pages are registered/unregistered as they are created/destroyed, if they have 9 developer extras enabled. The server is run on the UI process and communicates 10 with the web process through IPC for each message between the inspector 11 controller and the remote frontend. 12 13 Includes the server spawning logic for the Qt port, the server is 14 started through an environment variable specifying the interface and 15 port to bind the server to, by default on 127.0.0.1. 16 17 * UIProcess/WebInspectorProxy.cpp: 18 (WebKit::WebInspectorProxy::WebInspectorProxy): 19 (WebKit::WebInspectorProxy::invalidate): 20 (WebKit): 21 (WebKit::WebInspectorProxy::enableRemoteInspection): 22 (WebKit::WebInspectorProxy::remoteFrontendConnected): 23 (WebKit::WebInspectorProxy::remoteFrontendDisconnected): 24 (WebKit::WebInspectorProxy::dispatchMessageFromRemoteFrontend): 25 (WebKit::WebInspectorProxy::sendMessageToRemoteFrontend): 26 * UIProcess/WebInspectorProxy.h: 27 (WebInspectorProxy): 28 * UIProcess/WebInspectorProxy.messages.in: 29 * UIProcess/WebPageProxy.cpp: 30 (WebKit::WebPageProxy::initializeWebPage): 31 (WebKit::WebPageProxy::preferencesDidChange): 32 * UIProcess/qt/QtWebContext.cpp: 33 (WebKit::initInspectorServer): 34 (WebKit): 35 (WebKit::globalInitialization): 36 (WebKit::QtWebContext::create): 37 * WebProcess/WebCoreSupport/WebInspectorClient.cpp: 38 (WebKit::WebInspectorClient::sendMessageToFrontend): 39 * WebProcess/WebPage/WebInspector.cpp: 40 (WebKit::WebInspector::WebInspector): 41 (WebKit): 42 (WebKit::WebInspector::sendMessageToRemoteFrontend): 43 (WebKit::WebInspector::dispatchMessageFromRemoteFrontend): 44 (WebKit::WebInspector::remoteFrontendConnected): 45 (WebKit::WebInspector::remoteFrontendDisconnected): 46 * WebProcess/WebPage/WebInspector.h: 47 (WebInspector): 48 (WebKit::WebInspector::hasRemoteFrontendConnected): 49 * WebProcess/WebPage/WebInspector.messages.in: 50 1 51 2012-03-29 Joseph Pecoraro <joepeck@webkit.org> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 52 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
r112808 r113028 40 40 #include "WebURLRequest.h" 41 41 42 #if ENABLE(INSPECTOR_SERVER) 43 #include "WebInspectorServer.h" 44 #endif 42 45 #if PLATFORM(WIN) 43 46 #include "WebView.h" … … 82 85 , m_inspectorWindow(0) 83 86 #endif 87 #if ENABLE(INSPECTOR_SERVER) 88 , m_remoteInspectionPageId(0) 89 #endif 84 90 { 85 91 } … … 91 97 void WebInspectorProxy::invalidate() 92 98 { 99 #if ENABLE(INSPECTOR_SERVER) 100 if (m_remoteInspectionPageId) 101 WebInspectorServer::shared().unregisterPage(m_remoteInspectionPageId); 102 #endif 103 93 104 m_page->close(); 94 105 didClose(); … … 256 267 webInspectorProxy->page()->loadURLRequest(toImpl(requestRef)); 257 268 } 269 270 #if ENABLE(INSPECTOR_SERVER) 271 void WebInspectorProxy::enableRemoteInspection() 272 { 273 if (!m_remoteInspectionPageId) 274 m_remoteInspectionPageId = WebInspectorServer::shared().registerPage(this); 275 } 276 277 void WebInspectorProxy::remoteFrontendConnected() 278 { 279 m_page->process()->send(Messages::WebInspector::RemoteFrontendConnected(), m_page->pageID()); 280 } 281 282 void WebInspectorProxy::remoteFrontendDisconnected() 283 { 284 m_page->process()->send(Messages::WebInspector::RemoteFrontendDisconnected(), m_page->pageID()); 285 } 286 287 void WebInspectorProxy::dispatchMessageFromRemoteFrontend(const String& message) 288 { 289 m_page->process()->send(Messages::WebInspector::DispatchMessageFromRemoteFrontend(message), m_page->pageID()); 290 } 291 #endif 258 292 259 293 // Called by WebInspectorProxy messages … … 349 383 } 350 384 385 #if ENABLE(INSPECTOR_SERVER) 386 void WebInspectorProxy::sendMessageToRemoteFrontend(const String& message) 387 { 388 ASSERT(m_remoteInspectionPageId); 389 WebInspectorServer::shared().sendMessageOverConnection(m_remoteInspectionPageId, message); 390 } 391 #endif 392 351 393 } // namespace WebKit 352 394 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h
r112808 r113028 124 124 String inspectorBaseURL() const; 125 125 126 #if ENABLE(INSPECTOR_SERVER) 127 void enableRemoteInspection(); 128 void remoteFrontendConnected(); 129 void remoteFrontendDisconnected(); 130 void dispatchMessageFromRemoteFrontend(const String& message); 131 #endif 132 126 133 private: 127 134 WebInspectorProxy(WebPageProxy* page); … … 146 153 void bringToFront(); 147 154 void inspectedURLChanged(const String&); 155 156 #if ENABLE(INSPECTOR_SERVER) 157 void sendMessageToRemoteFrontend(const String& message); 158 #endif 148 159 149 160 bool canAttach(); … … 195 206 GtkWidget* m_inspectorWindow; 196 207 #endif 208 #if ENABLE(INSPECTOR_SERVER) 209 int m_remoteInspectionPageId; 210 #endif 197 211 }; 198 212 -
trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in
r92587 r113028 33 33 Detach() 34 34 SetAttachedWindowHeight(unsigned height) 35 36 #if ENABLE(INSPECTOR_SERVER) 37 SendMessageToRemoteFrontend(WTF::String message) 38 #endif 35 39 } 36 40 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r112821 r113028 340 340 ASSERT(m_drawingArea); 341 341 342 #if ENABLE(INSPECTOR_SERVER) 343 if (m_pageGroup->preferences()->developerExtrasEnabled()) 344 inspector()->enableRemoteInspection(); 345 #endif 346 342 347 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0); 343 348 } … … 1571 1576 if (!isValid()) 1572 1577 return; 1578 1579 #if ENABLE(INSPECTOR_SERVER) 1580 if (m_pageGroup->preferences()->developerExtrasEnabled()) 1581 inspector()->enableRemoteInspection(); 1582 #endif 1573 1583 1574 1584 // FIXME: It probably makes more sense to send individual preference changes. -
trunk/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
r109121 r113028 27 27 #include "WKAPICast.h" 28 28 #include "WebContext.h" 29 #include "WebInspectorServer.h" 29 30 #include "WebPageProxy.h" 30 31 #include <WKArray.h> … … 44 45 45 46 QtWebContext* QtWebContext::s_defaultContext = 0; 47 48 static void initInspectorServer() 49 { 50 QString inspectorEnv = QString::fromUtf8(qgetenv("QTWEBKIT_INSPECTOR_SERVER")); 51 if (!inspectorEnv.isEmpty()) { 52 QString bindAddress = QLatin1String("127.0.0.1"); 53 QString portStr = inspectorEnv; 54 int port = 0; 55 56 int portColonPos = inspectorEnv.lastIndexOf(':'); 57 if (portColonPos != -1) { 58 portStr = inspectorEnv.mid(portColonPos + 1); 59 bindAddress = inspectorEnv.mid(0, portColonPos); 60 } 61 62 bool ok = false; 63 port = portStr.toInt(&ok); 64 if (!ok) { 65 qWarning("Non numeric port for the inspector server \"%s\". Examples of valid input: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface).", qPrintable(portStr)); 66 return; 67 } 68 69 bool success = WebInspectorServer::shared().listen(bindAddress, port); 70 if (success) { 71 QString inspectorServerUrl = QString::fromLatin1("http://%1:%2").arg(bindAddress).arg(port); 72 qWarning("Inspector server started successfully. Try pointing a WebKit browser to %s", qPrintable(inspectorServerUrl)); 73 } else 74 qWarning("Couldn't start the inspector server on bind address \"%s\" and port \"%d\". In case of invalid input, try something like: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface).", qPrintable(bindAddress), port); 75 } 76 } 77 78 static void globalInitialization() 79 { 80 static bool initialized = false; 81 if (initialized) 82 return; 83 84 initInspectorServer(); 85 initialized = true; 86 } 46 87 47 88 QtWebContext::QtWebContext(WebContext* context) … … 64 105 PassRefPtr<QtWebContext> QtWebContext::create(WebContext* context) 65 106 { 107 globalInitialization(); 66 108 return adoptRef(new QtWebContext(context)); 67 109 } -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
r110390 r113028 90 90 if (!inspector) 91 91 return false; 92 93 #if ENABLE(INSPECTOR_SERVER) 94 if (inspector->hasRemoteFrontendConnected()) { 95 inspector->sendMessageToRemoteFrontend(message); 96 return true; 97 } 98 #endif 99 92 100 WebPage* inspectorPage = inspector->inspectorPage(); 93 if (!inspectorPage) 94 return false; 95 return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message); 101 if (inspectorPage) 102 return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message); 103 104 return false; 96 105 } 97 106 -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
r110390 r113028 51 51 , m_inspectorPage(0) 52 52 , m_frontendClient(0) 53 #if ENABLE(INSPECTOR_SERVER) 54 , m_remoteFrontendConnected(false) 55 #endif 53 56 { 54 57 } … … 237 240 } 238 241 242 #if ENABLE(INSPECTOR_SERVER) 243 void WebInspector::sendMessageToRemoteFrontend(const String& message) 244 { 245 ASSERT(m_remoteFrontendConnected); 246 WebProcess::shared().connection()->send(Messages::WebInspectorProxy::SendMessageToRemoteFrontend(message), m_page->pageID()); 247 } 248 249 void WebInspector::dispatchMessageFromRemoteFrontend(const String& message) 250 { 251 m_page->corePage()->inspectorController()->dispatchMessageFromFrontend(message); 252 } 253 254 void WebInspector::remoteFrontendConnected() 255 { 256 ASSERT(!m_remoteFrontendConnected); 257 // Switching between in-process and remote inspectors isn't supported yet. 258 ASSERT(!m_inspectorPage); 259 260 m_page->corePage()->inspectorController()->connectFrontend(); 261 m_remoteFrontendConnected = true; 262 } 263 264 void WebInspector::remoteFrontendDisconnected() 265 { 266 ASSERT(m_remoteFrontendConnected); 267 m_page->corePage()->inspectorController()->disconnectFrontend(); 268 m_remoteFrontendConnected = false; 269 } 270 #endif 271 239 272 } // namespace WebKit 240 273 -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h
r110425 r113028 62 62 void stopPageProfiling(); 63 63 64 #if ENABLE(INSPECTOR_SERVER) 65 bool hasRemoteFrontendConnected() const { return m_remoteFrontendConnected; } 66 void sendMessageToRemoteFrontend(const String& message); 67 void dispatchMessageFromRemoteFrontend(const String& message); 68 void remoteFrontendConnected(); 69 void remoteFrontendDisconnected(); 70 #endif 71 64 72 #if PLATFORM(MAC) 65 73 void setInspectorUsesWebKitUserInterface(bool); … … 112 120 String m_localizedStringsURL; 113 121 #endif 122 #if ENABLE(INSPECTOR_SERVER) 123 bool m_remoteFrontendConnected; 124 #endif 114 125 }; 115 126 -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in
r107757 r113028 35 35 StartPageProfiling() 36 36 StopPageProfiling() 37 38 #if ENABLE(INSPECTOR_SERVER) 39 DispatchMessageFromRemoteFrontend(WTF::String message) 40 RemoteFrontendConnected() 41 RemoteFrontendDisconnected() 42 #endif 37 43 } 38 44 -
trunk/Tools/ChangeLog
r113018 r113028 1 2012-04-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 Enable and connect the WebInspectorServer with WebKit2 pages. 4 https://bugs.webkit.org/show_bug.cgi?id=73094 5 6 Reviewed by Simon Hausmann. 7 8 Enable developer extras on pages in MiniBrowser for Qt. 9 10 * MiniBrowser/qt/qml/BrowserWindow.qml: 11 1 12 2012-04-03 Christophe Dumez <christophe.dumez@intel.com> 2 13 -
trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml
r111722 r113028 315 315 experimental.proxyAuthenticationDialog: ProxyAuthenticationDialog { } 316 316 experimental.filePicker: FilePicker { } 317 experimental.preferences.developerExtrasEnabled: true 317 318 experimental.databaseQuotaDialog: Item { 318 319 Timer {
Note: See TracChangeset
for help on using the changeset viewer.