Commit 387f50ed authored by timothy@apple.com's avatar timothy@apple.com
Browse files

Clean up Timelines code by using ES6 features and less global access of TimelineRecording.

Also don't recreate Timeline objects when TimelineRecording is reset, reset them instead.

https://bugs.webkit.org/show_bug.cgi?id=127157

Reviewed by Joseph Pecoraro.

* UserInterface/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype.reset):
* UserInterface/NetworkTimeline.js:
(WebInspector.NetworkTimeline):
(WebInspector.NetworkTimeline.prototype.reset):
* UserInterface/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype.reset):
* UserInterface/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype._networkTimelineRecordAdded):
* UserInterface/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView.prototype.reset):
* UserInterface/Timeline.js:
(WebInspector.Timeline):
(WebInspector.Timeline.prototype.reset):
* UserInterface/TimelineContentView.js:
(WebInspector.TimelineContentView.set createPathComponent):
(WebInspector.TimelineContentView.set var):
(WebInspector.TimelineContentView.prototype.showOverviewTimelineView):
(WebInspector.TimelineContentView.prototype.showTimelineView):
(WebInspector.TimelineContentView.prototype._showTimelineView):
(WebInspector.TimelineContentView.prototype._update):
(WebInspector.TimelineContentView.prototype._recordingReset):
* UserInterface/TimelineRecording.js:
(WebInspector.TimelineRecording.prototype.reset):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5474c9b4
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
2014-01-16  Timothy Hatcher  <timothy@apple.com>

        Clean up Timelines code by using ES6 features and less global access of TimelineRecording.
        Also don't recreate Timeline objects when TimelineRecording is reset, reset them instead.

        https://bugs.webkit.org/show_bug.cgi?id=127157

        Reviewed by Joseph Pecoraro.

        * UserInterface/LayoutTimelineView.js:
        (WebInspector.LayoutTimelineView.prototype.reset):
        * UserInterface/NetworkTimeline.js:
        (WebInspector.NetworkTimeline):
        (WebInspector.NetworkTimeline.prototype.reset):
        * UserInterface/NetworkTimelineView.js:
        (WebInspector.NetworkTimelineView.prototype.reset):
        * UserInterface/OverviewTimelineView.js:
        (WebInspector.OverviewTimelineView.prototype._networkTimelineRecordAdded):
        * UserInterface/ScriptTimelineView.js:
        (WebInspector.ScriptTimelineView.prototype.reset):
        * UserInterface/Timeline.js:
        (WebInspector.Timeline):
        (WebInspector.Timeline.prototype.reset):
        * UserInterface/TimelineContentView.js:
        (WebInspector.TimelineContentView.set createPathComponent):
        (WebInspector.TimelineContentView.set var):
        (WebInspector.TimelineContentView.prototype.showOverviewTimelineView):
        (WebInspector.TimelineContentView.prototype.showTimelineView):
        (WebInspector.TimelineContentView.prototype._showTimelineView):
        (WebInspector.TimelineContentView.prototype._update):
        (WebInspector.TimelineContentView.prototype._recordingReset):
        * UserInterface/TimelineRecording.js:
        (WebInspector.TimelineRecording.prototype.reset):

2014-01-16  Timothy Hatcher  <timothy@apple.com>

        Improve WebInspector.TimelineOverview by not putting WebInspector.TimelineRuler in a scroll area.
+4 −9
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

WebInspector.LayoutTimelineView = function()
WebInspector.LayoutTimelineView = function(recording)
{
    WebInspector.TimelineView.call(this);

@@ -65,6 +65,9 @@ WebInspector.LayoutTimelineView = function()
    this.element.classList.add(WebInspector.LayoutTimelineView.StyleClassName);
    this.element.appendChild(this._dataGrid.element);

    var layoutTimeline = recording.timelines.get(WebInspector.TimelineRecord.Type.Layout);
    layoutTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._layoutTimelineRecordAdded, this);

    this._pendingRecords = [];
};

@@ -115,14 +118,6 @@ WebInspector.LayoutTimelineView.prototype = {
        WebInspector.TimelineView.prototype.reset.call(this);

        this._dataGrid.reset();

        if (this._layoutTimeline)
            this._layoutTimeline.removeEventListener(null, null, this);

        this._layoutTimeline = WebInspector.timelineManager.recording.timelines.get(WebInspector.TimelineRecord.Type.Layout);
        console.assert(this._layoutTimeline);

        this._layoutTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._layoutTimelineRecordAdded, this);
    },

    // Private
+7 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@
WebInspector.NetworkTimeline = function()
{
    WebInspector.Timeline.call(this);

    this._resourceRecordMap = new Map;
};

WebInspector.NetworkTimeline.prototype = {
@@ -43,6 +41,13 @@ WebInspector.NetworkTimeline.prototype = {
        return this._resourceRecordMap.get(resource) || null;
    },

    reset: function(suppressEvents)
    {
        this._resourceRecordMap = new Map;

        WebInspector.Timeline.prototype.reset.call(this, suppressEvents);
    },

    addRecord: function(record)
    {
        console.assert(record instanceof WebInspector.ResourceTimelineRecord);
+4 −9
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

WebInspector.NetworkTimelineView = function()
WebInspector.NetworkTimelineView = function(recording)
{
    WebInspector.TimelineView.call(this);

@@ -82,6 +82,9 @@ WebInspector.NetworkTimelineView = function()
    this.element.classList.add(WebInspector.NetworkTimelineView.StyleClassName);
    this.element.appendChild(this._dataGrid.element);

    var networkTimeline = recording.timelines.get(WebInspector.TimelineRecord.Type.Network);
    networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);

    this._pendingRecords = [];
};

@@ -132,14 +135,6 @@ WebInspector.NetworkTimelineView.prototype = {
        WebInspector.TimelineView.prototype.reset.call(this);

        this._dataGrid.reset();

        if (this._networkTimeline)
            this._networkTimeline.removeEventListener(null, null, this);

        this._networkTimeline = WebInspector.timelineManager.recording.timelines.get(WebInspector.TimelineRecord.Type.Network);
        console.assert(this._networkTimeline);

        this._networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
    },

    // Private
+9 −14
Original line number Diff line number Diff line
@@ -23,10 +23,12 @@
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

WebInspector.OverviewTimelineView = function()
WebInspector.OverviewTimelineView = function(recording)
{
    WebInspector.TimelineView.call(this);

    this._recording = recording;

    this.navigationSidebarTreeOutline.onselect = this._treeElementSelected.bind(this);

    var columns = {"graph": {width: "100%"}};
@@ -44,9 +46,12 @@ WebInspector.OverviewTimelineView = function()
    this.element.classList.add(WebInspector.OverviewTimelineView.StyleClassName);
    this.element.appendChild(this._dataGrid.element);

    this._pendingRepresentedObjects = [];
    this._networkTimeline = recording.timelines.get(WebInspector.TimelineRecord.Type.Network);
    this._networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);

    WebInspector.timelineManager.recording.addEventListener(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded, this._sourceCodeTimelineAdded, this);
    recording.addEventListener(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded, this._sourceCodeTimelineAdded, this);

    this._pendingRepresentedObjects = [];
};

WebInspector.OverviewTimelineView.StyleClassName = "overview";
@@ -62,16 +67,6 @@ WebInspector.OverviewTimelineView.prototype = {
        return WebInspector.UIString("Timeline Events");
    },

    reset: function()
    {
        WebInspector.TimelineView.prototype.reset.call(this);

        this._networkTimeline = WebInspector.timelineManager.recording.timelines.get(WebInspector.TimelineRecord.Type.Network);
        console.assert(this._networkTimeline);

        this._networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._networkTimelineRecordAdded, this);
    },

    shown: function()
    {
        WebInspector.TimelineView.prototype.shown.call(this);
@@ -256,7 +251,7 @@ WebInspector.OverviewTimelineView.prototype = {
        this.needsLayout();

        // We don't expect to have any source code timelines yet. Those should be added with _sourceCodeTimelineAdded.
        console.assert(!WebInspector.timelineManager.recording.sourceCodeTimelinesForSourceCode(resourceTimelineRecord.resource).length);
        console.assert(!this._recording.sourceCodeTimelinesForSourceCode(resourceTimelineRecord.resource).length);
    },

    _sourceCodeTimelineAdded: function(event)
Loading