Web Inspector: add probe manager and model objects to the frontend
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Feb 2014 22:21:40 +0000 (22:21 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Feb 2014 22:21:40 +0000 (22:21 +0000)
commitd958785b9d1175e1a3a82166d2832221992dfae4
tree104115b4ae92341764f9fd998f05c25348546203
parent36043ddee4d1b2e38ffa4369aa9b3eb2c81c3c66
Web Inspector: add probe manager and model objects to the frontend
https://bugs.webkit.org/show_bug.cgi?id=127117

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

The inspector frontend now assigns breakpoint action identifiers,
rather than the backend. Remove return values containing breakpoint
identifiers, and remove tracking and assignment of action identifiers.

* inspector/ScriptDebugListener.h:
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::evaluateBreakpointAction):
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
Pass BreakpointAction by reference rather than just the action identifier.

* inspector/ScriptDebugServer.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::objectGroupForBreakpointAction):
(Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
(Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol):
(Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
(Inspector::InspectorDebuggerAgent::setBreakpoint):
(Inspector::InspectorDebuggerAgent::removeBreakpoint):
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
* inspector/agents/InspectorDebuggerAgent.h:
* inspector/protocol/Debugger.json: Revert change to setBreakpoint return values. Add optional identifier to breakpoint actions.

Source/WebInspectorUI:

Add the probe manager, and the following model objects:

- ProbeObject corresponds to a single probe breakpoint action.
- ProbeSetObject contains all ProbeObjects for one Breakpoint.
- ProbeSetDataFrame holds probe samples from multiple
probes fired from the same breakpoint hit/debugger pause.
- ProbeSetDataTable keeps track of multiple such data frames
and manages probe sample lifetimes across page navigations.

The probe manager updates probe model objects whenever breakpoints
are added, removed, or modified.

The inspector frontend now assigns breakpoint action identifiers,
rather than the backend. This lets ProbeObjects keep stable
identifiers that match the probe's samples, even when the underlying
breakpoint is re-added with a different identifier (such as when
editing probe expressions).

* UserInterface/Breakpoint.js:
(WebInspector.Breakpoint.prototype.get probeActions): Added.
(WebInspector.Breakpoint.prototype.createAction):
(WebInspector.Breakpoint.prototype.removeAction):
(WebInspector.Breakpoint.prototype.clearActions): Added.
* UserInterface/BreakpointAction.js:
(WebInspector.BreakpointAction):
(WebInspector.BreakpointAction.prototype.get id):
(WebInspector.BreakpointAction.prototype.get info):
* UserInterface/DebuggerManager.js:
(WebInspector.DebuggerManager.restoreBreakpointsSoon):
(WebInspector.DebuggerManager): Restore saved breakpoints
from cookies on the second run loop, so that all managers will
be able to received breakpoint added events.
(WebInspector.DebuggerManager.prototype.addBreakpoint):
(WebInspector.DebuggerManager.prototype.removeBreakpoint):
(WebInspector.DebuggerManager.prototype.get nextBreakpointActionIdentifier):
The debugger manager assigns unique breakpoint action identifiers with this getter.

(WebInspector.DebuggerManager.prototype._debuggerBreakpointActionType):
(WebInspector.DebuggerManager.prototype.didSetBreakpoint):
(WebInspector.DebuggerManager.prototype._setBreakpoint):
(WebInspector.DebuggerManager.prototype.didRemoveBreakpoint):
(WebInspector.DebuggerManager.prototype._removeBreakpoint):
* UserInterface/DebuggerObserver.js:
(WebInspector.DebuggerObserver.prototype.didSampleProbe):
* UserInterface/InspectorJSBackendCommands.js:
* UserInterface/Main.html:
* UserInterface/Main.js:
(WebInspector.loaded):
* UserInterface/Probe.js: Added.
(WebInspector.ProbeSample):
(WebInspector.Probe):
(WebInspector.Probe.prototype.get id):
(WebInspector.Probe.prototype.get breakpoint):
(WebInspector.Probe.prototype.get expression):
(WebInspector.Probe.prototype.set expression):
(WebInspector.Probe.prototype.get samples):
(WebInspector.Probe.prototype.clearSamples):
(WebInspector.Probe.prototype.addSample):
* UserInterface/ProbeManager.js: Added.
(WebInspector.ProbeManager):
(WebInspector.ProbeManager.prototype.probeSetForBreakpoint):
(WebInspector.ProbeManager.prototype._breakpointRemoved):
(WebInspector.ProbeManager.prototype._breakpointActionsChanged.get var):
(WebInspector.ProbeManager.prototype._breakpointActionsChanged.set get knownProbeIdentifiers):
(WebInspector.ProbeManager.prototype._breakpointActionsChanged):
* UserInterface/ProbeSet.js: Added.
(WebInspector.ProbeSet):
(WebInspector.ProbeSet.prototype.get breakpoint):
(WebInspector.ProbeSet.prototype.get probes):
(WebInspector.ProbeSet.prototype.get dataTable):
(WebInspector.ProbeSet.prototype.clear):
(WebInspector.ProbeSet.prototype.clearSamples):
(WebInspector.ProbeSet.prototype.createProbe):
(WebInspector.ProbeSet.prototype.removeProbe):
(WebInspector.ProbeSet.prototype.willRemove):
(WebInspector.ProbeSet.prototype._mainResourceChanged):
(WebInspector.ProbeSet.prototype._createDataTable):
(WebInspector.ProbeSet.prototype._sampleCollected):
(WebInspector.ProbeSet.prototype._breakpointResolvedStateDidChange):
* UserInterface/ProbeSetDataFrame.js: Added.
(WebInspector.ProbeSetDataFrame):
(WebInspector.ProbeSetDataFrame.compare):
(WebInspector.ProbeSetDataFrame.prototype.get key):
(WebInspector.ProbeSetDataFrame.prototype.get count):
(WebInspector.ProbeSetDataFrame.prototype.get index):
(WebInspector.ProbeSetDataFrame.prototype.get isSeparator):
(WebInspector.ProbeSetDataFrame.prototype.set isSeparator):
(WebInspector.ProbeSetDataFrame.prototype.addSampleForProbe):
(WebInspector.ProbeSetDataFrame.prototype.missingKeys):
(WebInspector.ProbeSetDataFrame.prototype.isComplete):
(WebInspector.ProbeSetDataFrame.prototype.fillMissingValues):
* UserInterface/ProbeSetDataTable.js: Added.
(WebInspector.ProbeSetDataTable):
(WebInspector.ProbeSetDataTable.prototype.get frames):
(WebInspector.ProbeSetDataTable.prototype.get separators):
(WebInspector.ProbeSetDataTable.prototype.willRemove):
(WebInspector.ProbeSetDataTable.prototype.mainResourceChanged):
(WebInspector.ProbeSetDataTable.prototype.addSampleForProbe):
(WebInspector.ProbeSetDataTable.prototype.addProbe):
(WebInspector.ProbeSetDataTable.prototype.removeProbe):
(WebInspector.ProbeSetDataTable.prototype.createFrame):
(WebInspector.ProbeSetDataTable.prototype.addFrame):
(WebInspector.ProbeSetDataTable.prototype.addSeparator):

LayoutTests:

Set up the debugger and probe managers when testing models.

Add a workalike for InspectorBackend.dumpInspectorProtocolMessages to
InspectorTest.

Add listeners for breakpoints and probes that produce
useful, deterministic trace output. Use the tracing in a new test.

* http/tests/inspector-protocol/resources/InspectorTest.js:
(InspectorTest.sendCommand):
(InspectorTest.initializeInspectorModels.console.assert):
(InspectorTest.initializeInspectorModels):
* inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt:
* inspector-protocol/debugger/didSampleProbe-multiple-probes.html:
* inspector-protocol/model/probe-manager-add-remove-actions-expected.txt: Added.
* inspector-protocol/model/probe-manager-add-remove-actions.html: Added.
* inspector-protocol/resources/probe-helper.js:
(ProbeHelper.stringifyProbeSample):
(ProbeHelper.installTracingListeners.WebInspector):
(ProbeHelper.installTracingListeners):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163477 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js
LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt
LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes.html
LayoutTests/inspector-protocol/model/probe-manager-add-remove-actions-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/model/probe-manager-add-remove-actions.html [new file with mode: 0644]
LayoutTests/inspector-protocol/resources/probe-helper.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/ScriptDebugListener.h
Source/JavaScriptCore/inspector/ScriptDebugServer.cpp
Source/JavaScriptCore/inspector/ScriptDebugServer.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/protocol/Debugger.json
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Breakpoint.js
Source/WebInspectorUI/UserInterface/BreakpointAction.js
Source/WebInspectorUI/UserInterface/DebuggerManager.js
Source/WebInspectorUI/UserInterface/DebuggerObserver.js
Source/WebInspectorUI/UserInterface/InspectorJSBackendCommands.js
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Main.js
Source/WebInspectorUI/UserInterface/Probe.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/ProbeManager.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/ProbeSet.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/ProbeSetDataFrame.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/ProbeSetDataTable.js [new file with mode: 0644]