Remove html title handling from Chart, ChartCreators, and HtmlChartVisitor, handle in HtmlCreator

--
MOS_MIGRATED_REVID=103528221
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
index 3a81934..85b28a6 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
@@ -100,7 +100,7 @@
 
   @Override
   public Chart create() {
-    Chart chart = new Chart(info.comment);
+    Chart chart = new Chart();
     CommonChartCreator.createCommonChartItems(chart, info);
     createTypes(chart);
 
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java
index b13fb8f..47119a4 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java
@@ -14,7 +14,6 @@
 
 package com.google.devtools.build.lib.profiler.chart;
 
-import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -29,9 +28,6 @@
   /** The type that is returned when an unknown type is looked up. */
   public static final ChartBarType UNKNOWN_TYPE = new ChartBarType("Unknown type", Color.RED);
 
-  /** The title of the chart. */
-  private final String title;
-
   /** The rows of the chart. */
   private final Map<Long, ChartRow> rows = new HashMap<>();
 
@@ -51,16 +47,6 @@
   private long maxStop;
 
   /**
-   * Creates a chart.
-   *
-   * @param title the title of the chart
-   */
-  public Chart(String title) {
-    Preconditions.checkNotNull(title);
-    this.title = title;
-  }
-
-  /**
    * Adds a bar to a row of the chart. If a row with the given id already
    * exists, the bar is added to the row, otherwise a new row is created and the
    * bar is added to it.
@@ -206,10 +192,6 @@
     return list;
   }
 
-  public String getTitle() {
-    return title;
-  }
-
   public int getRowCount() {
     return rows.size();
   }
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
index 2689b34..ea53104 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
@@ -41,7 +41,7 @@
 
   @Override
   public Chart create() {
-    Chart chart = new Chart(info.comment);
+    Chart chart = new Chart();
     CommonChartCreator.createCommonChartItems(chart, info);
     createTypes(chart);
 
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java
index f9c8993..c288d8a 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java
@@ -73,7 +73,6 @@
   @Override
   public void visit(Chart chart) {
     maxStop = chart.getMaxStop();
-    heading(chart.getTitle(), 1);
 
     printContentBox();
 
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java
index 4059301..899e339 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java
@@ -34,6 +34,7 @@
   private final Chart chart;
   private final HtmlChartVisitor chartVisitor;
   private final Optional<SkylarkStatistics> skylarkStats;
+  private final String title;
 
   /**
    * Pre-formatted statistics for each phase of the profiled build.
@@ -42,11 +43,13 @@
 
   private HtmlCreator(
       PrintStream out,
+      String title,
       Chart chart,
       Optional<SkylarkStatistics> skylarkStats,
       int htmlPixelsPerSecond,
       List<ProfilePhaseStatistics> statistics) {
     this.out = out;
+    this.title = title;
     this.chart = chart;
     chartVisitor = new HtmlChartVisitor(out, htmlPixelsPerSecond);
     this.skylarkStats = skylarkStats;
@@ -68,7 +71,7 @@
 
   private void htmlFrontMatter() {
     out.println("<html><head>");
-    out.printf("<title>%s</title>", chart.getTitle());
+    out.printf("<title>%s</title>", title);
     chartVisitor.printCss(chart.getSortedTypes());
 
     if (skylarkStats.isPresent()) {
@@ -77,6 +80,7 @@
 
     out.println("</head>");
     out.println("<body>");
+    out.printf("<h1>%s</h1>\n", title);
   }
 
   private void htmlBackMatter() {
@@ -130,7 +134,8 @@
         skylarkStats = Optional.absent();
       }
       Chart chart = chartCreator.create();
-      new HtmlCreator(out, chart, skylarkStats, htmlPixelsPerSecond, statistics).print();
+      new HtmlCreator(out, info.comment, chart, skylarkStats, htmlPixelsPerSecond, statistics)
+        .print();
     }
   }
 }