Commit bb318949 authored by podivilov@chromium.org's avatar podivilov@chromium.org
Browse files

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2116b004
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):
2011-04-08 Andrey Kosyakov <caseq@chromium.org>
 
Reviewed by Yury Semikhatsky.
......@@ -856,6 +856,7 @@ WebInspector.TextEditorMainPanel.prototype = {
this._restorePaintLinesOperationsCredit();
WebInspector.TextEditorChunkedPanel.prototype._expandChunks.call(this, fromIndex, toIndex);
this._adjustPaintLinesOperationsRefreshValue();
this._restoreSelection(selection);
},
......@@ -875,7 +876,7 @@ WebInspector.TextEditorMainPanel.prototype = {
if (!this._scheduledPaintLines) {
this._scheduledPaintLines = [ { startLine: startLine, endLine: endLine } ];
this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 10);
this._paintScheduledLinesTimer = setTimeout(this._paintScheduledLines.bind(this), 0);
} else {
for (var i = 0; i < this._scheduledPaintLines.length; ++i) {
var chunk = this._scheduledPaintLines[i];
......@@ -910,14 +911,31 @@ WebInspector.TextEditorMainPanel.prototype = {
var scheduledPaintLines = this._scheduledPaintLines;
delete this._scheduledPaintLines;
this._restorePaintLinesOperationsCredit();
this._paintLineChunks(scheduledPaintLines, !skipRestoreSelection);
this._adjustPaintLinesOperationsRefreshValue();
},
_restorePaintLinesOperationsCredit: function()
{
this._paintLinesOperationsCredit = 250;
if (!this._paintLinesOperationsRefreshValue)
this._paintLinesOperationsRefreshValue = 250;
this._paintLinesOperationsCredit = this._paintLinesOperationsRefreshValue;
this._paintLinesOperationsLastRefresh = Date.now();
},
_adjustPaintLinesOperationsRefreshValue: function()
{
var operationsDone = this._paintLinesOperationsRefreshValue - this._paintLinesOperationsCredit;
if (operationsDone <= 0)
return;
var timePast = Date.now() - this._paintLinesOperationsLastRefresh;
if (timePast <= 0)
return;
// Make the synchronous CPU chunk for painting the lines 50 msec.
var value = Math.floor(operationsDone / timePast * 50);
this._paintLinesOperationsRefreshValue = Number.constrain(value, 150, 1500);
},
_paintLines: function(fromLine, toLine, restoreSelection)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment