From 39d9452995abf1dabe4023232ca084ba498b0714 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 23 Jun 2016 11:32:24 +0000 Subject: experimental UI: consider progress bar refreshed on every redraw Whenever the UI has to write a line to the progress buffer, it removes the progress bar, write the line and re-adds the progress bar. Of course, the re-added progress bar is the one that represents the up-to-date state at the time of it being re-added. Therefore, this also is a refresh of the progress bar. So update the time stamp tracking the last refresh. In this way rate-limits on refreshes are honored more correctly; also, requirements of the progress bar having to be refreshed after a certain point in time that have been fulfilled by that implicit refresh are recognized as such, keeping the output less flickering. -- Change-Id: I44bcd85a149cb88fcde126119100a6e1ff1ba45d Reviewed-on: https://bazel-review.googlesource.com/#/c/3873 MOS_MIGRATED_REVID=125664608 --- .../google/devtools/build/lib/runtime/ExperimentalEventHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java index 5fab644b36..cbe3755de7 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java @@ -365,7 +365,6 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { try { if (showProgress && (progressBarNeedsRefresh || timeBasedRefresh())) { progressBarNeedsRefresh = false; - lastRefreshMillis = nowMillis; clearProgressBar(); addProgressBar(); terminal.flush(); @@ -498,10 +497,11 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { terminal.writeString("\n"); } - private void addProgressBar() throws IOException { + private synchronized void addProgressBar() throws IOException { LineCountingAnsiTerminalWriter countingTerminalWriter = new LineCountingAnsiTerminalWriter(terminal); AnsiTerminalWriter terminalWriter = countingTerminalWriter; + lastRefreshMillis = clock.currentTimeMillis(); if (cursorControl) { terminalWriter = new LineWrappingAnsiTerminalWriter(terminalWriter, terminalWidth - 1); } -- cgit v1.2.3