Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1334)

Unified Diff: web/inc/logdog-stream-view/model.ts

Issue 2886873004: Fix LogDog viewer in unstable Chrome. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: web/inc/logdog-stream-view/model.ts
diff --git a/web/inc/logdog-stream-view/model.ts b/web/inc/logdog-stream-view/model.ts
index 609eb1ba55835799f81bb0b32bc5748bb25d1923..c2321c645b59dc7f911b829fef46448e4fb09328 100644
--- a/web/inc/logdog-stream-view/model.ts
+++ b/web/inc/logdog-stream-view/model.ts
@@ -547,16 +547,6 @@ namespace LogDog {
}
let logBlock: LogDog.LogEntry[] = [];
- let appendBlock = () => {
- if (logBlock.length) {
- console.log('Rendering', logBlock.length, 'logs...');
- this.view.pushLogEntries(logBlock, l);
- logBlock.length = 0;
-
- // Update our status and controls.
- this.updateControls();
- }
- };
// Create a promise loop to push logs at intervals.
let lines = 0;
@@ -571,7 +561,7 @@ namespace LogDog {
// If we've exceeded our burst, then interleave a sleep (yield). This
// will reduce user jank a bit.
if (Model.logAppendInterval > 0 && lines >= Model.logAppendInterval) {
- appendBlock();
+ this.appendBlock(logBlock, l);
await luci.sleepPromise(Model.logAppendDelay);
lines = 0;
@@ -579,7 +569,26 @@ namespace LogDog {
}
// If there are any buffered logs, append that block.
- appendBlock();
+ this.appendBlock(logBlock, l);
+ }
+
+ /**
+ * Appends the contents of the "block" array to the viewer, consuming
+ * "block" in the process.
+ *
+ * Block will be reset (but not resized) to zero elements after appending.
+ */
+ private appendBlock(block: LogDog.LogEntry[], l: Location) {
+ if (!block.length) {
+ return;
+ }
+
+ console.log('Rendering', block.length, 'logs...');
+ this.view.pushLogEntries(block, l);
+ block.length = 0;
+
+ // Update our status and controls.
+ this.updateControls();
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698