1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 15:32:28 +02:00

code review

This commit is contained in:
gorhill 2015-01-07 11:36:23 -05:00
parent 4a5938d3dd
commit d639c63670
2 changed files with 4 additions and 9 deletions

View File

@ -123,7 +123,7 @@ var renderLogBuffer = function(buffer) {
/******************************************************************************/ /******************************************************************************/
var onBufferRead = function(buffer) { var onBufferRead = function(buffer) {
if ( Array.isArray(buffer ) ) { if ( Array.isArray(buffer) ) {
renderLogBuffer(buffer); renderLogBuffer(buffer);
} }
setTimeout(readLogBuffer, 1000); setTimeout(readLogBuffer, 1000);
@ -142,13 +142,8 @@ var readLogBuffer = function() {
/******************************************************************************/ /******************************************************************************/
var clearBuffer = function() { var clearBuffer = function() {
var rows = tbody.rows; while ( tbody.firstChild !== null ) {
var row; rowJunkyard.push(tbody.removeChild(tbody.firstChild));
var i = rows.length;
while ( i-- ) {
row = rows[i];
row.parentNode.removeChild(row);
rowJunkyard.push(row);
} }
}; };

View File

@ -159,7 +159,7 @@ LogBuffer.prototype.writeOne = function(details, result) {
if ( this.writePtr === this.readPtr ) { if ( this.writePtr === this.readPtr ) {
var toMove = this.buffer.slice(0, this.writePtr); var toMove = this.buffer.slice(0, this.writePtr);
var minSize = Math.ceil(this.size * 1.5); var minSize = Math.ceil(this.size * 1.5);
this.size += this.writePtr; this.size += toMove.length;
if ( this.size < minSize ) { if ( this.size < minSize ) {
this.buffer = this.buffer.concat(toMove, new Array(minSize - this.size)); this.buffer = this.buffer.concat(toMove, new Array(minSize - this.size));
this.writePtr = this.size; this.writePtr = this.size;