Web Inspector: capture probe samples on the backend
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jan 2014 23:22:39 +0000 (23:22 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jan 2014 23:22:39 +0000 (23:22 +0000)
commit7e5454bf42c81087f83dbfc66b296ec623ac18f0
tree1f8d2f557c79f4ede9b6399ebf42ef42f26c47c5
parentea172867c62fc8641c363be156ac38627e9085f0
Web Inspector: capture probe samples on the backend
https://bugs.webkit.org/show_bug.cgi?id=126668

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Add the 'probe' breakpoint action to the protocol. Change the setBreakpoint
commands to return a list of assigned breakpoint action identifiers
Add a type for breakpoint action identifiers. Add an event for sending
captured probe samples to the inspector frontend.

* inspector/protocol/Debugger.json:

Source/WebCore:

Test: inspector-protocol/debugger/setProbe-multiple-actions.html

Add the probe breakpoint action type. A probe action
evaluates an expression on the script call frame, and
the result is aggregated on a per-probe basis. Each
evaluated expression result is called a probe sample.

* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::evaluateBreakpointAction): Teach
the debug server to evaluate a probe.

(WebCore::ScriptDebugServer::dispatchDidSampleProbe): Added.
(WebCore::ScriptDebugServer::handleBreakpointHit): Increment a hit count.
(WebCore::ScriptDebugServer::getActionsForBreakpoint):
* bindings/js/ScriptDebugServer.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::objectGroupForBreakpointAction): Added. Create an object
group for each breakpoint action. Currently only probes make objects.
(WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::disable):
(WebCore::InspectorDebuggerAgent::enable): Remove stale comment.
(WebCore::breakpointActionTypeForString): Add new case.
(WebCore::InspectorDebuggerAgent::breakpointActionsFromProtocol): Make
this a member function instead of a static function, so it can increment
the breakpoint action identifier counter.
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl): Propagate the
assigned breakpoint action identifiers.
(WebCore::InspectorDebuggerAgent::setBreakpoint): Propagate the
assigned breakpoint action identifiers.
(WebCore::InspectorDebuggerAgent::removeBreakpoint): Release object
groups for any actions that were associated with the removed breakpoint.
(WebCore::InspectorDebuggerAgent::didSampleProbe): Added.
(WebCore::InspectorDebuggerAgent::clearResolvedBreakpointState): Renamed from clear().
(WebCore::InspectorDebuggerAgent::didClearGlobalObject): Renamed from reset().
* inspector/InspectorDebuggerAgent.h:
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::didClearMainFrameWindowObject):
* inspector/ScriptBreakpoint.h:
(WebCore::ScriptBreakpointAction::ScriptBreakpointAction): Add identifier member.
* inspector/ScriptDebugListener.h:

Source/WebInspectorUI:

* UserInterface/InspectorJSBackendCommands.js: Add probe enumeration value.

LayoutTests:

Add protocol tests for setting and hitting the probe breakpoint action type.

* inspector-protocol/debugger/setBreakpoint-actions-expected.txt:
* inspector-protocol/debugger/setBreakpoint-actions.html:
* inspector-protocol/debugger/setProbe-multiple-actions-expected.txt: Added.
* inspector-protocol/debugger/setProbe-multiple-actions.html: Added.
* inspector-protocol/resources/probe-helper.js: Added.
(ProbeHelper.simplifiedProbeSample):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes.html [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/setBreakpoint-actions-expected.txt
LayoutTests/inspector-protocol/debugger/setBreakpoint-actions.html
LayoutTests/inspector-protocol/resources/probe-helper.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Debugger.json
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/ScriptDebugServer.cpp
Source/WebCore/bindings/js/ScriptDebugServer.h
Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.h
Source/WebCore/inspector/PageDebuggerAgent.cpp
Source/WebCore/inspector/ScriptBreakpoint.h
Source/WebCore/inspector/ScriptDebugListener.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/InspectorJSBackendCommands.js