Web Inspector: Improve CanvasManager recording events
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 23:51:47 +0000 (23:51 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 23:51:47 +0000 (23:51 +0000)
commit96b2f815ecae9aac99e3ad1e658a6c18d5d7c6c4
treedfb3326d1d6b60332ab3fe74e79e045aa46f0a39
parente458f3ad06bf95a63ec05fad40c16ce5e60faacc
Web Inspector: Improve CanvasManager recording events
https://bugs.webkit.org/show_bug.cgi?id=177762

Reviewed by Devin Rousso.

Source/JavaScriptCore:

* inspector/protocol/Canvas.json:
Renamed events for clarity and consistency; made recording data optional.

Source/WebCore:

Dispatch Canvas.recordingFinished regardless of whether any actions were
recorded. Without this extra guarantee, the frontend has to keep track
of additional state to determine whether a recording is in progress.

* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::startRecording):
(WebCore::InspectorCanvasAgent::stopRecording):
(WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
(WebCore::InspectorCanvasAgent::requestRecording): Deleted.
(WebCore::InspectorCanvasAgent::cancelRecording): Deleted.
* inspector/InspectorCanvasAgent.h:

Source/WebInspectorUI:

* UserInterface/Controllers/CanvasManager.js:
(WI.CanvasManager.prototype.startRecording):
(WI.CanvasManager.prototype.stopRecording):
(WI.CanvasManager.prototype.recordingFinished):
Replace the RecordingFinished event with a pair of events. RecordingStarted
is sent when CanvasAgent.startRecording succeeds. RecordingStopped is
sent when a recordingFinished event is received from the backend, or
when a call to CanvasAgent.stopRecording fails.

* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView.prototype.initialLayout):
(WI.CanvasContentView.prototype._toggleRecording):
(WI.CanvasContentView.prototype._recordingStarted):
(WI.CanvasContentView.prototype._recordingFinished): Deleted.
Update recording status when CanvasManager fires recording events,
instead of immediately after clicking the record button.

LayoutTests:

Update tests for renamed CanvasManager event.

* inspector/canvas/recording-2d.html:
* inspector/canvas/recording-expected.txt:
* inspector/canvas/recording-webgl-snapshots.html:
* inspector/canvas/recording-webgl.html:
* inspector/canvas/recording.html:
* inspector/canvas/resources/recording-utilities.js:
(TestPage.registerInitializer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/canvas/recording-2d.html
LayoutTests/inspector/canvas/recording-expected.txt
LayoutTests/inspector/canvas/recording-webgl-snapshots.html
LayoutTests/inspector/canvas/recording-webgl.html
LayoutTests/inspector/canvas/recording.html
LayoutTests/inspector/canvas/resources/recording-utilities.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Canvas.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorCanvasAgent.cpp
Source/WebCore/inspector/InspectorCanvasAgent.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js