Skip to content

Commit eee58f9

Browse files
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. Canonical link: https://commits.webkit.org/143326@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 441b620 commit eee58f9

89 files changed

Lines changed: 2200 additions & 1667 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Source/JavaScriptCore/API/JSContext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ OBJC_VISIBLE
164164
*/
165165
@property(readonly, retain) JSVirtualMachine *virtualMachine;
166166

167+
/*!
168+
@property
169+
@discussion Name of the JSContext. Exposed when remote debugging the context.
170+
*/
171+
@property(copy) NSString *name;
172+
167173
@end
168174

169175
/*!

Source/JavaScriptCore/API/JSContext.mm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,22 @@ - (JSVirtualMachine *)virtualMachine
166166
return m_virtualMachine;
167167
}
168168

169+
- (NSString *)name
170+
{
171+
JSStringRef name = JSGlobalContextCopyName(m_context);
172+
if (!name)
173+
return nil;
174+
175+
return [(NSString *)JSStringCopyCFString(kCFAllocatorDefault, name) autorelease];
176+
}
177+
178+
- (void)setName:(NSString *)name
179+
{
180+
JSStringRef nameJS = JSStringCreateWithCFString((CFStringRef)[name copy]);
181+
JSGlobalContextSetName(m_context, nameJS);
182+
JSStringRelease(nameJS);
183+
}
184+
169185
@end
170186

171187
@implementation JSContext(SubscriptSupport)

Source/JavaScriptCore/API/JSContextRef.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,37 @@ JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx)
213213
return toGlobalRef(exec->lexicalGlobalObject()->globalExec());
214214
}
215215

216+
JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx)
217+
{
218+
if (!ctx) {
219+
ASSERT_NOT_REACHED();
220+
return 0;
221+
}
222+
223+
ExecState* exec = toJS(ctx);
224+
APIEntryShim entryShim(exec);
225+
226+
String name = exec->vmEntryGlobalObject()->name();
227+
if (name.isNull())
228+
return 0;
229+
230+
return OpaqueJSString::create(name).leakRef();
231+
}
232+
233+
void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name)
234+
{
235+
if (!ctx) {
236+
ASSERT_NOT_REACHED();
237+
return;
238+
}
239+
240+
ExecState* exec = toJS(ctx);
241+
APIEntryShim entryShim(exec);
242+
243+
exec->vmEntryGlobalObject()->setName(name ? name->string() : String());
244+
}
245+
246+
216247
class BacktraceFunctor {
217248
public:
218249
BacktraceFunctor(StringBuilder& builder, unsigned remainingCapacityForFrameCapture)

Source/JavaScriptCore/API/JSContextRef.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,24 @@ JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) AVAILABLE_IN_WEB
133133
*/
134134
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) CF_AVAILABLE(10_7, 4_0);
135135

136+
/*!
137+
@function
138+
@abstract Gets a copy of the name of a context.
139+
@param ctx The JSGlobalContext whose name you want to get.
140+
@result The name for ctx.
141+
@discussion A JSGlobalContext's name is exposed for remote debugging to make it
142+
easier to identify the context you would like to attach to.
143+
*/
144+
JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx);
145+
146+
/*!
147+
@function
148+
@abstract Sets the remote debugging name for a context.
149+
@param ctx The JSGlobalContext that you want to name.
150+
@param name The remote debugging name to set on ctx.
151+
*/
152+
JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name);
153+
136154
#ifdef __cplusplus
137155
}
138156
#endif

Source/JavaScriptCore/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set(JavaScriptCore_INCLUDE_DIRECTORIES
1111
"${JAVASCRIPTCORE_DIR}/ftl"
1212
"${JAVASCRIPTCORE_DIR}/heap"
1313
"${JAVASCRIPTCORE_DIR}/debugger"
14+
"${JAVASCRIPTCORE_DIR}/inspector"
1415
"${JAVASCRIPTCORE_DIR}/interpreter"
1516
"${JAVASCRIPTCORE_DIR}/jit"
1617
"${JAVASCRIPTCORE_DIR}/llint"
@@ -584,6 +585,7 @@ set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
584585
collector/handles
585586
debugger
586587
heap
588+
inspector
587589
interpreter
588590
jit
589591
llint

Source/JavaScriptCore/ChangeLog

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,169 @@
1+
2013-12-03 Joseph Pecoraro <[email protected]>
2+
3+
Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
4+
https://bugs.webkit.org/show_bug.cgi?id=124613
5+
6+
Reviewed by Timothy Hatcher.
7+
8+
Move the ENABLE(REMOTE_INSPECTOR) remote debugger connection management
9+
into JavaScriptCore (originally from WebKit/mac). Include enhancements:
10+
11+
* allow for different types of remote debuggable targets,
12+
eventually at least a JSContext, WebView, WKView.
13+
* allow debuggables to be registered and debugged on any thread. Unlike
14+
WebViews, JSContexts may be run entirely off of the main thread.
15+
* move the remote connection (XPC connection) itself off of the main thread,
16+
it doesn't need to be on the main thread.
17+
18+
Make JSContext @class and JavaScriptCore::JSContextRef
19+
"JavaScript" Remote Debuggables.
20+
21+
* inspector/remote/RemoteInspectorDebuggable.h: Added.
22+
* inspector/remote/RemoteInspectorDebuggable.cpp: Added.
23+
(Inspector::RemoteInspectorDebuggable::RemoteInspectorDebuggable):
24+
(Inspector::RemoteInspectorDebuggable::~RemoteInspectorDebuggable):
25+
(Inspector::RemoteInspectorDebuggable::init):
26+
(Inspector::RemoteInspectorDebuggable::update):
27+
(Inspector::RemoteInspectorDebuggable::setRemoteDebuggingAllowed):
28+
(Inspector::RemoteInspectorDebuggable::info):
29+
RemoteInspectorDebuggable defines a debuggable target. As long as
30+
something creates a debuggable and is set to allow remote inspection
31+
it will be listed in remote debuggers. For the different types of
32+
debuggables (JavaScript and Web) there is different basic information
33+
that may be listed.
34+
35+
* inspector/InspectorFrontendChannel.h: Added.
36+
(Inspector::InspectorFrontendChannel::~InspectorFrontendChannel):
37+
The only thing a debuggable needs for remote debugging is an
38+
InspectorFrontendChannel a way to send messages to a remote frontend.
39+
This class provides that method, and is vended to the
40+
RemoteInspectorDebuggable when a remote connection is setup.
41+
42+
* inspector/remote/RemoteInspector.h: Added.
43+
* inspector/remote/RemoteInspector.mm: Added.
44+
Singleton, created at least when the first Debuggable is created.
45+
This class manages the list of debuggables, any connection to a
46+
remote debugger proxy (XPC service "com.apple.webinspector").
47+
48+
(Inspector::dispatchAsyncOnQueueSafeForAnyDebuggable):
49+
(Inspector::RemoteInspector::shared):
50+
(Inspector::RemoteInspector::RemoteInspector):
51+
(Inspector::RemoteInspector::nextAvailableIdentifier):
52+
(Inspector::RemoteInspector::registerDebuggable):
53+
(Inspector::RemoteInspector::unregisterDebuggable):
54+
(Inspector::RemoteInspector::updateDebuggable):
55+
Debuggable management. When debuggables are added, removed, or updated
56+
we stash a copy of the debuggable information and push an update to
57+
debuggers. Stashing a copy of the information in the RemoteInspector
58+
is a thread safe way to avoid walking over all debuggables to gather
59+
the information when it is needed.
60+
61+
(Inspector::RemoteInspector::start):
62+
(Inspector::RemoteInspector::stop):
63+
Runtime API to enable / disable the feature.
64+
65+
(Inspector::RemoteInspector::listingForDebuggable):
66+
(Inspector::RemoteInspector::pushListingNow):
67+
(Inspector::RemoteInspector::pushListingSoon):
68+
Pushing a listing to remote debuggers.
69+
70+
(Inspector::RemoteInspector::sendMessageToRemoteFrontend):
71+
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
72+
(Inspector::RemoteInspector::xpcConnectionReceivedMessage):
73+
(Inspector::RemoteInspector::xpcConnectionFailed):
74+
(Inspector::RemoteInspector::xpcConnectionUnhandledMessage):
75+
XPC setup, send, and receive handling.
76+
77+
(Inspector::RemoteInspector::updateHasActiveDebugSession):
78+
Applications being debugged may want to know when a debug
79+
session is active. This provides that notification.
80+
81+
(Inspector::RemoteInspector::receivedSetupMessage):
82+
(Inspector::RemoteInspector::receivedDataMessage):
83+
(Inspector::RemoteInspector::receivedDidCloseMessage):
84+
(Inspector::RemoteInspector::receivedGetListingMessage):
85+
(Inspector::RemoteInspector::receivedIndicateMessage):
86+
(Inspector::RemoteInspector::receivedConnectionDiedMessage):
87+
Dispatching incoming remote debugging protocol messages.
88+
These are wrapping above the inspector protocol messages.
89+
90+
* inspector/remote/RemoteInspectorConstants.h: Added.
91+
Protocol messages and dictionary keys inside the messages.
92+
93+
(Inspector::RemoteInspectorDebuggableInfo::RemoteInspectorDebuggableInfo):
94+
* inspector/remote/RemoteInspectorDebuggableConnection.h: Added.
95+
* inspector/remote/RemoteInspectorDebuggableConnection.mm: Added.
96+
This is a connection between the RemoteInspector singleton and a RemoteInspectorDebuggable.
97+
98+
(Inspector::RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection):
99+
(Inspector::RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection):
100+
Allow for dispatching messages on JavaScript debuggables on a dispatch_queue
101+
instead of the main queue.
102+
103+
(Inspector::RemoteInspectorDebuggableConnection::destination):
104+
(Inspector::RemoteInspectorDebuggableConnection::connectionIdentifier):
105+
Needed in the remote debugging protocol to identify the remote debugger.
106+
107+
(Inspector::RemoteInspectorDebuggableConnection::dispatchSyncOnDebuggable):
108+
(Inspector::RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable):
109+
(Inspector::RemoteInspectorDebuggableConnection::setup):
110+
(Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
111+
(Inspector::RemoteInspectorDebuggableConnection::close):
112+
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
113+
(Inspector::RemoteInspectorDebuggableConnection::sendMessageToFrontend):
114+
The connection is a thin channel between the two sides that can be closed
115+
from either side, so there is some logic around multi-threaded access.
116+
117+
* inspector/remote/RemoteInspectorXPCConnection.h: Added.
118+
(Inspector::RemoteInspectorXPCConnection::Client::~Client):
119+
* inspector/remote/RemoteInspectorXPCConnection.mm: Added.
120+
(Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
121+
(Inspector::RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection):
122+
(Inspector::RemoteInspectorXPCConnection::close):
123+
(Inspector::RemoteInspectorXPCConnection::deserializeMessage):
124+
(Inspector::RemoteInspectorXPCConnection::handleEvent):
125+
(Inspector::RemoteInspectorXPCConnection::sendMessage):
126+
This is a connection between the RemoteInspector singleton and an XPC service
127+
named "com.apple.webinspector". This handles serialization of the dictionary
128+
messages to and from the service. The receiving is done on a non-main queue.
129+
130+
* API/JSContext.h:
131+
* API/JSContext.mm:
132+
(-[JSContext name]):
133+
(-[JSContext setName:]):
134+
ObjC API to enable/disable JSContext remote inspection and give a name.
135+
136+
* API/JSContextRef.h:
137+
* API/JSContextRef.cpp:
138+
(JSGlobalContextGetName):
139+
(JSGlobalContextSetName):
140+
C API to give a JSContext a name.
141+
142+
* runtime/JSGlobalObject.cpp:
143+
(JSC::JSGlobalObject::setName):
144+
* runtime/JSGlobalObject.h:
145+
(JSC::JSGlobalObject::name):
146+
Shared handling of the APIs above.
147+
148+
* runtime/JSGlobalObjectDebuggable.cpp: Added.
149+
(JSC::JSGlobalObjectDebuggable::JSGlobalObjectDebuggable):
150+
(JSC::JSGlobalObjectDebuggable::name):
151+
(JSC::JSGlobalObjectDebuggable::connect):
152+
(JSC::JSGlobalObjectDebuggable::disconnect):
153+
(JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend):
154+
* runtime/JSGlobalObjectDebuggable.h: Added.
155+
Stub for the actual remote debugging implementation. We will push
156+
down the appropriate WebCore/inspector peices suitable for debugging
157+
just a JavaScript context.
158+
159+
* CMakeLists.txt:
160+
* JavaScriptCore.xcodeproj/project.pbxproj:
161+
* GNUmakefile.am:
162+
* GNUmakefile.list.am:
163+
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
164+
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
165+
Update build files.
166+
1167
2013-12-04 Michael Saboff <[email protected]>
2168

3169
Move the setting up of callee's callFrame from pushFrame to callToJavaScript thunk

Source/JavaScriptCore/GNUmakefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ javascriptcore_cppflags += \
5959
-I$(srcdir)/Source/JavaScriptCore/disassembler \
6060
-I$(srcdir)/Source/JavaScriptCore/ftl \
6161
-I$(srcdir)/Source/JavaScriptCore/heap \
62+
-I$(srcdir)/Source/JavaScriptCore/inspector \
6263
-I$(srcdir)/Source/JavaScriptCore/interpreter \
6364
-I$(srcdir)/Source/JavaScriptCore/jit \
6465
-I$(srcdir)/Source/JavaScriptCore/llint \

Source/JavaScriptCore/GNUmakefile.list.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ javascriptcore_sources += \
610610
Source/JavaScriptCore/icu/unicode/utf_old.h \
611611
Source/JavaScriptCore/icu/unicode/utypes.h \
612612
Source/JavaScriptCore/icu/unicode/uversion.h \
613+
Source/JavaScriptCore/inspector/InspectorFrontendChannel.h \
613614
Source/JavaScriptCore/interpreter/AbstractPC.cpp \
614615
Source/JavaScriptCore/interpreter/AbstractPC.h \
615616
Source/JavaScriptCore/interpreter/CachedCall.h \

Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@
996996
<ClInclude Include="..\heap\WeakSet.h" />
997997
<ClInclude Include="..\heap\WeakSetInlines.h" />
998998
<ClInclude Include="..\heap\WriteBarrierSupport.h" />
999+
<ClInclude Include="..\inspector\InspectorFrontendChannel.h" />
9991000
<ClInclude Include="..\interpreter\AbstractPC.h" />
10001001
<ClInclude Include="..\interpreter\CachedCall.h" />
10011002
<ClInclude Include="..\interpreter\CallFrame.h" />

Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<Filter Include="heap">
2626
<UniqueIdentifier>{bd49e5cf-95d6-4151-b286-8837ccd347fa}</UniqueIdentifier>
2727
</Filter>
28+
<Filter Include="inspector">
29+
<UniqueIdentifier>{09ae09da-1239-00ea-8dfe-9087ae123bbe}</UniqueIdentifier>
30+
</Filter>
2831
<Filter Include="interpreter">
2932
<UniqueIdentifier>{10d97ea3-2af9-489c-a54e-d69ef2e4ca0a}</UniqueIdentifier>
3033
</Filter>
@@ -1706,6 +1709,9 @@
17061709
<ClInclude Include="..\heap\WriteBarrierSupport.h">
17071710
<Filter>heap</Filter>
17081711
</ClInclude>
1712+
<ClInclude Include="..\inspector\InspectorFrontendChannel.h">
1713+
<Filter>inspector</Filter>
1714+
</ClInclude>
17091715
<ClInclude Include="..\interpreter\AbstractPC.h">
17101716
<Filter>interpreter</Filter>
17111717
</ClInclude>

0 commit comments

Comments
 (0)