Title: [192560] trunk/Source/WebInspectorUI
Revision
192560
Author
commit-qu...@webkit.org
Date
2015-11-17 17:34:49 -0800 (Tue, 17 Nov 2015)

Log Message

Web Inspector: Move Timeline creation into a recording
https://bugs.webkit.org/show_bug.cgi?id=151367

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

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype._loadNewRecording): Deleted.
* UserInterface/Models/Timeline.js:
(WebInspector.Timeline.create):
(WebInspector.Timeline.prototype.get type):
(WebInspector.Timeline): Deleted.
(WebInspector.Timeline.prototype.get recording): Deleted.
* UserInterface/Models/TimelineRecording.js:
(WebInspector.TimelineRecording):
(WebInspector.TimelineRecording.prototype.get readonly):
(WebInspector.TimelineRecording.prototype.unloaded):
(WebInspector.TimelineRecording.prototype.reset):
(WebInspector.TimelineRecording.prototype.isWritable): Deleted.
* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview):
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype.shown):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (192559 => 192560)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-11-18 01:29:15 UTC (rev 192559)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-11-18 01:34:49 UTC (rev 192560)
@@ -1,3 +1,28 @@
+2015-11-17  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Move Timeline creation into a recording
+        https://bugs.webkit.org/show_bug.cgi?id=151367
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype._loadNewRecording): Deleted.
+        * UserInterface/Models/Timeline.js:
+        (WebInspector.Timeline.create):
+        (WebInspector.Timeline.prototype.get type):
+        (WebInspector.Timeline): Deleted.
+        (WebInspector.Timeline.prototype.get recording): Deleted.
+        * UserInterface/Models/TimelineRecording.js:
+        (WebInspector.TimelineRecording):
+        (WebInspector.TimelineRecording.prototype.get readonly):
+        (WebInspector.TimelineRecording.prototype.unloaded):
+        (WebInspector.TimelineRecording.prototype.reset):
+        (WebInspector.TimelineRecording.prototype.isWritable): Deleted.
+        * UserInterface/Views/TimelineOverview.js:
+        (WebInspector.TimelineOverview):
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView.prototype.shown):
+
 2015-11-17  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: Breakpoint condition field should use CodeMirror

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (192559 => 192560)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-11-18 01:29:15 UTC (rev 192559)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-11-18 01:34:49 UTC (rev 192560)
@@ -447,19 +447,10 @@
 
         var identifier = this._nextRecordingIdentifier++;
         var newRecording = new WebInspector.TimelineRecording(identifier, WebInspector.UIString("Timeline Recording %d").format(identifier));
-        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Network, newRecording));
-        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Layout, newRecording));
-        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Script, newRecording));
 
-        // COMPATIBILITY (iOS 8): TimelineAgent.EventType.RenderingFrame did not exist.
-        if (window.TimelineAgent && TimelineAgent.EventType.RenderingFrame)
-            newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.RenderingFrame, newRecording));
-
         this._recordings.push(newRecording);
         this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingCreated, {recording: newRecording});
 
-        console.assert(newRecording.isWritable());
-
         if (this._isCapturing)
             this.stopCapturing();
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js (192559 => 192560)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js	2015-11-18 01:29:15 UTC (rev 192559)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js	2015-11-18 01:34:49 UTC (rev 192560)
@@ -25,28 +25,32 @@
 
 WebInspector.Timeline = class Timeline extends WebInspector.Object
 {
-    constructor(type, recording)
+    constructor(type)
     {
         super();
 
         this._type = type;
-        this._recording = recording;
 
         this.reset(true);
     }
 
     // Static
 
-    static create(type, recording)
+    static create(type)
     {
         if (type === WebInspector.TimelineRecord.Type.Network)
-            return new WebInspector.NetworkTimeline(type, recording);
+            return new WebInspector.NetworkTimeline(type);
 
-        return new WebInspector.Timeline(type, recording);
+        return new WebInspector.Timeline(type);
     }
 
     // Public
 
+    get type()
+    {
+        return this._type;
+    }
+
     get startTime()
     {
         return this._startTime;
@@ -62,16 +66,6 @@
         return this._records;
     }
 
-    get type()
-    {
-        return this._type;
-    }
-
-    get recording()
-    {
-        return this._recording;
-    }
-
     get displayName()
     {
         if (this._type === WebInspector.TimelineRecord.Type.Network)

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js (192559 => 192560)


--- trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js	2015-11-18 01:29:15 UTC (rev 192559)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js	2015-11-18 01:34:49 UTC (rev 192560)
@@ -32,8 +32,16 @@
         this._identifier = identifier;
         this._timelines = new Map;
         this._displayName = displayName;
-        this._isWritable = true;
+        this._readonly = false;
 
+        this.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Network));
+        this.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Layout));
+        this.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Script));
+
+        // COMPATIBILITY (iOS 8): TimelineAgent.EventType.RenderingFrame did not exist.
+        if (window.TimelineAgent && TimelineAgent.EventType.RenderingFrame)
+            this.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.RenderingFrame));
+
         // For legacy backends, we compute the elapsed time of records relative to this timestamp.
         this._legacyFirstRecordedTimestamp = NaN;
 
@@ -57,6 +65,11 @@
         return this._timelines;
     }
 
+    get readonly()
+    {
+        return this._readonly;
+    }
+
     get startTime()
     {
         return this._startTime;
@@ -73,11 +86,6 @@
         // re-opened, so do not attempt to restore by identifier or display name.
     }
 
-    isWritable()
-    {
-        return this._isWritable;
-    }
-
     isEmpty()
     {
         for (var timeline of this._timelines.values()) {
@@ -92,14 +100,14 @@
     {
         console.assert(!this.isEmpty(), "Shouldn't unload an empty recording; it should be reused instead.");
 
-        this._isWritable = false;
+        this._readonly = true;
 
         this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Unloaded);
     }
 
     reset(suppressEvents)
     {
-        console.assert(this._isWritable, "Can't reset a read-only recording.");
+        console.assert(!this._readonly, "Can't reset a read-only recording.");
 
         this._sourceCodeTimelinesMap = new Map;
         this._eventMarkers = [];

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (192559 => 192560)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-11-18 01:29:15 UTC (rev 192559)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-11-18 01:34:49 UTC (rev 192560)
@@ -29,6 +29,8 @@
     {
         super();
 
+        console.assert(timelineRecording instanceof WebInspector.TimelineRecording);
+
         this._recording = timelineRecording;
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimelineAdded, this._timelineAdded, this);
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimelineRemoved, this._timelineRemoved, this);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (192559 => 192560)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-11-18 01:29:15 UTC (rev 192559)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-11-18 01:34:49 UTC (rev 192560)
@@ -164,7 +164,7 @@
     {
         this._currentTimelineOverview.shown();
         this._contentViewContainer.shown();
-        this._clearTimelineNavigationItem.enabled = this._recording.isWritable();
+        this._clearTimelineNavigationItem.enabled = !this._recording.readonly;
 
         this._currentContentViewDidChange();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to