Changeset 120988 in webkit


Ignore:
Timestamp:
Jun 21, 2012, 6:30:19 PM (13 years ago)
Author:
caseq@chromium.org
Message:

Web Inspector: exception in TimelinePresentationModel when recording timeline
https://bugs.webkit.org/show_bug.cgi?id=89716

Reviewed by Pavel Feldman.

  • inspector/front-end/TimelinePanel.js:

(WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline.processRecord):
(WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):

  • inspector/front-end/TimelinePresentationModel.js:

(WebInspector.TimelinePresentationModel.prototype.filteredRecords):
(WebInspector.TimelinePresentationModel.prototype.isVisible):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r120985 r120988  
     12012-06-21  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Web Inspector: exception in TimelinePresentationModel when recording timeline
     4        https://bugs.webkit.org/show_bug.cgi?id=89716
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/TimelinePanel.js:
     9        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline.processRecord):
     10        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):
     11        * inspector/front-end/TimelinePresentationModel.js:
     12        (WebInspector.TimelinePresentationModel.prototype.filteredRecords):
     13        (WebInspector.TimelinePresentationModel.prototype.isVisible):
     14
    1152012-06-21  Oli Lan  <olilan@chromium.org>
    216
  • trunk/Source/WebCore/inspector/front-end/TimelinePanel.js

    r120891 r120988  
    497497        var recordTypes = WebInspector.TimelineModel.RecordType;
    498498        var timeStampRecords = this._timeStampRecords;
    499         function addTimestampRecords(record)
     499        var hasVisibleRecords = false;
     500        var presentationModel = this._presentationModel;
     501        function processRecord(record)
    500502        {
    501503            if (WebInspector.TimelinePresentationModel.isEventDivider(record))
    502504                timeStampRecords.push(record);
     505            hasVisibleRecords |= presentationModel.isVisible(record);
    503506        }
    504507        var records = [ formattedRecord ];
    505         WebInspector.TimelinePresentationModel.forAllRecords(records, addTimestampRecords);
    506         return !!this._presentationModel.filterRecords(records).length || formattedRecord.parent !== this._presentationModel.rootRecord;
     508        WebInspector.TimelinePresentationModel.forAllRecords(records, processRecord);
     509        // Tell caller update is necessary either if we added a visible record or if we re-parented a record.
     510        return hasVisibleRecords || formattedRecord.parent !== this._presentationModel.rootRecord;
    507511    },
    508512
  • trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js

    r120891 r120988  
    296296    filteredRecords: function()
    297297    {
    298         return this.filterRecords(this._rootRecord.children);
    299     },
    300 
    301     filterRecords: function(records)
    302     {
    303         function filter(record)
    304         {
    305             for (var i = 0; i < this._filters.length; ++i) {
    306                 if (!this._filters[i].accept(record))
    307                     return false;
    308             }
    309             return true;
    310         }
    311         return this._innerFilterRecords(filter.bind(this), records);
    312     },
    313 
    314     /**
    315      * @param {function(WebInspector.TimelinePresentationModel.Record):boolean} filter
    316      * @param {Array.<WebInspector.TimelinePresentationModel.Record>} inputRecords
    317      */
    318     _innerFilterRecords: function(filter, inputRecords)
    319     {
    320298        var recordsInWindow = [];
    321299
    322         var stack = [{children: inputRecords, index: 0, parentIsCollapsed: false}];
     300        var stack = [{children: this._rootRecord.children, index: 0, parentIsCollapsed: false}];
    323301        while (stack.length) {
    324302            var entry = stack[stack.length - 1];
     
    328306                 ++entry.index;
    329307
    330                  if (filter(record)) {
     308                 if (this.isVisible(record)) {
    331309                     ++record.parent._invisibleChildrenCount;
    332310                     if (!entry.parentIsCollapsed)
     
    349327
    350328        return recordsInWindow;
     329    },
     330
     331    isVisible: function(record)
     332    {
     333        for (var i = 0; i < this._filters.length; ++i) {
     334            if (!this._filters[i].accept(record))
     335                return false;
     336        }
     337        return true;
    351338    }
    352339}
Note: See TracChangeset for help on using the changeset viewer.