Upstream ENABLE(REMOTE_INSPECTOR) and enable on iOS and Mac
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 20:59:15 +0000 (20:59 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 20:59:15 +0000 (20:59 +0000)
commita7a3bbf32c7dd3351dac6e65119bf5fa7f6d36dc
treefb4889fb65a4baaaa73d4d2a8ac050e0370e2c37
parent10e10b53ff54da3b758adf2a9f556484c68a1967
Upstream ENABLE(REMOTE_INSPECTOR) and enable on iOS and Mac
https://bugs.webkit.org/show_bug.cgi?id=123111

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:
* WebCore.exp.in:

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/cf:

* WebCoreSupport/WebInspectorClientCF.cpp:

Source/WebKit/ios:

iOS does not have a local inspector, only remote. So give it a custom
implementation separate from the WebKit/mac WebInspectorClient
implementation which handles an attaching/detaching local inspector.

* WebKit.xcodeproj/project.pbxproj:
* ios/WebCoreSupport/WebInspectorClientIOS.mm: Added.
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::inspectorDestroyed):
(WebInspectorClient::openInspectorFrontend):
(WebInspectorClient::bringFrontendToFront):
(WebInspectorClient::closeInspectorFrontend):
(WebInspectorClient::didResizeMainFrame):
(WebInspectorClient::highlight):
(WebInspectorClient::hideHighlight):
(WebInspectorClient::didSetSearchingForNode):
(WebInspectorClient::sendMessageToFrontend):
(WebInspectorClient::sendMessageToBackend):
(WebInspectorClient::setupRemoteConnection):
(WebInspectorClient::teardownRemoteConnection):
(WebInspectorClient::hasLocalSession):
(WebInspectorClient::canBeRemotelyInspected):
(WebInspectorClient::inspectedWebView):
(WebInspectorFrontendClient::WebInspectorFrontendClient):
(WebInspectorFrontendClient::attachAvailabilityChanged):
(WebInspectorFrontendClient::frontendLoaded):
(WebInspectorFrontendClient::localizedStringsURL):
(WebInspectorFrontendClient::bringToFront):
(WebInspectorFrontendClient::closeWindow):
(WebInspectorFrontendClient::disconnectFromBackend):
(WebInspectorFrontendClient::attachWindow):
(WebInspectorFrontendClient::detachWindow):
(WebInspectorFrontendClient::setAttachedWindowHeight):
(WebInspectorFrontendClient::setAttachedWindowWidth):
(WebInspectorFrontendClient::setToolbarHeight):
(WebInspectorFrontendClient::inspectedURLChanged):
(WebInspectorFrontendClient::updateWindowTitle):
(WebInspectorFrontendClient::save):
(WebInspectorFrontendClient::append):

Source/WebKit/mac:

The actual implementation at the WebCoreSupport/WebInspectorClient level
is the same as INSPECTOR_SERVER. Give debuggable pages a pageIdentifer.

* Configurations/FeatureDefines.xcconfig:
* Misc/WebKitLogging.h:
Misc.

* WebCoreSupport/WebInspectorClient.h:
(WebInspectorClient::pageId):
(WebInspectorClient::setPageId):
Give WebInspectorClient's a page identifier.

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::inspectorDestroyed):
(WebInspectorClient::sendMessageToFrontend):
(WebInspectorClient::sendMessageToBackend):
(WebInspectorClient::setupRemoteConnection):
(WebInspectorClient::teardownRemoteConnection):
(WebInspectorClient::hasLocalSession):
(WebInspectorClient::canBeRemotelyInspected):
(WebInspectorClient::inspectedWebView):
A WebInspectorClient can be either local or remote. Add handling
for remote connections.

* WebInspector/remote/WebInspectorClientRegistry.h: Added.
* WebInspector/remote/WebInspectorClientRegistry.mm: Added.
(+[WebInspectorClientRegistry sharedRegistry]):
(-[WebInspectorClientRegistry init]):
(-[WebInspectorClientRegistry _getNextAvailablePageId]):
(-[WebInspectorClientRegistry registerClient:]):
(-[WebInspectorClientRegistry unregisterClient:]):
(-[WebInspectorClientRegistry clientForPageId:]):
(-[WebInspectorClientRegistry inspectableWebViews]):
Registry for all potentially debuggable pages. All WebInspectorClient instances.

* WebInspector/remote/WebInspectorRelayDefinitions.h: Added.
Constants (message keys) shared between WebKit and the XPC process.

* WebInspector/remote/WebInspectorServer.h: Added.
* WebInspector/remote/WebInspectorServer.mm: Added.
(-[WebInspectorServer init]):
(-[WebInspectorServer dealloc]):
(-[WebInspectorServer start]):
(-[WebInspectorServer stop]):
(-[WebInspectorServer isEnabled]):
(-[WebInspectorServer xpcConnection]):
(-[WebInspectorServer setupXPCConnectionIfNeeded]):
(-[WebInspectorServer pushListing]):
(-[WebInspectorServer hasActiveDebugSession]):
(-[WebInspectorServer setHasActiveDebugSession:]):
(-[WebInspectorServer xpcConnection:receivedMessage:userInfo:]):
(-[WebInspectorServer xpcConnectionFailed:]):
(-[WebInspectorServer didRegisterClient:]):
(-[WebInspectorServer didUnregisterClient:]):
Singleton to start/stop remote inspection. Handles the connection to the XPC
and hands off connections to the connection controller.

* WebInspector/remote/WebInspectorServerWebViewConnection.h: Added.
* WebInspector/remote/WebInspectorServerWebViewConnection.mm: Added.
(-[WebInspectorServerWebViewConnection initWithController:connectionIdentifier:destination:identifier:]):
(-[WebInspectorServerWebViewConnection setupChannel]):
(-[WebInspectorServerWebViewConnection dealloc]):
(-[WebInspectorServerWebViewConnection connectionIdentifier]):
(-[WebInspectorServerWebViewConnection identifier]):
(-[WebInspectorServerWebViewConnection clearChannel]):
(-[WebInspectorServerWebViewConnection sendMessageToFrontend:]):
(-[WebInspectorServerWebViewConnection sendMessageToBackend:]):
(-[WebInspectorServerWebViewConnection receivedData:]):
(-[WebInspectorServerWebViewConnection receivedDidClose:]):
An individual remote debug session connection.

* WebInspector/remote/WebInspectorServerWebViewConnectionController.h: Added.
* WebInspector/remote/WebInspectorServerWebViewConnectionController.mm: Added.
(-[WebInspectorServerWebViewConnectionController initWithServer:]):
(-[WebInspectorServerWebViewConnectionController dealloc]):
(-[WebInspectorServerWebViewConnectionController closeAllConnections]):
(-[WebInspectorServerWebViewConnectionController _listingForWebView:pageId:registry:]):
(-[WebInspectorServerWebViewConnectionController _pushListing:]):
(-[WebInspectorServerWebViewConnectionController pushListing:]):
(-[WebInspectorServerWebViewConnectionController pushListing]):
(-[WebInspectorServerWebViewConnectionController _receivedSetup:]):
(-[WebInspectorServerWebViewConnectionController _receivedData:]):
(-[WebInspectorServerWebViewConnectionController _receivedDidClose:]):
(-[WebInspectorServerWebViewConnectionController _receivedGetListing:]):
(-[WebInspectorServerWebViewConnectionController _receivedIndicate:]):
(-[WebInspectorServerWebViewConnectionController _receivedConnectionDied:]):
(-[WebInspectorServerWebViewConnectionController receivedMessage:userInfo:]):
(-[WebInspectorServerWebViewConnectionController connectionClosing:]):
(-[WebInspectorServerWebViewConnectionController sendMessageToFrontend:userInfo:]):
ConnectionController:
  - Holds all the current ongoing remote debug connections.
  - Simplifies multi-threaded work on iOS.
  - Dispatches incoming messages from the remote connection.

* WebInspector/remote/WebInspectorRemoteChannel.h: Added.
* WebInspector/remote/WebInspectorRemoteChannel.mm: Added.
(+[WebInspectorRemoteChannel createChannelForPageId:connection:]):
(-[WebInspectorRemoteChannel initWithRemote:local:]):
(-[WebInspectorRemoteChannel closeFromLocalSide]):
(-[WebInspectorRemoteChannel closeFromRemoteSide]):
(-[WebInspectorRemoteChannel sendMessageToFrontend:]):
(-[WebInspectorRemoteChannel sendMessageToBackend:]):
Thin interface between the remote connection and web inspector client.
This simplifies breaking the connection from either side, e.g. the
page closing, or the remote connection disconnecting.

* WebInspector/remote/WebInspectorXPCWrapper.h: Added.
* WebInspector/remote/WebInspectorXPCWrapper.m: Added.
(-[WebInspectorXPCWrapper initWithConnection:]):
(-[WebInspectorXPCWrapper close]):
(-[WebInspectorXPCWrapper dealloc]):
(-[WebInspectorXPCWrapper _deserializeMessage:]):
(-[WebInspectorXPCWrapper _handleEvent:]):
(-[WebInspectorXPCWrapper sendMessage:userInfo:]):
(-[WebInspectorXPCWrapper available]):
* WebKit.exp:
XPC Connection wrapper handling a simple message format.

* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate init]):
(-[WebViewPrivate dealloc]):
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(+[WebView sharedWebInspectorServer]):
(+[WebView _enableRemoteInspector]):
(+[WebView _disableRemoteInspector]):
(+[WebView _disableAutoStartRemoteInspector]):
(+[WebView _isRemoteInspectorEnabled]):
(+[WebView _hasRemoteInspectorSession]):
(-[WebView canBeRemotelyInspected]):
(-[WebView allowsRemoteInspection]):
(-[WebView setAllowsRemoteInspection:]):
(-[WebView setIndicatingForRemoteInspector:]):
(-[WebView setRemoteInspectorUserInfo:]):
(-[WebView remoteInspectorUserInfo]):
Remote inspector private API.
  - Enable / disable globally
  - Allow / disallow per webview
  - Optionally attach a userInfo dictionary on the WebView that is published with listing.
  - Indicate a WebView (implementation to land later)

(-[WebView _didCommitLoadForFrame:]):
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidReceiveTitle):
Pages changed, pushed page listing.

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

* wtf/FeatureDefines.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
40 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WTF/ChangeLog
Source/WTF/wtf/FeatureDefines.h
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/WebCore.exp.in
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/cf/ChangeLog
Source/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp
Source/WebKit/ios/ChangeLog [new file with mode: 0644]
Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm [new file with mode: 0644]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit/mac/Misc/WebKitLogging.h
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/mac/WebInspector/remote/WebInspectorClientRegistry.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorClientRegistry.mm [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorRelayDefinitions.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorRemoteChannel.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorRemoteChannel.mm [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorServer.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorServer.mm [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorServerWebViewConnection.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorServerWebViewConnection.mm [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorServerWebViewConnectionController.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorServerWebViewConnectionController.mm [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorXPCWrapper.h [new file with mode: 0644]
Source/WebKit/mac/WebInspector/remote/WebInspectorXPCWrapper.m [new file with mode: 0644]
Source/WebKit/mac/WebKit.exp
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewData.h
Source/WebKit/mac/WebView/WebViewData.mm
Source/WebKit/mac/WebView/WebViewInternal.h
Source/WebKit/mac/WebView/WebViewPrivate.h
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/FeatureDefines.xcconfig