Chromium Code Reviews| Index: tools/metrics/histograms/update_histogram_enum.py |
| diff --git a/tools/metrics/histograms/update_histogram_enum.py b/tools/metrics/histograms/update_histogram_enum.py |
| index db9037ff8bdf614e2976894fc59ae075ef72c814..36a0f4bfa6ab046824535fc4626615c1a5c90c5d 100644 |
| --- a/tools/metrics/histograms/update_histogram_enum.py |
| +++ b/tools/metrics/histograms/update_histogram_enum.py |
| @@ -75,13 +75,16 @@ def ReadHistogramValues(filename, start_marker, end_marker): |
| label = m.group(1) |
| else: |
| continue |
| + # If two enum constraints have the same value |
|
Rick Byers
2017/04/05 15:26:39
s/constraints/constants/ ?
|
| + if enum_value in result: |
| + return result, (result[enum_value], label) |
| result[enum_value] = label |
| enum_value += 1 |
| else: |
| if START_REGEX.match(line): |
| inside_enum = True |
| enum_value = 0 |
| - return result |
| + return result, None |
| def CreateEnumItemNode(document, value, label): |
| @@ -180,12 +183,14 @@ def HistogramNeedsUpdate(histogram_enum_name, source_enum_path, start_marker, |
| end_marker: A regular expression that matches the end of the C++ enum. |
| """ |
| Log('Reading histogram enum definition from "{0}".'.format(source_enum_path)) |
| - source_enum_values = ReadHistogramValues(source_enum_path, start_marker, |
| - end_marker) |
| + source_enum_values, duplicated_values = ReadHistogramValues( |
| + source_enum_path, start_marker, end_marker) |
| + if duplicated_values is not None: |
| + return False, duplicated_values |
| (xml, new_xml) = _GetOldAndUpdatedXml(histogram_enum_name, source_enum_values, |
| source_enum_path) |
| - return xml != new_xml |
| + return xml != new_xml, None |
| def UpdateHistogramFromDict(histogram_enum_name, source_enum_values, |