Changeset 222888 in webkit
- Timestamp:
- Oct 4, 2017 4:51:47 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r222887 r222888 1 2017-10-04 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Improve CanvasManager recording events 4 https://bugs.webkit.org/show_bug.cgi?id=177762 5 6 Reviewed by Devin Rousso. 7 8 Update tests for renamed CanvasManager event. 9 10 * inspector/canvas/recording-2d.html: 11 * inspector/canvas/recording-expected.txt: 12 * inspector/canvas/recording-webgl-snapshots.html: 13 * inspector/canvas/recording-webgl.html: 14 * inspector/canvas/recording.html: 15 * inspector/canvas/resources/recording-utilities.js: 16 (TestPage.registerInitializer): 17 1 18 2017-10-04 Nan Wang <n_wang@apple.com> 2 19 -
trunk/LayoutTests/inspector/canvas/recording-2d.html
r222182 r222888 407 407 description: "Check that the recording is stopped after a single frame.", 408 408 test(resolve, reject) { 409 requestRecording(WI.Canvas.ContextType.Canvas2D, resolve, reject, {singleFrame: true});409 startRecording(WI.Canvas.ContextType.Canvas2D, resolve, reject, {singleFrame: true}); 410 410 }, 411 411 }); … … 415 415 description: "Check that recording data is serialized correctly for multiple frames.", 416 416 test(resolve, reject) { 417 let canvas = requestRecording(WI.Canvas.ContextType.Canvas2D, resolve, reject, {singleFrame: false});417 let canvas = startRecording(WI.Canvas.ContextType.Canvas2D, resolve, reject, {singleFrame: false}); 418 418 419 419 InspectorTest.singleFireEventListener("LastFrame", () => { 420 CanvasAgent. cancelRecording(canvas.identifier, (error) => {420 CanvasAgent.stopRecording(canvas.identifier, (error) => { 421 421 if (error) { 422 422 reject(error); … … 432 432 description: "Check that the recording is stopped when it reaches the memory limit.", 433 433 test(resolve, reject) { 434 requestRecording(WI.Canvas.ContextType.Canvas2D, resolve, reject, {memoryLimit: 10});434 startRecording(WI.Canvas.ContextType.Canvas2D, resolve, reject, {memoryLimit: 10}); 435 435 }, 436 436 }); … … 446 446 } 447 447 448 WI.canvasManager.awaitEvent(WI.CanvasManager.Event.Recording Finished)448 WI.canvasManager.awaitEvent(WI.CanvasManager.Event.RecordingStopped) 449 449 .then((event) => { 450 450 let recording = event.data.recording.toJSON(); … … 461 461 462 462 const singleFrame = true; 463 CanvasAgent. requestRecording(canvas.identifier, singleFrame, (error) => {463 CanvasAgent.startRecording(canvas.identifier, singleFrame, (error) => { 464 464 if (error) { 465 465 reject(error); -
trunk/LayoutTests/inspector/canvas/recording-expected.txt
r220008 r222888 3 3 4 4 == Running test suite: Canvas.recording 5 -- Running test case: Canvas. requestRecording.InvalidCanvasId5 -- Running test case: Canvas.startRecording.InvalidCanvasId 6 6 PASS: Should produce an error. 7 7 Error: No canvas for given identifier. 8 8 9 -- Running test case: Canvas. cancelRecording.InvalidCanvasId9 -- Running test case: Canvas.stopRecording.InvalidCanvasId 10 10 PASS: Should produce an error. 11 11 Error: No canvas for given identifier. -
trunk/LayoutTests/inspector/canvas/recording-webgl-snapshots.html
r222182 r222888 97 97 description: "Check that the snapshot taken after each visual action is different.", 98 98 test(resolve, reject) { 99 requestRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {singleFrame: true});99 startRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {singleFrame: true}); 100 100 }, 101 101 }); -
trunk/LayoutTests/inspector/canvas/recording-webgl.html
r222182 r222888 504 504 description: "Check that the recording is stopped after a single frame.", 505 505 test(resolve, reject) { 506 requestRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {singleFrame: true});506 startRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {singleFrame: true}); 507 507 }, 508 508 }); … … 512 512 description: "Check that recording data is serialized correctly for multiple frames.", 513 513 test(resolve, reject) { 514 let canvas = requestRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {singleFrame: false});514 let canvas = startRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {singleFrame: false}); 515 515 516 516 InspectorTest.singleFireEventListener("LastFrame", () => { 517 CanvasAgent. cancelRecording(canvas.identifier, (error) => {517 CanvasAgent.stopRecording(canvas.identifier, (error) => { 518 518 if (error) { 519 519 reject(error); … … 529 529 description: "Check that the recording is stopped when it reaches the memory limit.", 530 530 test(resolve, reject) { 531 requestRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {memoryLimit: 10});531 startRecording(WI.Canvas.ContextType.WebGL, resolve, reject, {memoryLimit: 10}); 532 532 }, 533 533 }); -
trunk/LayoutTests/inspector/canvas/recording.html
r220008 r222888 8 8 9 9 suite.addTestCase({ 10 name: "Canvas. requestRecording.InvalidCanvasId",10 name: "Canvas.startRecording.InvalidCanvasId", 11 11 description: "Invalid canvas identifiers should cause an error.", 12 12 test(resolve, reject) { 13 13 const canvasId = "DOES_NOT_EXIST"; 14 CanvasAgent. requestRecording(canvasId, (error) => {14 CanvasAgent.startRecording(canvasId, (error) => { 15 15 InspectorTest.expectThat(error, "Should produce an error."); 16 16 InspectorTest.log("Error: " + error); … … 21 21 22 22 suite.addTestCase({ 23 name: "Canvas. cancelRecording.InvalidCanvasId",23 name: "Canvas.stopRecording.InvalidCanvasId", 24 24 description: "Invalid canvas identifiers should cause an error.", 25 25 test(resolve, reject) { 26 26 const canvasId = "DOES_NOT_EXIST"; 27 CanvasAgent. cancelRecording(canvasId, (error) => {27 CanvasAgent.stopRecording(canvasId, (error) => { 28 28 InspectorTest.expectThat(error, "Should produce an error."); 29 29 InspectorTest.log("Error: " + error); -
trunk/LayoutTests/inspector/canvas/resources/recording-utilities.js
r222182 r222888 94 94 }; 95 95 96 window. requestRecording = function(type, resolve, reject, {singleFrame, memoryLimit} = {}) {96 window.startRecording = function(type, resolve, reject, {singleFrame, memoryLimit} = {}) { 97 97 let canvas = getCanvas(type); 98 98 if (!canvas) { … … 101 101 } 102 102 103 WI.canvasManager.awaitEvent(WI.CanvasManager.Event.Recording Finished).then((event) => {103 WI.canvasManager.awaitEvent(WI.CanvasManager.Event.RecordingStopped).then((event) => { 104 104 InspectorTest.evaluateInPage(`cancelActions()`); 105 105 … … 112 112 }).then(resolve, reject); 113 113 114 CanvasAgent. requestRecording(canvas.identifier, singleFrame, memoryLimit, (error) => {114 CanvasAgent.startRecording(canvas.identifier, singleFrame, memoryLimit, (error) => { 115 115 if (error) { 116 116 reject(error); -
trunk/Source/JavaScriptCore/ChangeLog
r222878 r222888 1 2017-10-04 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Improve CanvasManager recording events 4 https://bugs.webkit.org/show_bug.cgi?id=177762 5 6 Reviewed by Devin Rousso. 7 8 * inspector/protocol/Canvas.json: 9 Renamed events for clarity and consistency; made recording data optional. 10 1 11 2017-10-04 JF Bastien <jfbastien@apple.com> 2 12 -
trunk/Source/JavaScriptCore/inspector/protocol/Canvas.json
r221025 r222888 106 106 }, 107 107 { 108 "name": " requestRecording",109 "description": "Re quests that the next frame or up to the given number of bytes of data be recordedfor the given canvas.",108 "name": "startRecording", 109 "description": "Record the next frame, or up to the given number of bytes of data, for the given canvas.", 110 110 "parameters": [ 111 111 { "name": "canvasId", "$ref": "CanvasId" }, … … 115 115 }, 116 116 { 117 "name": " cancelRecording",118 "description": " Cancels a requested recording forthe given canvas.",117 "name": "stopRecording", 118 "description": "Stop recording the given canvas.", 119 119 "parameters": [ 120 120 { "name": "canvasId", "$ref": "CanvasId" } … … 180 180 "parameters": [ 181 181 { "name": "canvasId", "$ref": "CanvasId" }, 182 { "name": "recording", "$ref": "Recording.Recording" }182 { "name": "recording", "$ref": "Recording.Recording", "optional": true } 183 183 ] 184 184 }, -
trunk/Source/WebCore/ChangeLog
r222887 r222888 1 2017-10-04 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Improve CanvasManager recording events 4 https://bugs.webkit.org/show_bug.cgi?id=177762 5 6 Reviewed by Devin Rousso. 7 8 Dispatch Canvas.recordingFinished regardless of whether any actions were 9 recorded. Without this extra guarantee, the frontend has to keep track 10 of additional state to determine whether a recording is in progress. 11 12 * inspector/InspectorCanvasAgent.cpp: 13 (WebCore::InspectorCanvasAgent::startRecording): 14 (WebCore::InspectorCanvasAgent::stopRecording): 15 (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame): 16 (WebCore::InspectorCanvasAgent::requestRecording): Deleted. 17 (WebCore::InspectorCanvasAgent::cancelRecording): Deleted. 18 * inspector/InspectorCanvasAgent.h: 19 1 20 2017-10-04 Nan Wang <n_wang@apple.com> 2 21 -
trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp
r221232 r222888 238 238 } 239 239 240 void InspectorCanvasAgent:: requestRecording(ErrorString& errorString, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit)240 void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit) 241 241 { 242 242 auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId); … … 258 258 } 259 259 260 void InspectorCanvasAgent:: cancelRecording(ErrorString& errorString, const String& canvasId)260 void InspectorCanvasAgent::stopRecording(ErrorString& errorString, const String& canvasId) 261 261 { 262 262 auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId); … … 461 461 return; 462 462 463 if (!inspectorCanvas->hasRecordingData()) 464 return; 463 if (!inspectorCanvas->hasRecordingData()) { 464 if (forceDispatch) 465 m_frontendDispatcher->recordingFinished(inspectorCanvas->identifier(), nullptr); 466 return; 467 } 465 468 466 469 if (!forceDispatch && !inspectorCanvas->singleFrame()) { -
trunk/Source/WebCore/inspector/InspectorCanvasAgent.h
r221025 r222888 74 74 void requestCSSCanvasClientNodes(ErrorString&, const String& canvasId, RefPtr<Inspector::Protocol::Array<int>>&) override; 75 75 void resolveCanvasContext(ErrorString&, const String& canvasId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override; 76 void requestRecording(ErrorString&, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit) override;77 void cancelRecording(ErrorString&, const String& canvasId) override;76 void startRecording(ErrorString&, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit) override; 77 void stopRecording(ErrorString&, const String& canvasId) override; 78 78 void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String*) override; 79 79 void updateShader(ErrorString&, const String& programId, const String& shaderType, const String& source) override; -
trunk/Source/WebInspectorUI/ChangeLog
r222868 r222888 1 2017-10-04 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Improve CanvasManager recording events 4 https://bugs.webkit.org/show_bug.cgi?id=177762 5 6 Reviewed by Devin Rousso. 7 8 * UserInterface/Controllers/CanvasManager.js: 9 (WI.CanvasManager.prototype.startRecording): 10 (WI.CanvasManager.prototype.stopRecording): 11 (WI.CanvasManager.prototype.recordingFinished): 12 Replace the RecordingFinished event with a pair of events. RecordingStarted 13 is sent when CanvasAgent.startRecording succeeds. RecordingStopped is 14 sent when a recordingFinished event is received from the backend, or 15 when a call to CanvasAgent.stopRecording fails. 16 17 * UserInterface/Views/CanvasContentView.js: 18 (WI.CanvasContentView.prototype.initialLayout): 19 (WI.CanvasContentView.prototype._toggleRecording): 20 (WI.CanvasContentView.prototype._recordingStarted): 21 (WI.CanvasContentView.prototype._recordingFinished): Deleted. 22 Update recording status when CanvasManager fires recording events, 23 instead of immediately after clicking the record button. 24 1 25 2017-10-04 Joseph Pecoraro <pecoraro@apple.com> 2 26 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
r222171 r222888 62 62 this._recordingCanvas = canvas; 63 63 64 CanvasAgent.requestRecording(canvas.identifier, singleFrame, (error) => { 64 CanvasAgent.startRecording(canvas.identifier, singleFrame, (error) => { 65 if (error) { 66 console.error(error); 67 this._recordingCanvas = null; 68 return; 69 } 70 71 this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingStarted, {canvas}); 72 }); 73 } 74 75 stopRecording() 76 { 77 console.assert(this._recordingCanvas, "No recording started."); 78 if (!this._recordingCanvas) 79 return; 80 81 let canvas = this._recordingCanvas; 82 this._recordingCanvas = null; 83 84 CanvasAgent.stopRecording(canvas.identifier, (error) => { 65 85 if (!error) 66 86 return; 67 87 68 88 console.error(error); 69 this._recordingCanvas = null; 70 71 this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingFinished, {canvas, recording: null}); 72 }); 73 } 74 75 stopRecording() 76 { 77 console.assert(this._recordingCanvas, "No recording started."); 78 if (!this._recordingCanvas) 79 return; 80 81 let canvasIdentifier = this._recordingCanvas.identifier; 82 this._recordingCanvas = null; 83 84 CanvasAgent.cancelRecording(canvasIdentifier, (error) => { 85 if (error) 86 console.error(error); 89 this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingStopped, {canvas, recording: null}); 87 90 }); 88 91 } … … 156 159 return; 157 160 158 let recording = WI.Recording.fromPayload(recordingPayload); 159 recording.source = canvas; 160 161 this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingFinished, {canvas, recording}); 161 let recording = recordingPayload ? WI.Recording.fromPayload(recordingPayload) : null 162 if (recording) 163 recording.source = canvas; 164 165 this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingStopped, {canvas, recording}); 162 166 } 163 167 … … 223 227 CanvasWasAdded: "canvas-manager-canvas-was-added", 224 228 CanvasWasRemoved: "canvas-manager-canvas-was-removed", 225 RecordingFinished: "canvas-managger-recording-finished", 229 RecordingStarted: "canvas-manager-recording-started", 230 RecordingStopped: "canvas-manager-recording-stopped", 226 231 ShaderProgramAdded: "canvas-manager-shader-program-added", 227 232 ShaderProgramRemoved: "canvas-manager-shader-program-removed", -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js
r221901 r222888 70 70 super.initialLayout(); 71 71 72 WI.canvasManager.addEventListener(WI.CanvasManager.Event.RecordingFinished, this._recordingFinished, this); 72 WI.canvasManager.addEventListener(WI.CanvasManager.Event.RecordingStarted, this._recordingStarted, this); 73 WI.canvasManager.addEventListener(WI.CanvasManager.Event.RecordingStopped, this._recordingStopped, this); 73 74 } 74 75 … … 107 108 WI.canvasManager.startRecording(this.representedObject, singleFrame); 108 109 } 110 } 109 111 112 _recordingStarted(event) 113 { 110 114 this._updateRecordNavigationItem(); 111 115 } 112 116 113 _recording Finished(event)117 _recordingStopped(event) 114 118 { 115 119 this._updateRecordNavigationItem();
Note: See TracChangeset
for help on using the changeset viewer.