Remove allbins and story hacks, fix -Infinity.

The problem that has stopped the uploads from working is likely that
json.dump writes -Infinity when encountering float('-inf'), but not
all JSON parsers handle that. Notably, the dashboard JSON library
doesn't when running in compressing mode.

I think the real fix is to land the float->double CL for the histogram
proto - I think we will not get float('inf') values then. Apply
this hack in the meantime.

Also remove allbins and story hacks, they're likely worse than the
defaults anyway.

Bug: chromium:1029452
Tbr: mbonadei@webrtc.org
Change-Id: I98e36307cc144bbe6878ba9d93c0a609cab71418
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170626
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30808}
diff --git a/tools_webrtc/perf/catapult_uploader.py b/tools_webrtc/perf/catapult_uploader.py
index 4d5ff88..96d1080 100644
--- a/tools_webrtc/perf/catapult_uploader.py
+++ b/tools_webrtc/perf/catapult_uploader.py
@@ -13,6 +13,7 @@
 import subprocess
 import zlib
 
+from tracing.value import histogram
 from tracing.value import histogram_set
 from tracing.value.diagnostics import generic_set
 from tracing.value.diagnostics import reserved_infos
@@ -58,14 +59,17 @@
 
 
 # TODO(https://crbug.com/1029452): HACKHACK
-# Remove once we set bin bounds correctly in the proto writer.
+# Remove once we have doubles in the proto and handle -infinity correctly.
 def _ApplyHacks(dicts):
   for d in dicts:
-    if 'name' in d:
-      d['allBins'] = [[1]]
-      del d['binBoundaries']
-      d['diagnostics']['stories']['values'][0] = (
-          d['diagnostics']['stories']['values'][0].replace('/', '_'))
+    if 'running' in d:
+      def _NoInf(value):
+        if value == float('inf'):
+          return histogram.JS_MAX_VALUE
+        if value == float('-inf'):
+          return -histogram.JS_MAX_VALUE
+        return value
+      d['running'] = [_NoInf(value) for value in d['running']]
 
   return dicts
 
@@ -101,8 +105,8 @@
 # TODO(https://crbug.com/1029452): Remove this once
 # https://chromium-review.googlesource.com/c/catapult/+/2094312 lands.
 def _HackSummaryOptions(histograms):
-  for histogram in histograms:
-    histogram.CustomizeSummaryOptions({
+  for h in histograms:
+    h.CustomizeSummaryOptions({
       'avg': False,
       'std': False,
       'count': False,