Title: [120988] trunk/Source/WebCore
Revision
120988
Author
[email protected]
Date
2012-06-21 18:30:19 -0700 (Thu, 21 Jun 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120987 => 120988)


--- trunk/Source/WebCore/ChangeLog	2012-06-22 01:18:31 UTC (rev 120987)
+++ trunk/Source/WebCore/ChangeLog	2012-06-22 01:30:19 UTC (rev 120988)
@@ -1,3 +1,17 @@
+2012-06-21  Andrey Kosyakov  <[email protected]>
+
+        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):
+
 2012-06-21  Oli Lan  <[email protected]>
 
         Add methods to select between offsets in an editable field.

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (120987 => 120988)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-06-22 01:18:31 UTC (rev 120987)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-06-22 01:30:19 UTC (rev 120988)
@@ -496,14 +496,18 @@
         ++this._allRecordsCount;
         var recordTypes = WebInspector.TimelineModel.RecordType;
         var timeStampRecords = this._timeStampRecords;
-        function addTimestampRecords(record)
+        var hasVisibleRecords = false;
+        var presentationModel = this._presentationModel;
+        function processRecord(record)
         {
             if (WebInspector.TimelinePresentationModel.isEventDivider(record))
                 timeStampRecords.push(record);
+            hasVisibleRecords |= presentationModel.isVisible(record);
         }
         var records = [ formattedRecord ];
-        WebInspector.TimelinePresentationModel.forAllRecords(records, addTimestampRecords);
-        return !!this._presentationModel.filterRecords(records).length || formattedRecord.parent !== this._presentationModel.rootRecord;
+        WebInspector.TimelinePresentationModel.forAllRecords(records, processRecord);
+        // Tell caller update is necessary either if we added a visible record or if we re-parented a record.
+        return hasVisibleRecords || formattedRecord.parent !== this._presentationModel.rootRecord;
     },
 
     sidebarResized: function(event)

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (120987 => 120988)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-06-22 01:18:31 UTC (rev 120987)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-06-22 01:30:19 UTC (rev 120988)
@@ -295,31 +295,9 @@
 
     filteredRecords: function()
     {
-        return this.filterRecords(this._rootRecord.children);
-    },
-
-    filterRecords: function(records)
-    {
-        function filter(record)
-        {
-            for (var i = 0; i < this._filters.length; ++i) {
-                if (!this._filters[i].accept(record))
-                    return false;
-            }
-            return true;
-        }
-        return this._innerFilterRecords(filter.bind(this), records);
-    },
-
-    /**
-     * @param {function(WebInspector.TimelinePresentationModel.Record):boolean} filter
-     * @param {Array.<WebInspector.TimelinePresentationModel.Record>} inputRecords
-     */
-    _innerFilterRecords: function(filter, inputRecords)
-    {
         var recordsInWindow = [];
 
-        var stack = [{children: inputRecords, index: 0, parentIsCollapsed: false}];
+        var stack = [{children: this._rootRecord.children, index: 0, parentIsCollapsed: false}];
         while (stack.length) {
             var entry = stack[stack.length - 1];
             var records = entry.children;
@@ -327,7 +305,7 @@
                  var record = records[entry.index];
                  ++entry.index;
 
-                 if (filter(record)) {
+                 if (this.isVisible(record)) {
                      ++record.parent._invisibleChildrenCount;
                      if (!entry.parentIsCollapsed)
                          recordsInWindow.push(record);
@@ -348,6 +326,15 @@
         }
 
         return recordsInWindow;
+    },
+
+    isVisible: function(record)
+    {
+        for (var i = 0; i < this._filters.length; ++i) {
+            if (!this._filters[i].accept(record))
+                return false;
+        }
+        return true;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to