Skip to content
Commit 18911405 authored by bburg@apple.com's avatar bburg@apple.com
Browse files

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: http://svn.webkit.org/repository/webkit/trunk@162096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6641b197
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment