Web Inspector: Timeline current time marker does not start moving when starting recor...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Oct 2015 21:38:46 +0000 (21:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Oct 2015 21:38:46 +0000 (21:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150178

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-10-27
Reviewed by Brian Burg.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.capturingStarted):
* UserInterface/Models/TimelineRecording.js:
(WebInspector.TimelineRecording.prototype.initializeTimeBoundsIfNecessary):
For a recording to start updating current time the recording itself
must have a start time. Provide a setter so that the start time can
be set without waiting for a timeline record. For example the
timestamp that the frontend receives when it starts a recording.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
When we have a startTime number (new backends) always use it as the current time.
Previously we were only doing this if current time was NaN, which would be when
re-starting a recording after it had stopped, but not for the initial recording
after opening the inspector.

* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.updateLayout):
Even if we do not need to create new time dividers we may need to perform
other updates like update the current time marker. So do work before bailing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191639 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js

index 4e3f5b0..5719719 100644 (file)
@@ -1,3 +1,31 @@
+2015-10-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Timeline current time marker does not start moving when starting recording after just opening inspector
+        https://bugs.webkit.org/show_bug.cgi?id=150178
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype.capturingStarted):
+        * UserInterface/Models/TimelineRecording.js:
+        (WebInspector.TimelineRecording.prototype.initializeTimeBoundsIfNecessary):
+        For a recording to start updating current time the recording itself
+        must have a start time. Provide a setter so that the start time can
+        be set without waiting for a timeline record. For example the
+        timestamp that the frontend receives when it starts a recording.
+
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
+        When we have a startTime number (new backends) always use it as the current time.
+        Previously we were only doing this if current time was NaN, which would be when
+        re-starting a recording after it had stopped, but not for the initial recording
+        after opening the inspector.
+
+        * UserInterface/Views/TimelineRuler.js:
+        (WebInspector.TimelineRuler.prototype.updateLayout):
+        Even if we do not need to create new time dividers we may need to perform
+        other updates like update the current time marker. So do work before bailing.
+
 2015-10-26  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: WebInspector.Object can dispatch constructor-level events multiple times
index 70ebd1c..2d4cd55 100644 (file)
@@ -153,6 +153,9 @@ WebInspector.TimelineManager = class TimelineManager extends WebInspector.Object
 
         this._isCapturing = true;
 
+        if (startTime)
+            this.activeRecording.initializeTimeBoundsIfNecessary(startTime);
+
         this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted, {startTime});
     }
 
index 5ba3b31..ad13495 100644 (file)
@@ -228,6 +228,18 @@ WebInspector.TimelineRecording = class TimelineRecording extends WebInspector.Ob
         this._legacyFirstRecordedTimestamp = timestamp;
     }
 
+    initializeTimeBoundsIfNecessary(timestamp)
+    {
+        if (isNaN(this._startTime)) {
+            console.assert(isNaN(this._endTime));
+
+            this._startTime = timestamp;
+            this._endTime = timestamp;
+
+            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);
+        }
+    }
+
     // Private
 
     _keyForRecord(record)
index 01cee4f..7597bc8 100644 (file)
@@ -460,18 +460,16 @@ WebInspector.TimelineRecordingContentView = class TimelineRecordingContentView e
         if (this._updating)
             return;
 
-        if (!isNaN(this._currentTime)) {
+        if (typeof startTime === "number")
+            this._currentTime = startTime;
+        else if (!isNaN(this._currentTime)) {
             // This happens when you stop and later restart recording.
-            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);
-            }
+            // 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;
index e66f1f5..4092d42 100644 (file)
@@ -371,8 +371,12 @@ WebInspector.TimelineRuler = class TimelineRuler extends WebInspector.Object
             lastTime: lastDividerTime,
         };
 
-        if (Object.shallowEqual(dividerData, this._currentDividers))
+        if (Object.shallowEqual(dividerData, this._currentDividers)) {
+            this._updateMarkers(visibleWidth, duration);
+            this._updateSelection(visibleWidth, duration);
             return;
+        }
+
         this._currentDividers = dividerData;
 
         var markerDividers = this._markersElement.querySelectorAll("." + WebInspector.TimelineRuler.DividerElementStyleClassName);