Changeset 56772 in webkit


Ignore:
Timestamp:
Mar 30, 2010 1:59:20 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-03-30 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Visible/captured records counter should be implemented in Timeline panel.
https://bugs.webkit.org/show_bug.cgi?id=36708

  • English.lproj/localizedStrings.js:
  • inspector/front-end/TimelinePanel.js: (WebInspector.TimelinePanel.prototype.get statusBarItems): (WebInspector.TimelinePanel.prototype._createStatusbarButtons): (WebInspector.TimelinePanel.prototype._updateRecordsCounter): (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): (WebInspector.TimelinePanel.prototype._createRootRecord): (WebInspector.TimelinePanel.prototype._refresh): (WebInspector.TimelinePanel.prototype._filterRecords):
  • inspector/front-end/inspector.css: (.timeline-records-counter):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56770 r56772  
     12010-03-30  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Visible/captured records counter should be implemented in Timeline panel.
     6        https://bugs.webkit.org/show_bug.cgi?id=36708
     7
     8        * English.lproj/localizedStrings.js:
     9        * inspector/front-end/TimelinePanel.js:
     10        (WebInspector.TimelinePanel.prototype.get statusBarItems):
     11        (WebInspector.TimelinePanel.prototype._createStatusbarButtons):
     12        (WebInspector.TimelinePanel.prototype._updateRecordsCounter):
     13        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):
     14        (WebInspector.TimelinePanel.prototype._createRootRecord):
     15        (WebInspector.TimelinePanel.prototype._refresh):
     16        (WebInspector.TimelinePanel.prototype._filterRecords):
     17        * inspector/front-end/inspector.css:
     18        (.timeline-records-counter):
     19
    1202010-03-30  Philippe Normand  <pnormand@igalia.com>
    221
  • trunk/WebCore/inspector/front-end/TimelinePanel.js

    r56613 r56772  
    105105    get statusBarItems()
    106106    {
    107         return [this.toggleFilterButton.element, this.toggleTimelineButton.element, this.clearButton.element];
     107        return [this.toggleFilterButton.element, this.toggleTimelineButton.element, this.clearButton.element, this.recordsCounter];
    108108    },
    109109
     
    162162        this.toggleFilterButton = new WebInspector.StatusBarButton(WebInspector.UIString("Show short records"), "timeline-filter-status-bar-item");
    163163        this.toggleFilterButton.addEventListener("click", this._toggleFilterButtonClicked.bind(this), false);
     164
     165        this.recordsCounter = document.createElement("span");
     166        this.recordsCounter.className = "timeline-records-counter";
     167    },
     168
     169    _updateRecordsCounter: function()
     170    {
     171        this.recordsCounter.textContent = WebInspector.UIString("%d of %d captured records are visible", this._rootRecord._visibleRecordsCount, this._rootRecord._allRecordsCount);
    164172    },
    165173
     
    231239
    232240        var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this._recordStyles, this._sendRequestRecords, this._timerRecords);
     241        ++this._rootRecord._allRecordsCount;
     242
    233243        if (parentRecord === this._rootRecord)
    234244            formattedRecord.collapsed = true;
     
    243253            while (record.parent && record.parent._lastChildEndTime < record._lastChildEndTime) {
    244254                record.parent._lastChildEndTime = record._lastChildEndTime;
     255                if (!record.parent._hasLongChildrenEvents)
     256                    record.parent._hasLongChildrenEvents = record._isLongEvent();
    245257                record = record.parent;
    246             }
    247             // We have attached a fresh event record received from Timeline Agent to some old event record.
    248             // If that old parent record haven't had long children events and new child record has it
    249             // then we want to propagate _hasLongChildrenEvents flag to parent, grand-parent etc.
    250             if (record._isLongEvent()) {
    251                 record = formattedRecord;
    252                 while (record.parent && !record.parent._isLongEvent()) {
    253                     record = record.parent;
    254                     record._hasLongChildrenEvents = true;
    255                 }
    256258            }
    257259        }
     
    283285        var rootRecord = {};
    284286        rootRecord.children = [];
     287        rootRecord._visibleRecordsCount = 0;
     288        rootRecord._allRecordsCount = 0;
    285289        return rootRecord;
    286290    },
     
    330334    _scheduleRefresh: function(preserveBoundaries)
    331335    {
    332         if (preserveBoundaries)
    333             this._closeRecordDetails();
     336        this._closeRecordDetails();
    334337        this._boundariesAreValid &= preserveBoundaries;
    335338        if (this._needsRefresh)
     
    356359            this._overviewPane.update(this._rootRecord.children);
    357360        this._refreshRecords(!this._boundariesAreValid);
     361        this._updateRecordsCounter();
    358362        this._boundariesAreValid = true;
    359363    },
     
    361365    _updateBoundaries: function()
    362366    {
    363             this._calculator.reset();
    364             this._calculator.windowLeft = this._overviewPane.windowLeft;
    365             this._calculator.windowRight = this._overviewPane.windowRight;
    366 
    367             for (var i = 0; i < this._rootRecord.children.length; ++i)
    368                 this._calculator.updateBoundaries(this._rootRecord.children[i]);
    369 
    370             this._calculator.calculateWindow();
    371     },
    372 
    373     _addToRecordsWindow: function(record, recordsWindow)
     367        this._calculator.reset();
     368        this._calculator.windowLeft = this._overviewPane.windowLeft;
     369        this._calculator.windowRight = this._overviewPane.windowRight;
     370
     371        for (var i = 0; i < this._rootRecord.children.length; ++i)
     372            this._calculator.updateBoundaries(this._rootRecord.children[i]);
     373
     374        this._calculator.calculateWindow();
     375    },
     376
     377    _addToRecordsWindow: function(record, recordsWindow, parentIsCollapsed)
    374378    {
    375379        if (!this._calculator._showShortEvents && !record._isLongEvent())
    376380            return;
    377 
    378         recordsWindow.push(record);
     381        var percentages = this._calculator.computeBarGraphPercentages(record);
     382        if (percentages.start < 100 && percentages.endWithChildren >= 0 && !record.category.hidden) {
     383            ++this._rootRecord._visibleRecordsCount;
     384            ++record.parent._invisibleChildrenCount;
     385            if (!parentIsCollapsed)
     386                recordsWindow.push(record);
     387        }
     388
    379389        var index = recordsWindow.length;
    380         if (!record.collapsed) {
    381             for (var i = 0; i < record.children.length; ++i)
    382                 this._addToRecordsWindow(record.children[i], recordsWindow);
    383         }
    384         record.visibleChildrenCount = recordsWindow.length - index;
     390        record._invisibleChildrenCount = 0;
     391        for (var i = 0; i < record.children.length; ++i)
     392            this._addToRecordsWindow(record.children[i], recordsWindow, parentIsCollapsed || record.collapsed);
     393        record._visibleChildrenCount = recordsWindow.length - index;
    385394    },
    386395
     
    388397    {
    389398        var recordsInWindow = [];
    390         for (var i = 0; i < this._rootRecord.children.length; ++i) {
    391             var record = this._rootRecord.children[i];
    392             var percentages = this._calculator.computeBarGraphPercentages(record);
    393             if (percentages.start < 100 && percentages.endWithChildren >= 0 && !record.category.hidden)
    394                 this._addToRecordsWindow(record, recordsInWindow);
    395         }
     399        this._rootRecord._visibleRecordsCount = 0;
     400        for (var i = 0; i < this._rootRecord.children.length; ++i)
     401            this._addToRecordsWindow(this._rootRecord.children[i], recordsInWindow);
    396402        return recordsInWindow;
    397403    },
     
    557563            this._absoluteMinimumBoundary = lowerBound;
    558564
    559         var upperBound = record._lastChildEndTime;
     565        const minimumTimeFrame = 0.1;
     566        const minimumDeltaForZeroSizeEvents = 0.01;
     567        var upperBound = Math.max(record._lastChildEndTime + minimumDeltaForZeroSizeEvents, lowerBound + minimumTimeFrame);
    560568        if (this._absoluteMaximumBoundary === -1 || upperBound > this._absoluteMaximumBoundary)
    561569            this._absoluteMaximumBoundary = upperBound;
     
    668676        this._barElement.style.width =  barPosition.width + "px";
    669677
    670         if (record.visibleChildrenCount || record._hasLongChildrenEvents || (calculator._showShortEvents && record.children.length)) {
     678        if (record._visibleChildrenCount || record._invisibleChildrenCount) {
    671679            this._expandElement.style.top = index * this._rowHeight + "px";
    672680            this._expandElement.style.left = barPosition.left + "px";
    673681            this._expandElement.style.width = Math.max(12, barPosition.width + 25) + "px";
    674682            if (!record.collapsed) {
    675                 this._expandElement.style.height = (record.visibleChildrenCount + 1) * this._rowHeight + "px";
     683                this._expandElement.style.height = (record._visibleChildrenCount + 1) * this._rowHeight + "px";
    676684                this._expandElement.addStyleClass("timeline-expandable-expanded");
    677685                this._expandElement.removeStyleClass("timeline-expandable-collapsed");
  • trunk/WebCore/inspector/front-end/inspector.css

    r56711 r56772  
    36583658}
    36593659
     3660.timeline-records-counter {
     3661    font-size: 11px;
     3662    position: relative;
     3663    top: 5px;
     3664    margin-left: 5px;
     3665    text-shadow: white 0 1px 0;
     3666}
     3667
    36603668/* Profiler Style */
    36613669
Note: See TracChangeset for help on using the changeset viewer.