aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-06-23 11:32:24 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-06-23 13:54:09 +0000
commit39d9452995abf1dabe4023232ca084ba498b0714 (patch)
tree510d090a91bdb45c0fdfc7fd868fb8f68dd2791b /src
parentd825a3dd3ae50e0ae745ae8e87b0518408e16113 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java4
1 files changed, 2 insertions, 2 deletions
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);
}