Commit d2ecf37f authored by joepeck@webkit.org's avatar joepeck@webkit.org

Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore

https://bugs.webkit.org/show_bug.cgi?id=124613

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Move the ENABLE(REMOTE_INSPECTOR) remote debugger connection management
into JavaScriptCore (originally from WebKit/mac). Include enhancements:

  * allow for different types of remote debuggable targets,
    eventually at least a JSContext, WebView, WKView.
  * allow debuggables to be registered and debugged on any thread. Unlike
    WebViews, JSContexts may be run entirely off of the main thread.
  * move the remote connection (XPC connection) itself off of the main thread,
    it doesn't need to be on the main thread.

Make JSContext @class and JavaScriptCore::JSContextRef
"JavaScript" Remote Debuggables.

* inspector/remote/RemoteInspectorDebuggable.h: Added.
* inspector/remote/RemoteInspectorDebuggable.cpp: Added.
(Inspector::RemoteInspectorDebuggable::RemoteInspectorDebuggable):
(Inspector::RemoteInspectorDebuggable::~RemoteInspectorDebuggable):
(Inspector::RemoteInspectorDebuggable::init):
(Inspector::RemoteInspectorDebuggable::update):
(Inspector::RemoteInspectorDebuggable::setRemoteDebuggingAllowed):
(Inspector::RemoteInspectorDebuggable::info):
RemoteInspectorDebuggable defines a debuggable target. As long as
something creates a debuggable and is set to allow remote inspection
it will be listed in remote debuggers. For the different types of
debuggables (JavaScript and Web) there is different basic information
that may be listed.

* inspector/InspectorFrontendChannel.h: Added.
(Inspector::InspectorFrontendChannel::~InspectorFrontendChannel):
The only thing a debuggable needs for remote debugging is an
InspectorFrontendChannel a way to send messages to a remote frontend.
This class provides that method, and is vended to the
RemoteInspectorDebuggable when a remote connection is setup.

* inspector/remote/RemoteInspector.h: Added.
* inspector/remote/RemoteInspector.mm: Added.
Singleton, created at least when the first Debuggable is created.
This class manages the list of debuggables, any connection to a
remote debugger proxy (XPC service "com.apple.webinspector").

(Inspector::dispatchAsyncOnQueueSafeForAnyDebuggable):
(Inspector::RemoteInspector::shared):
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::nextAvailableIdentifier):
(Inspector::RemoteInspector::registerDebuggable):
(Inspector::RemoteInspector::unregisterDebuggable):
(Inspector::RemoteInspector::updateDebuggable):
Debuggable management. When debuggables are added, removed, or updated
we stash a copy of the debuggable information and push an update to
debuggers. Stashing a copy of the information in the RemoteInspector
is a thread safe way to avoid walking over all debuggables to gather
the information when it is needed.

(Inspector::RemoteInspector::start):
(Inspector::RemoteInspector::stop):
Runtime API to enable / disable the feature.

(Inspector::RemoteInspector::listingForDebuggable):
(Inspector::RemoteInspector::pushListingNow):
(Inspector::RemoteInspector::pushListingSoon):
Pushing a listing to remote debuggers.

(Inspector::RemoteInspector::sendMessageToRemoteFrontend):
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
(Inspector::RemoteInspector::xpcConnectionReceivedMessage):
(Inspector::RemoteInspector::xpcConnectionFailed):
(Inspector::RemoteInspector::xpcConnectionUnhandledMessage):
XPC setup, send, and receive handling.

(Inspector::RemoteInspector::updateHasActiveDebugSession):
Applications being debugged may want to know when a debug
session is active. This provides that notification.

(Inspector::RemoteInspector::receivedSetupMessage):
(Inspector::RemoteInspector::receivedDataMessage):
(Inspector::RemoteInspector::receivedDidCloseMessage):
(Inspector::RemoteInspector::receivedGetListingMessage):
(Inspector::RemoteInspector::receivedIndicateMessage):
(Inspector::RemoteInspector::receivedConnectionDiedMessage):
Dispatching incoming remote debugging protocol messages.
These are wrapping above the inspector protocol messages.

* inspector/remote/RemoteInspectorConstants.h: Added.
Protocol messages and dictionary keys inside the messages.

(Inspector::RemoteInspectorDebuggableInfo::RemoteInspectorDebuggableInfo):
* inspector/remote/RemoteInspectorDebuggableConnection.h: Added.
* inspector/remote/RemoteInspectorDebuggableConnection.mm: Added.
This is a connection between the RemoteInspector singleton and a RemoteInspectorDebuggable.

(Inspector::RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection):
(Inspector::RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection):
Allow for dispatching messages on JavaScript debuggables on a dispatch_queue
instead of the main queue.

(Inspector::RemoteInspectorDebuggableConnection::destination):
(Inspector::RemoteInspectorDebuggableConnection::connectionIdentifier):
Needed in the remote debugging protocol to identify the remote debugger.

(Inspector::RemoteInspectorDebuggableConnection::dispatchSyncOnDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::setup):
(Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::close):
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToFrontend):
The connection is a thin channel between the two sides that can be closed
from either side, so there is some logic around multi-threaded access.

* inspector/remote/RemoteInspectorXPCConnection.h: Added.
(Inspector::RemoteInspectorXPCConnection::Client::~Client):
* inspector/remote/RemoteInspectorXPCConnection.mm: Added.
(Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::close):
(Inspector::RemoteInspectorXPCConnection::deserializeMessage):
(Inspector::RemoteInspectorXPCConnection::handleEvent):
(Inspector::RemoteInspectorXPCConnection::sendMessage):
This is a connection between the RemoteInspector singleton and an XPC service
named "com.apple.webinspector". This handles serialization of the dictionary
messages to and from the service. The receiving is done on a non-main queue.

* API/JSContext.h:
* API/JSContext.mm:
(-[JSContext name]):
(-[JSContext setName:]):
ObjC API to enable/disable JSContext remote inspection and give a name.

* API/JSContextRef.h:
* API/JSContextRef.cpp:
(JSGlobalContextGetName):
(JSGlobalContextSetName):
C API to give a JSContext a name.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::setName):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::name):
Shared handling of the APIs above.

* runtime/JSGlobalObjectDebuggable.cpp: Added.
(JSC::JSGlobalObjectDebuggable::JSGlobalObjectDebuggable):
(JSC::JSGlobalObjectDebuggable::name):
(JSC::JSGlobalObjectDebuggable::connect):
(JSC::JSGlobalObjectDebuggable::disconnect):
(JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend):
* runtime/JSGlobalObjectDebuggable.h: Added.
Stub for the actual remote debugging implementation. We will push
down the appropriate WebCore/inspector peices suitable for debugging
just a JavaScript context.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* GNUmakefile.am:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
Update build files.

Source/WebCore:

Make a WebCore::Page a "Web" Remote Debuggable.

* bindings/js/JSDOMGlobalObject.cpp:
Disable JavaScript context inspection on JSGlobalObjects inside WebCore::Page's.

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::remoteInspectionAllowed):
(WebCore::Page::setRemoteInspectionAllowed):
(WebCore::Page::remoteInspectorInformationDidChange):
* page/Page.h:
* page/PageDebuggable.h:
* page/PageDebuggable.cpp: Added.
(WebCore::PageDebuggable::PageDebuggable):
(WebCore::PageDebuggable::name):
(WebCore::PageDebuggable::url):
(WebCore::PageDebuggable::hasLocalDebugger):
(WebCore::PageDebuggable::connect):
(WebCore::PageDebuggable::disconnect):
(WebCore::PageDebuggable::dispatchMessageFromRemoteFrontend):
(WebCore::PageDebuggable::setIndicating):
Make a page a "Web" debuggable.

* GNUmakefile.list.am:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
Misc.

* inspector/InspectorClient.h:
(WebCore::InspectorClient::indicate):
(WebCore::InspectorClient::hideIndicate):
Forward indicate methods to WebKit clients.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didChangeTitle):
(WebCore::FrameLoader::dispatchDidCommitLoad):
Push updates when remote debuggable information like the Page's
URL or title change.

* ForwardingHeaders/inspector/InspectorFrontendChannel.h:
* inspector/InspectorForwarding.h:
Re-export Inspector::InspectorFrontendChannel as WebCore::InspectorFrontendChannel
to avoid needlessly updating code all over the place.

* inspector/CodeGeneratorInspectorStrings.py:
* inspector/InspectorWorkerAgent.cpp:
* inspector/WorkerInspectorController.cpp:
* testing/Internals.cpp:
Update include names.

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
Make the "Inspect Element" context menu work correctly when there is a
remote inspector instead of a local inspector.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/blackberry:

* WebCoreSupport/InspectorClientBlackBerry.h:

Source/WebKit/cf:

* WebCoreSupport/WebInspectorClientCF.cpp:
(WebInspectorClient::sendMessageToFrontend):

Source/WebKit/efl:

* WebCoreSupport/InspectorClientEfl.h:

Source/WebKit/gtk:

* WebCoreSupport/InspectorClientGtk.h:

Source/WebKit/ios:

* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::inspectorDestroyed):

Source/WebKit/mac:

Remove the old ENABLE(REMOTE_INSPECTOR) connection management implementation.

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::indicate):
(WebInspectorClient::hideIndicate):
Hook up WebView indication through this new path.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidReceiveTitle):
* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::inspectorDestroyed):
* WebInspector/remote/WebInspectorClientRegistry.h: Removed.
* WebInspector/remote/WebInspectorClientRegistry.mm: Removed.
* WebInspector/remote/WebInspectorRelayDefinitions.h: Removed.
* WebInspector/remote/WebInspectorRemoteChannel.h: Removed.
* WebInspector/remote/WebInspectorRemoteChannel.mm: Removed.
* WebInspector/remote/WebInspectorServer.h: Removed.
* WebInspector/remote/WebInspectorServer.mm: Removed.
* WebInspector/remote/WebInspectorServerWebViewConnection.h: Removed.
* WebInspector/remote/WebInspectorServerWebViewConnection.mm: Removed.
* WebInspector/remote/WebInspectorServerWebViewConnectionController.h: Removed.
* WebInspector/remote/WebInspectorServerWebViewConnectionController.mm: Removed.
* WebInspector/remote/WebInspectorXPCWrapper.h: Removed.
* WebInspector/remote/WebInspectorXPCWrapper.m: Removed.
* WebKit.exp:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(+[WebView _enableRemoteInspector]):
(+[WebView _disableRemoteInspector]):
(+[WebView _disableAutoStartRemoteInspector]):
(+[WebView _isRemoteInspectorEnabled]):
(+[WebView _hasRemoteInspectorSession]):
(-[WebView allowsRemoteInspection]):
(-[WebView setAllowsRemoteInspection:]):
(-[WebView setIndicatingForRemoteInspector:]):
(-[WebView setHostApplicationBundleId:name:]):
(-[WebView _didCommitLoadForFrame:]):
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate init]):
(-[WebViewPrivate dealloc]):
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:
Remove old REMOTE_INSPECTOR.

Source/WebKit/win:

* WebCoreSupport/WebInspectorClient.h:

Source/WebKit/wince:

* WebCoreSupport/InspectorClientWinCE.h:

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/com.apple.WebProcess.sb.in:
Allow the WebProcess to access the "com.apple.webinspector" named
XPC service to expose its WebCore::Page's to remote debuggers.

Source/WTF:

* wtf/ios/WebCoreThread.cpp:
* wtf/ios/WebCoreThread.h:
Expose WebThreadRun/WebThreadRunSync iOS methods defined in WebCore through
WTF so that JavaScriptCore can use it. Another such method already existed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2607c676
......@@ -164,6 +164,12 @@ OBJC_VISIBLE
*/
@property(readonly, retain) JSVirtualMachine *virtualMachine;
/*!
@property
@discussion Name of the JSContext. Exposed when remote debugging the context.
*/
@property(copy) NSString *name;
@end
/*!
......
......@@ -166,6 +166,22 @@
return m_virtualMachine;
}
- (NSString *)name
{
JSStringRef name = JSGlobalContextCopyName(m_context);
if (!name)
return nil;
return [(NSString *)JSStringCopyCFString(kCFAllocatorDefault, name) autorelease];
}
- (void)setName:(NSString *)name
{
JSStringRef nameJS = JSStringCreateWithCFString((CFStringRef)[name copy]);
JSGlobalContextSetName(m_context, nameJS);
JSStringRelease(nameJS);
}
@end
@implementation JSContext(SubscriptSupport)
......
......@@ -213,6 +213,37 @@ JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx)
return toGlobalRef(exec->lexicalGlobalObject()->globalExec());
}
JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx)
{
if (!ctx) {
ASSERT_NOT_REACHED();
return 0;
}
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
String name = exec->vmEntryGlobalObject()->name();
if (name.isNull())
return 0;
return OpaqueJSString::create(name).leakRef();
}
void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name)
{
if (!ctx) {
ASSERT_NOT_REACHED();
return;
}
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
exec->vmEntryGlobalObject()->setName(name ? name->string() : String());
}
class BacktraceFunctor {
public:
BacktraceFunctor(StringBuilder& builder, unsigned remainingCapacityForFrameCapture)
......
......@@ -133,6 +133,24 @@ JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) AVAILABLE_IN_WEB
*/
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) CF_AVAILABLE(10_7, 4_0);
/*!
@function
@abstract Gets a copy of the name of a context.
@param ctx The JSGlobalContext whose name you want to get.
@result The name for ctx.
@discussion A JSGlobalContext's name is exposed for remote debugging to make it
easier to identify the context you would like to attach to.
*/
JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx);
/*!
@function
@abstract Sets the remote debugging name for a context.
@param ctx The JSGlobalContext that you want to name.
@param name The remote debugging name to set on ctx.
*/
JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name);
#ifdef __cplusplus
}
#endif
......
......@@ -11,6 +11,7 @@ set(JavaScriptCore_INCLUDE_DIRECTORIES
"${JAVASCRIPTCORE_DIR}/ftl"
"${JAVASCRIPTCORE_DIR}/heap"
"${JAVASCRIPTCORE_DIR}/debugger"
"${JAVASCRIPTCORE_DIR}/inspector"
"${JAVASCRIPTCORE_DIR}/interpreter"
"${JAVASCRIPTCORE_DIR}/jit"
"${JAVASCRIPTCORE_DIR}/llint"
......@@ -584,6 +585,7 @@ set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
collector/handles
debugger
heap
inspector
interpreter
jit
llint
......
2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=124613
Reviewed by Timothy Hatcher.
Move the ENABLE(REMOTE_INSPECTOR) remote debugger connection management
into JavaScriptCore (originally from WebKit/mac). Include enhancements:
* allow for different types of remote debuggable targets,
eventually at least a JSContext, WebView, WKView.
* allow debuggables to be registered and debugged on any thread. Unlike
WebViews, JSContexts may be run entirely off of the main thread.
* move the remote connection (XPC connection) itself off of the main thread,
it doesn't need to be on the main thread.
Make JSContext @class and JavaScriptCore::JSContextRef
"JavaScript" Remote Debuggables.
* inspector/remote/RemoteInspectorDebuggable.h: Added.
* inspector/remote/RemoteInspectorDebuggable.cpp: Added.
(Inspector::RemoteInspectorDebuggable::RemoteInspectorDebuggable):
(Inspector::RemoteInspectorDebuggable::~RemoteInspectorDebuggable):
(Inspector::RemoteInspectorDebuggable::init):
(Inspector::RemoteInspectorDebuggable::update):
(Inspector::RemoteInspectorDebuggable::setRemoteDebuggingAllowed):
(Inspector::RemoteInspectorDebuggable::info):
RemoteInspectorDebuggable defines a debuggable target. As long as
something creates a debuggable and is set to allow remote inspection
it will be listed in remote debuggers. For the different types of
debuggables (JavaScript and Web) there is different basic information
that may be listed.
* inspector/InspectorFrontendChannel.h: Added.
(Inspector::InspectorFrontendChannel::~InspectorFrontendChannel):
The only thing a debuggable needs for remote debugging is an
InspectorFrontendChannel a way to send messages to a remote frontend.
This class provides that method, and is vended to the
RemoteInspectorDebuggable when a remote connection is setup.
* inspector/remote/RemoteInspector.h: Added.
* inspector/remote/RemoteInspector.mm: Added.
Singleton, created at least when the first Debuggable is created.
This class manages the list of debuggables, any connection to a
remote debugger proxy (XPC service "com.apple.webinspector").
(Inspector::dispatchAsyncOnQueueSafeForAnyDebuggable):
(Inspector::RemoteInspector::shared):
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::nextAvailableIdentifier):
(Inspector::RemoteInspector::registerDebuggable):
(Inspector::RemoteInspector::unregisterDebuggable):
(Inspector::RemoteInspector::updateDebuggable):
Debuggable management. When debuggables are added, removed, or updated
we stash a copy of the debuggable information and push an update to
debuggers. Stashing a copy of the information in the RemoteInspector
is a thread safe way to avoid walking over all debuggables to gather
the information when it is needed.
(Inspector::RemoteInspector::start):
(Inspector::RemoteInspector::stop):
Runtime API to enable / disable the feature.
(Inspector::RemoteInspector::listingForDebuggable):
(Inspector::RemoteInspector::pushListingNow):
(Inspector::RemoteInspector::pushListingSoon):
Pushing a listing to remote debuggers.
(Inspector::RemoteInspector::sendMessageToRemoteFrontend):
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
(Inspector::RemoteInspector::xpcConnectionReceivedMessage):
(Inspector::RemoteInspector::xpcConnectionFailed):
(Inspector::RemoteInspector::xpcConnectionUnhandledMessage):
XPC setup, send, and receive handling.
(Inspector::RemoteInspector::updateHasActiveDebugSession):
Applications being debugged may want to know when a debug
session is active. This provides that notification.
(Inspector::RemoteInspector::receivedSetupMessage):
(Inspector::RemoteInspector::receivedDataMessage):
(Inspector::RemoteInspector::receivedDidCloseMessage):
(Inspector::RemoteInspector::receivedGetListingMessage):
(Inspector::RemoteInspector::receivedIndicateMessage):
(Inspector::RemoteInspector::receivedConnectionDiedMessage):
Dispatching incoming remote debugging protocol messages.
These are wrapping above the inspector protocol messages.
* inspector/remote/RemoteInspectorConstants.h: Added.
Protocol messages and dictionary keys inside the messages.
(Inspector::RemoteInspectorDebuggableInfo::RemoteInspectorDebuggableInfo):
* inspector/remote/RemoteInspectorDebuggableConnection.h: Added.
* inspector/remote/RemoteInspectorDebuggableConnection.mm: Added.
This is a connection between the RemoteInspector singleton and a RemoteInspectorDebuggable.
(Inspector::RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection):
(Inspector::RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection):
Allow for dispatching messages on JavaScript debuggables on a dispatch_queue
instead of the main queue.
(Inspector::RemoteInspectorDebuggableConnection::destination):
(Inspector::RemoteInspectorDebuggableConnection::connectionIdentifier):
Needed in the remote debugging protocol to identify the remote debugger.
(Inspector::RemoteInspectorDebuggableConnection::dispatchSyncOnDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::setup):
(Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
(Inspector::RemoteInspectorDebuggableConnection::close):
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToFrontend):
The connection is a thin channel between the two sides that can be closed
from either side, so there is some logic around multi-threaded access.
* inspector/remote/RemoteInspectorXPCConnection.h: Added.
(Inspector::RemoteInspectorXPCConnection::Client::~Client):
* inspector/remote/RemoteInspectorXPCConnection.mm: Added.
(Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::close):
(Inspector::RemoteInspectorXPCConnection::deserializeMessage):
(Inspector::RemoteInspectorXPCConnection::handleEvent):
(Inspector::RemoteInspectorXPCConnection::sendMessage):
This is a connection between the RemoteInspector singleton and an XPC service
named "com.apple.webinspector". This handles serialization of the dictionary
messages to and from the service. The receiving is done on a non-main queue.
* API/JSContext.h:
* API/JSContext.mm:
(-[JSContext name]):
(-[JSContext setName:]):
ObjC API to enable/disable JSContext remote inspection and give a name.
* API/JSContextRef.h:
* API/JSContextRef.cpp:
(JSGlobalContextGetName):
(JSGlobalContextSetName):
C API to give a JSContext a name.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::setName):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::name):
Shared handling of the APIs above.
* runtime/JSGlobalObjectDebuggable.cpp: Added.
(JSC::JSGlobalObjectDebuggable::JSGlobalObjectDebuggable):
(JSC::JSGlobalObjectDebuggable::name):
(JSC::JSGlobalObjectDebuggable::connect):
(JSC::JSGlobalObjectDebuggable::disconnect):
(JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend):
* runtime/JSGlobalObjectDebuggable.h: Added.
Stub for the actual remote debugging implementation. We will push
down the appropriate WebCore/inspector peices suitable for debugging
just a JavaScript context.
* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* GNUmakefile.am:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
Update build files.
2013-12-04 Michael Saboff <msaboff@apple.com>
Move the setting up of callee's callFrame from pushFrame to callToJavaScript thunk
......
......@@ -59,6 +59,7 @@ javascriptcore_cppflags += \
-I$(srcdir)/Source/JavaScriptCore/disassembler \
-I$(srcdir)/Source/JavaScriptCore/ftl \
-I$(srcdir)/Source/JavaScriptCore/heap \
-I$(srcdir)/Source/JavaScriptCore/inspector \
-I$(srcdir)/Source/JavaScriptCore/interpreter \
-I$(srcdir)/Source/JavaScriptCore/jit \
-I$(srcdir)/Source/JavaScriptCore/llint \
......
......@@ -610,6 +610,7 @@ javascriptcore_sources += \
Source/JavaScriptCore/icu/unicode/utf_old.h \
Source/JavaScriptCore/icu/unicode/utypes.h \
Source/JavaScriptCore/icu/unicode/uversion.h \
Source/JavaScriptCore/inspector/InspectorFrontendChannel.h \
Source/JavaScriptCore/interpreter/AbstractPC.cpp \
Source/JavaScriptCore/interpreter/AbstractPC.h \
Source/JavaScriptCore/interpreter/CachedCall.h \
......
......@@ -996,6 +996,7 @@
<ClInclude Include="..\heap\WeakSet.h" />
<ClInclude Include="..\heap\WeakSetInlines.h" />
<ClInclude Include="..\heap\WriteBarrierSupport.h" />
<ClInclude Include="..\inspector\InspectorFrontendChannel.h" />
<ClInclude Include="..\interpreter\AbstractPC.h" />
<ClInclude Include="..\interpreter\CachedCall.h" />
<ClInclude Include="..\interpreter\CallFrame.h" />
......
......@@ -25,6 +25,9 @@
<Filter Include="heap">
<UniqueIdentifier>{bd49e5cf-95d6-4151-b286-8837ccd347fa}</UniqueIdentifier>
</Filter>
<Filter Include="inspector">
<UniqueIdentifier>{09ae09da-1239-00ea-8dfe-9087ae123bbe}</UniqueIdentifier>
</Filter>
<Filter Include="interpreter">
<UniqueIdentifier>{10d97ea3-2af9-489c-a54e-d69ef2e4ca0a}</UniqueIdentifier>
</Filter>
......@@ -1706,6 +1709,9 @@
<ClInclude Include="..\heap\WriteBarrierSupport.h">
<Filter>heap</Filter>
</ClInclude>
<ClInclude Include="..\inspector\InspectorFrontendChannel.h">
<Filter>inspector</Filter>
</ClInclude>
<ClInclude Include="..\interpreter\AbstractPC.h">
<Filter>interpreter</Filter>
</ClInclude>
......
......@@ -887,6 +887,18 @@
A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
A1A009C01831A22D00CF8711 /* MacroAssemblerARM64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8640923C156EED3B00566CB2 /* MacroAssemblerARM64.h */; settings = {ATTRIBUTES = (Private, ); }; };
A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8640923B156EED3B00566CB2 /* ARM64Assembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */; };
A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */; };
A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */; };
A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E1182340B300A82E69 /* RemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E2182340B300A82E69 /* RemoteInspector.mm */; };
A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */; };
A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */; };
A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; };
A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */; };
A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */; settings = {ATTRIBUTES = (Private, ); }; };
A700873917CBE85300C3E643 /* MapConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A700873717CBE85300C3E643 /* MapConstructor.cpp */; };
A700873A17CBE85300C3E643 /* MapConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = A700873817CBE85300C3E643 /* MapConstructor.h */; };
A700873D17CBE8D300C3E643 /* MapPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A700873B17CBE8D300C3E643 /* MapPrototype.cpp */; };
......@@ -2199,6 +2211,18 @@
A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; };
A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; };
A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; };
A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RemoteInspectorDebuggable.cpp; path = inspector/remote/RemoteInspectorDebuggable.cpp; sourceTree = "<group>"; };
A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectDebuggable.cpp; sourceTree = "<group>"; };
A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectDebuggable.h; sourceTree = "<group>"; };
A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InspectorFrontendChannel.h; path = inspector/InspectorFrontendChannel.h; sourceTree = "<group>"; };
A5BA15E1182340B300A82E69 /* RemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspector.h; path = inspector/remote/RemoteInspector.h; sourceTree = "<group>"; };
A5BA15E2182340B300A82E69 /* RemoteInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteInspector.mm; path = inspector/remote/RemoteInspector.mm; sourceTree = "<group>"; };
A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorConstants.h; path = inspector/remote/RemoteInspectorConstants.h; sourceTree = "<group>"; };
A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorDebuggableConnection.h; path = inspector/remote/RemoteInspectorDebuggableConnection.h; sourceTree = "<group>"; };
A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteInspectorDebuggableConnection.mm; path = inspector/remote/RemoteInspectorDebuggableConnection.mm; sourceTree = "<group>"; };
A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorXPCConnection.h; path = inspector/remote/RemoteInspectorXPCConnection.h; sourceTree = "<group>"; };
A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteInspectorXPCConnection.mm; path = inspector/remote/RemoteInspectorXPCConnection.mm; sourceTree = "<group>"; };
A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorDebuggable.h; path = inspector/remote/RemoteInspectorDebuggable.h; sourceTree = "<group>"; };
A700873717CBE85300C3E643 /* MapConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapConstructor.cpp; sourceTree = "<group>"; };
A700873817CBE85300C3E643 /* MapConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapConstructor.h; sourceTree = "<group>"; };
A700873B17CBE8D300C3E643 /* MapPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapPrototype.cpp; sourceTree = "<group>"; };
......@@ -2697,6 +2721,7 @@
0867D69AFE84028FC02AAC07 /* Frameworks */,
0FEA09FC1705137F00BB722C /* ftl */,
142E312A134FF0A600AFADB5 /* heap */,
A5BA15DF1823409200A82E69 /* inspector */,
1429D77A0ED20D7300B89619 /* interpreter */,
1429D92C0ED22D7000B89619 /* jit */,
0F46809C14BA7F4D00BFE272 /* llint */,
......@@ -3482,6 +3507,8 @@
0F2B66C817B6B5AB00A7AE3F /* JSGenericTypedArrayViewPrototypeInlines.h */,
14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */,
A8E894330CD0603F00367179 /* JSGlobalObject.h */,
A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */,
A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */,
BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
0F2B66CA17B6B5AB00A7AE3F /* JSInt16Array.h */,
......@@ -4150,6 +4177,31 @@
path = bytecode;
sourceTree = "<group>";
};
A5BA15DF1823409200A82E69 /* inspector */ = {
isa = PBXGroup;
children = (
A5BA15E01823409D00A82E69 /* remote */,
A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */,
);
name = inspector;
sourceTree = "<group>";
};
A5BA15E01823409D00A82E69 /* remote */ = {
isa = PBXGroup;
children = (
A5BA15E1182340B300A82E69 /* RemoteInspector.h */,
A5BA15E2182340B300A82E69 /* RemoteInspector.mm */,
A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */,
A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */,
A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */,
A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */,
A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */,
A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */,
A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */,
);
name = remote;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
......@@ -4220,6 +4272,7 @@
866739D213BFDE710023D87C /* BigInteger.h in Headers */,
14816E1C154CC56C00B8054C /* BlockAllocator.h in Headers */,
BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */,
A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
0FB7F39715ED8E4600F167B2 /* Butterfly.h in Headers */,
0FB7F39815ED8E4600F167B2 /* ButterflyInlines.h in Headers */,
0F21C27F14BEAA8200ADC64B /* BytecodeConventions.h in Headers */,
......@@ -4290,6 +4343,7 @@
0F16015E156198C900C2587C /* DFGArgumentsSimplificationPhase.h in Headers */,
0F05C3B41683CF9200BAF45B /* DFGArrayifySlowPathGenerator.h in Headers */,
0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */,
A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */,
A7D9A29517A0BC7400EE2618 /* DFGAtTailAbstractState.h in Headers */,
0F714CA516EA92F200F3EBEB /* DFGBackwardsPropagationPhase.h in Headers */,
0F620176143FCD3B0068B77C /* DFGBasicBlock.h in Headers */,
......@@ -4365,6 +4419,7 @@
0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */,
0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */,
0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */,
A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
0FFB921C16D02F110055A5DB /* DFGOSRExitCompilationInfo.h in Headers */,
0FC0977114693AF500CF2442 /* DFGOSRExitCompiler.h in Headers */,
0F7025AA1714B0FC00382C0E /* DFGOSRExitCompilerCommon.h in Headers */,
......@@ -4423,6 +4478,7 @@
0FEA0A08170513DB00BB722C /* FTLAbbreviations.h in Headers */,
0FEA0A1D1708B00700BB722C /* FTLAbstractHeap.h in Headers */,
0FEA0A1F1708B00700BB722C /* FTLAbstractHeapRepository.h in Headers */,
A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */,
0FEA0A0A170513DB00BB722C /* FTLCapabilities.h in Headers */,
0FEA0A231709606900BB722C /* FTLCommonValues.h in Headers */,
0FEA0A0C170513DB00BB722C /* FTLCompile.h in Headers */,
......@@ -4515,6 +4571,7 @@
86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */,
0F0776BF14FF002B00102332 /* JITCompilationEffort.h in Headers */,
0FAF7EFE165BA91F000C8455 /* JITDisassembler.h in Headers */,
A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */,
0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */,
0FB14E1F18124ACE009B6B4D /* JITInlineCacheGenerator.h in Headers */,
86CC85A10EE79A4700288682 /* JITInlines.h in Headers */,
......@@ -4686,6 +4743,7 @@
14D2F3DB139F4BE200491031 /* MarkedSpace.h in Headers */,
142D6F1213539A4100B02E86 /* MarkStack.h in Headers */,
C21122E315DD9AB300790E3A /* MarkStackInlines.h in Headers */,
A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */,
8612E4CD152389EC00C836BE /* MatchResult.h in Headers */,
BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */,
90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */,
......@@ -4854,6 +4912,7 @@
142E313C134FF0A600AFADB5 /* Weak.h in Headers */,
14E84F9F14EE1ACC00D6D5D4 /* WeakBlock.h in Headers */,
14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */,
A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */,
14F7256614EE265E00B1652B /* WeakHandleOwner.h in Headers */,
14E84FA214EE1ACC00D6D5D4 /* WeakImpl.h in Headers */,
14BE7D3317135CF400D1807A /* WeakInlines.h in Headers */,
......@@ -5449,6 +5508,7 @@
A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */,
86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */,
0F56A1D515001CF4002992B1 /* ExecutionCounter.cpp in Sources */,
A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */,
0FB105851675480F00F8AB6E /* ExitKind.cpp in Sources */,
0FEA0A1C1708B00700BB722C /* FTLAbstractHeap.cpp in Sources */,
0FEA0A1E1708B00700BB722C /* FTLAbstractHeapRepository.cpp in Sources */,
......@@ -5610,6 +5670,7 @@
14469DDE107EC7E700650446 /* Lookup.cpp in Sources */,
0F4680CC14BBB17A00BFE272 /* LowLevelInterpreter.cpp in Sources */,
14B723B212D7DA46003BD5ED /* MachineStackMarker.cpp in Sources */,
A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */,
0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */,
86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */,
A729009C17976C6000317298 /* MacroAssemblerARMv7.cpp in Sources */,
......@@ -5737,6 +5798,9 @@
A7CA3AE517DA41AE006538AF /* WeakMapPrototype.cpp in Sources */,
14E84FA014EE1ACC00D6D5D4 /* WeakSet.cpp in Sources */,
0FC8150B14043C0E00CFA603 /* WriteBarrierSupport.cpp in Sources */,
A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */,
A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */,
A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */,
A7E5AB3A1799E4B200D2833D /* X86Disassembler.cpp in Sources */,
863C6D9C1521111A00585E4E /* YarrCanonicalizeUCS2.cpp in Sources */,
86704B8412DBA33700A9FE7B /* YarrInterpreter.cpp in Sources */,
......
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -10,25 +10,25 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef InspectorFrontendChannel_h
#define InspectorFrontendChannel_h
#include <wtf/Forward.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
namespace Inspector {
class InspectorFrontendChannel {
public:
......@@ -36,6 +36,6 @@ public:
virtual bool sendMessageToFrontend(const String& message) = 0;
};
} // namespace WebCore
} // namespace Inspector
#endif // !defined(InspectorFrontendChannel_h)
/*
* Copyright (C) 2011 Apple Inc. All Rights Reserved.
* Copyright (C) 2013 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -25,79 +25,82 @@
#if ENABLE(REMOTE_INSPECTOR)
#import "WebInspectorClientRegistry.h"
#import "WebInspectorClient.h"
#import "WebViewPrivate.h"
@implementation WebInspectorClientRegistry
@synthesize delegate = _delegate;
+ (WebInspectorClientRegistry *)sharedRegistry
{
static WebInspectorClientRegistry *sharedRegistry = [[WebInspectorClientRegistry alloc] init];
return sharedRegistry;
}
- (id)init
{
self = [super init];
if (!self)
return nil;
_nextAvailablePageId = 1;
return self;
}
- (unsigned)_getNextAvailablePageId
{
// Boundary values, 0 and UINT_MAX, are invalid HashMap keys.
unsigned nextValidPageId;
do {
nextValidPageId = _nextAvailablePageId++;
} while (!nextValidPageId || nextValidPageId == UINT_MAX || _pageClientMap.contains(nextValidPageId));
return nextValidPageId;
}
- (void)registerClient:(WebInspectorClient*)client
{
unsigned pageId = [self _getNextAvailablePageId];
_pageClientMap.set(pageId, client);
client->setPageId(pageId);
[_delegate didRegisterClient:client];
}
- (void)unregisterClient:(WebInspectorClient*)client
{
unsigned pageId = client->page