Changeset 83276 in webkit


Ignore:
Timestamp:
Apr 8, 2011 2:55:03 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-04-08 Andrey Adaikin <aandrey@google.com>

Reviewed by Pavel Feldman.

Web Inspector: Tweak dynamically constants for the async highlighting in text editor
https://bugs.webkit.org/show_bug.cgi?id=58035

  • inspector/front-end/TextViewer.js: (WebInspector.TextEditorMainPanel.prototype._expandChunks): (WebInspector.TextEditorMainPanel.prototype._schedulePaintLines): (WebInspector.TextEditorMainPanel.prototype._paintScheduledLines): (WebInspector.TextEditorMainPanel.prototype._restorePaintLinesOperationsCredit): (WebInspector.TextEditorMainPanel.prototype._adjustPaintLinesOperationsRefreshValue):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83275 r83276  
     12011-04-08  Andrey Adaikin  <aandrey@google.com>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Tweak dynamically constants for the async highlighting in text editor
     6        https://bugs.webkit.org/show_bug.cgi?id=58035
     7
     8        * inspector/front-end/TextViewer.js:
     9        (WebInspector.TextEditorMainPanel.prototype._expandChunks):
     10        (WebInspector.TextEditorMainPanel.prototype._schedulePaintLines):
     11        (WebInspector.TextEditorMainPanel.prototype._paintScheduledLines):
     12        (WebInspector.TextEditorMainPanel.prototype._restorePaintLinesOperationsCredit):
     13        (WebInspector.TextEditorMainPanel.prototype._adjustPaintLinesOperationsRefreshValue):
     14
    1152011-04-08  Andrey Kosyakov  <caseq@chromium.org>
    216
  • trunk/Source/WebCore/inspector/front-end/TextViewer.js

    r82824 r83276  
    857857        this._restorePaintLinesOperationsCredit();
    858858        WebInspector.TextEditorChunkedPanel.prototype._expandChunks.call(this, fromIndex, toIndex);
     859        this._adjustPaintLinesOperationsRefreshValue();
    859860
    860861        this._restoreSelection(selection);
     
    876877        if (!this._scheduledPaintLines) {
    877878            this._scheduledPaintLines = [ { startLine: startLine, endLine: endLine } ];
    878             this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 10);
     879            this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 0);
    879880        } else {
    880881            for (var i = 0; i < this._scheduledPaintLines.length; ++i) {
     
    911912        var scheduledPaintLines = this._scheduledPaintLines;
    912913        delete this._scheduledPaintLines;
    913        
     914
    914915        this._restorePaintLinesOperationsCredit();
    915916        this._paintLineChunks(scheduledPaintLines, !skipRestoreSelection);
     917        this._adjustPaintLinesOperationsRefreshValue();
    916918    },
    917919
    918920    _restorePaintLinesOperationsCredit: function()
    919921    {
    920         this._paintLinesOperationsCredit = 250;
     922        if (!this._paintLinesOperationsRefreshValue)
     923            this._paintLinesOperationsRefreshValue = 250;
     924        this._paintLinesOperationsCredit = this._paintLinesOperationsRefreshValue;
     925        this._paintLinesOperationsLastRefresh = Date.now();
     926    },
     927
     928    _adjustPaintLinesOperationsRefreshValue: function()
     929    {
     930        var operationsDone = this._paintLinesOperationsRefreshValue - this._paintLinesOperationsCredit;
     931        if (operationsDone <= 0)
     932            return;
     933        var timePast = Date.now() - this._paintLinesOperationsLastRefresh;
     934        if (timePast <= 0)
     935            return;
     936        // Make the synchronous CPU chunk for painting the lines 50 msec.
     937        var value = Math.floor(operationsDone / timePast * 50);
     938        this._paintLinesOperationsRefreshValue = Number.constrain(value, 150, 1500);
    921939    },
    922940
Note: See TracChangeset for help on using the changeset viewer.