Title: [187211] trunk
Revision
187211
Author
commit-qu...@webkit.org
Date
2015-07-22 21:45:52 -0700 (Wed, 22 Jul 2015)

Log Message

Web Inspector: Timeline should immediately start moving play head when starting a new recording
https://bugs.webkit.org/show_bug.cgi?id=147210

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-07-22
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

* inspector/protocol/Timeline.json:
Add timestamps to recordingStarted and recordingStopped events.

Source/WebCore:

Test: inspector/timeline/recording-start-stop-timestamps.html

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
Include the current timestamp when starting / stopping a recording.

Source/WebInspectorUI:

* UserInterface/Protocol/TimelineObserver.js:
(WebInspector.TimelineObserver.prototype.recordingStarted):
(WebInspector.TimelineObserver.prototype.recordingStopped):
Pass on the new timestamps.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.capturingStarted):
(WebInspector.TimelineManager.prototype.capturingStopped):
Pass on the new timestamps in the events.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype._capturingStarted):
Pass on the new timestamp from the event as it can be used to update the currentTime.

(WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
If provided a startTime we can use that as the new currentTime. Otherwise fallback
to determining a good currentTime from the next incoming record for legacy backends.

(WebInspector.TimelineRecordingContentView.prototype._recordingTimesUpdated):
Update the comment, as there is now a solution but this is required for legacy backends.

LayoutTests:

* inspector/timeline/recording-start-stop-timestamps-expected.txt: Added.
* inspector/timeline/recording-start-stop-timestamps.html: Added.
Add a test for Timeline.recordingStarted and Timeline.recordingStopped events.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (187210 => 187211)


--- trunk/LayoutTests/ChangeLog	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/LayoutTests/ChangeLog	2015-07-23 04:45:52 UTC (rev 187211)
@@ -1,3 +1,14 @@
+2015-07-22  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Timeline should immediately start moving play head when starting a new recording
+        https://bugs.webkit.org/show_bug.cgi?id=147210
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/timeline/recording-start-stop-timestamps-expected.txt: Added.
+        * inspector/timeline/recording-start-stop-timestamps.html: Added.
+        Add a test for Timeline.recordingStarted and Timeline.recordingStopped events.
+
 2015-07-22  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Coordinates-based snap offsets don't update correctly when container is scrolled

Added: trunk/LayoutTests/inspector/timeline/recording-start-stop-timestamps-expected.txt (0 => 187211)


--- trunk/LayoutTests/inspector/timeline/recording-start-stop-timestamps-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/recording-start-stop-timestamps-expected.txt	2015-07-23 04:45:52 UTC (rev 187211)
@@ -0,0 +1,10 @@
+Testing that timeline start and stop events have timestamps and are ordered reasonably.
+
+PASS: 1st CapturingStarted had startTime
+PASS: 1st CapturingStopped had endTime
+PASS: 1st CapturingStopped had endTime > 1st CapturingStarted
+PASS: 2nd CapturingStarted had startTime > 1st CapturingStarted
+PASS: 2nd CapturingStarted had startTime > 1st CapturingStopped
+PASS: 2nd CapturingStopped had endTime > 1st CapturingStopped
+PASS: 2nd CapturingStopped had endTime > 2nd CapturingStarted
+

Added: trunk/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html (0 => 187211)


--- trunk/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/recording-start-stop-timestamps.html	2015-07-23 04:45:52 UTC (rev 187211)
@@ -0,0 +1,61 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    var recordingStartTime = NaN;
+    var recordingEndTime = NaN;
+
+    function check(condition, message)
+    {
+        InspectorTest.log((condition ? "PASS" : "FAIL") + ": " + message);
+    }
+
+    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, function(event) {
+        InspectorTest.assert(typeof event.data.startTime === "number");
+        InspectorTest.assert(event.data.startTime > 0);
+
+        if (isNaN(recordingStartTime)) {
+            InspectorTest.log("PASS: 1st CapturingStarted had startTime");
+        } else {
+            InspectorTest.assert(event.data.startTime > recordingStartTime, "FAIL: 2nd CapturingStarted should be > 1st CapturingStarted");
+            InspectorTest.log("PASS: 2nd CapturingStarted had startTime > 1st CapturingStarted");
+            InspectorTest.assert(event.data.startTime > recordingEndTime, "FAIL: 2nd CapturingStarted should be > 1st CapturingStopped");
+            InspectorTest.log("PASS: 2nd CapturingStarted had startTime > 1st CapturingStopped");
+        }
+
+        recordingStartTime = event.data.startTime;
+    });
+
+    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, function(event) {
+        InspectorTest.assert(typeof event.data.endTime === "number");
+        InspectorTest.assert(event.data.endTime > 0);
+
+        if (isNaN(recordingEndTime)) {
+            InspectorTest.log("PASS: 1st CapturingStopped had endTime");
+            InspectorTest.assert(event.data.endTime > recordingStartTime, "FAIL: 1st CapturingStopped should be > 1st CapturingStarted");
+            InspectorTest.log("PASS: 1st CapturingStopped had endTime > 1st CapturingStarted");
+        } else {
+            InspectorTest.assert(event.data.endTime > recordingEndTime, "FAIL: 2nd CapturingStopped should be > 1st CapturingStopped");
+            InspectorTest.log("PASS: 2nd CapturingStopped had endTime > 1st CapturingStopped");
+            InspectorTest.assert(event.data.endTime > recordingStartTime, "FAIL: 2nd CapturingStopped should be > 2nd CapturingStarted");
+            InspectorTest.log("PASS: 2nd CapturingStopped had endTime > 2nd CapturingStarted");
+            InspectorTest.completeTest();
+        }
+
+        recordingEndTime = event.data.endTime;
+    });
+
+    TimelineAgent.start()
+        .then(function() { return TimelineAgent.stop(); })
+        .then(function() { return TimelineAgent.start(); })
+        .then(function() { return TimelineAgent.stop(); });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Testing that timeline start and stop events have timestamps and are ordered reasonably.</p>
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (187210 => 187211)


--- trunk/Source/_javascript_Core/ChangeLog	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-07-23 04:45:52 UTC (rev 187211)
@@ -1,3 +1,13 @@
+2015-07-22  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Timeline should immediately start moving play head when starting a new recording
+        https://bugs.webkit.org/show_bug.cgi?id=147210
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/Timeline.json:
+        Add timestamps to recordingStarted and recordingStopped events.
+
 2015-07-22  Yusuke Suzuki  <utatane....@gmail.com>
 
         Introducing construct ability into JS executables

Modified: trunk/Source/_javascript_Core/inspector/protocol/Timeline.json (187210 => 187211)


--- trunk/Source/_javascript_Core/inspector/protocol/Timeline.json	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/_javascript_Core/inspector/protocol/Timeline.json	2015-07-23 04:45:52 UTC (rev 187211)
@@ -110,10 +110,16 @@
         },
         {
             "name": "recordingStarted",
+            "parameters": [
+                { "name": "startTime", "type": "number", "description": "Start time of this new recording." }
+            ],
             "description": "Fired when recording has started."
         },
         {
             "name": "recordingStopped",
+            "parameters": [
+                { "name": "endTime", "type": "number", "description": "End time of this recording." }
+            ],
             "description": "Fired when recording has stopped."
         }
     ]

Modified: trunk/Source/WebCore/ChangeLog (187210 => 187211)


--- trunk/Source/WebCore/ChangeLog	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/WebCore/ChangeLog	2015-07-23 04:45:52 UTC (rev 187211)
@@ -1,3 +1,17 @@
+2015-07-22  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Timeline should immediately start moving play head when starting a new recording
+        https://bugs.webkit.org/show_bug.cgi?id=147210
+
+        Reviewed by Timothy Hatcher.
+
+        Test: inspector/timeline/recording-start-stop-timestamps.html
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::internalStart):
+        (WebCore::InspectorTimelineAgent::internalStop):
+        Include the current timestamp when starting / stopping a recording.
+
 2015-07-22  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Coordinates-based snap offsets don't update correctly when container is scrolled

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (187210 => 187211)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2015-07-23 04:45:52 UTC (rev 187211)
@@ -185,7 +185,7 @@
 #endif
 
     if (m_frontendDispatcher)
-        m_frontendDispatcher->recordingStarted();
+        m_frontendDispatcher->recordingStarted(timestamp());
 }
 
 void InspectorTimelineAgent::internalStop()
@@ -214,7 +214,7 @@
     m_startedComposite = false;
 
     if (m_frontendDispatcher)
-        m_frontendDispatcher->recordingStopped();
+        m_frontendDispatcher->recordingStopped(timestamp());
 }
 
 double InspectorTimelineAgent::timestamp()

Modified: trunk/Source/WebInspectorUI/ChangeLog (187210 => 187211)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-23 04:45:52 UTC (rev 187211)
@@ -1,5 +1,33 @@
 2015-07-22  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: Timeline should immediately start moving play head when starting a new recording
+        https://bugs.webkit.org/show_bug.cgi?id=147210
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Protocol/TimelineObserver.js:
+        (WebInspector.TimelineObserver.prototype.recordingStarted):
+        (WebInspector.TimelineObserver.prototype.recordingStopped):
+        Pass on the new timestamps.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype.capturingStarted):
+        (WebInspector.TimelineManager.prototype.capturingStopped):
+        Pass on the new timestamps in the events.
+
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView.prototype._capturingStarted):
+        Pass on the new timestamp from the event as it can be used to update the currentTime.
+
+        (WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
+        If provided a startTime we can use that as the new currentTime. Otherwise fallback
+        to determining a good currentTime from the next incoming record for legacy backends.
+
+        (WebInspector.TimelineRecordingContentView.prototype._recordingTimesUpdated):
+        Update the comment, as there is now a solution but this is required for legacy backends.
+
+2015-07-22  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: Timeline's Current Time does not jump forward to new start time when starting a new recording, causes timeline to appear delayed and broken
         https://bugs.webkit.org/show_bug.cgi?id=147204
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (187210 => 187211)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-07-23 04:45:52 UTC (rev 187211)
@@ -144,17 +144,17 @@
 
     // Protected
 
-    capturingStarted()
+    capturingStarted(startTime)
     {
         if (this._isCapturing)
             return;
 
         this._isCapturing = true;
 
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted);
+        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted, {startTime});
     }
 
-    capturingStopped()
+    capturingStopped(endTime)
     {
         if (!this._isCapturing)
             return;
@@ -173,7 +173,7 @@
         this._isCapturingPageReload = false;
         this._autoCapturingMainResource = null;
 
-        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStopped);
+        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStopped, {endTime});
     }
 
     eventRecorded(recordPayload)

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js (187210 => 187211)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js	2015-07-23 04:45:52 UTC (rev 187211)
@@ -32,13 +32,13 @@
         WebInspector.timelineManager.eventRecorded(record);
     }
 
-    recordingStarted()
+    recordingStarted(startTime)
     {
-        WebInspector.timelineManager.capturingStarted();
+        WebInspector.timelineManager.capturingStarted(startTime);
     }
 
-    recordingStopped()
+    recordingStopped(endTime)
     {
-        WebInspector.timelineManager.capturingStopped();
+        WebInspector.timelineManager.capturingStopped(endTime);
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (187210 => 187211)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-07-23 04:24:12 UTC (rev 187210)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-07-23 04:45:52 UTC (rev 187211)
@@ -442,18 +442,24 @@
             this.currentTimelineView.updateLayoutIfNeeded();
     },
 
-    _startUpdatingCurrentTime: function()
+    _startUpdatingCurrentTime: function(startTime)
     {
         console.assert(!this._updating);
         if (this._updating)
             return;
 
         if (!isNaN(this._currentTime)) {
-            // We have a current time already, so we likely need to jump into the future to a better current time.
             // This happens when you stop and later restart recording.
-            console.assert(!this._waitingToResetCurrentTime);
-            this._waitingToResetCurrentTime = true;
-            this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
+            if (typeof startTime === "number")
+                this._currentTime = startTime;
+            else {
+                // COMPATIBILITY (iOS 9): Timeline.recordingStarted events did not include a timestamp.
+                // We likely need to jump into the future to a better current time which we can
+                // ascertained from a new incoming timeline record, so we wait for a Timeline to update.
+                console.assert(!this._waitingToResetCurrentTime);
+                this._waitingToResetCurrentTime = true;
+                this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
+            }
         }
 
         this._updating = true;
@@ -478,7 +484,7 @@
 
     _capturingStarted: function(event)
     {
-        this._startUpdatingCurrentTime();
+        this._startUpdatingCurrentTime(event.data.startTime);
     },
 
     _capturingStopped: function(event)
@@ -508,10 +514,9 @@
         if (!this._waitingToResetCurrentTime)
             return;
 
+        // COMPATIBILITY (iOS 9): Timeline.recordingStarted events did not include a new startTime.
         // Make the current time be the start time of the last added record. This is the best way
         // currently to jump to the right period of time after recording starts.
-        // FIXME: If no activity is happening we can sit for a while until a record is added.
-        // We might want to have the backend send a "start" record to get current time moving.
 
         for (var timeline of this._recording.timelines.values()) {
             var lastRecord = timeline.records.lastValue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to