Commit 67ac9858 authored by Yoav Weiss's avatar Yoav Weiss Committed by Commit Bot

Fix histogram generation to match presubmit checks

Bug: 1060079
Change-Id: If115a07824df9de2ab5af91e91ca9e91bf8c4f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095590Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748872}
parent 610028a3
...@@ -31,7 +31,9 @@ if __name__ == '__main__': ...@@ -31,7 +31,9 @@ if __name__ == '__main__':
} }
for header_file, histogram_name in histograms.items(): for header_file, histogram_name in histograms.items():
UpdateHistogramEnum(histogram_enum_name=histogram_name, UpdateHistogramEnum(
source_enum_path=header_file, histogram_enum_name=histogram_name,
start_marker='^enum (class )?BadMessageReason {', source_enum_path=header_file,
end_marker='^BAD_MESSAGE_MAX') start_marker='^enum (class )?BadMessageReason {',
end_marker='^BAD_MESSAGE_MAX',
calling_script=os.path.basename(__file__))
...@@ -28,7 +28,9 @@ if __name__ == '__main__': ...@@ -28,7 +28,9 @@ if __name__ == '__main__':
('ExtensionFunctions', ('ExtensionFunctions',
'extensions/browser/extension_function_histogram_value.h')) 'extensions/browser/extension_function_histogram_value.h'))
for enum_name, source_header in histograms: for enum_name, source_header in histograms:
UpdateHistogramEnum(histogram_enum_name=enum_name, UpdateHistogramEnum(
source_enum_path=source_header, histogram_enum_name=enum_name,
start_marker='^enum HistogramValue {', source_enum_path=source_header,
end_marker='^ENUM_BOUNDARY') start_marker='^enum HistogramValue {',
end_marker='^ENUM_BOUNDARY',
calling_script=os.path.basename(__file__))
...@@ -22,7 +22,9 @@ if __name__ == '__main__': ...@@ -22,7 +22,9 @@ if __name__ == '__main__':
sys.exit(1) sys.exit(1)
header_file = 'extensions/common/permissions/api_permission.h' header_file = 'extensions/common/permissions/api_permission.h'
UpdateHistogramEnum(histogram_enum_name='ExtensionPermission3', UpdateHistogramEnum(
source_enum_path=header_file, histogram_enum_name='ExtensionPermission3',
start_marker='^enum ID {', source_enum_path=header_file,
end_marker='^kEnumBoundary') start_marker='^enum ID {',
end_marker='^kEnumBoundary',
calling_script=os.path.basename(__file__))
...@@ -24,8 +24,10 @@ if __name__ == '__main__': ...@@ -24,8 +24,10 @@ if __name__ == '__main__':
source_file = 'third_party/blink/public/mojom/feature_policy/' \ source_file = 'third_party/blink/public/mojom/feature_policy/' \
'feature_policy_feature.mojom' 'feature_policy_feature.mojom'
UpdateHistogramEnum(histogram_enum_name='FeaturePolicyFeature', UpdateHistogramEnum(
source_enum_path=source_file, histogram_enum_name='FeaturePolicyFeature',
start_marker='^enum FeaturePolicyFeature {', source_enum_path=source_file,
end_marker='^};', start_marker='^enum FeaturePolicyFeature {',
strip_k_prefix=True) end_marker='^};',
strip_k_prefix=True,
calling_script=os.path.basename(__file__))
...@@ -309,8 +309,12 @@ def UpdateHistogramFromDict(histogram_enum_name, source_enum_values, ...@@ -309,8 +309,12 @@ def UpdateHistogramFromDict(histogram_enum_name, source_enum_values,
Log('Done.') Log('Done.')
def UpdateHistogramEnum(histogram_enum_name, source_enum_path, def UpdateHistogramEnum(histogram_enum_name,
start_marker, end_marker, strip_k_prefix = False): source_enum_path,
start_marker,
end_marker,
strip_k_prefix=False,
calling_script=None):
"""Reads a C++ enum from a .h file and updates histograms.xml to match. """Reads a C++ enum from a .h file and updates histograms.xml to match.
Args: Args:
...@@ -328,7 +332,7 @@ def UpdateHistogramEnum(histogram_enum_name, source_enum_path, ...@@ -328,7 +332,7 @@ def UpdateHistogramEnum(histogram_enum_name, source_enum_path,
start_marker, end_marker, strip_k_prefix) start_marker, end_marker, strip_k_prefix)
UpdateHistogramFromDict(histogram_enum_name, source_enum_values, UpdateHistogramFromDict(histogram_enum_name, source_enum_values,
source_enum_path, None) source_enum_path, calling_script)
def UpdateHistogramEnumFromXML(histogram_enum_name, source_enum_path, def UpdateHistogramEnumFromXML(histogram_enum_name, source_enum_path,
......
...@@ -28,4 +28,5 @@ if __name__ == '__main__': ...@@ -28,4 +28,5 @@ if __name__ == '__main__':
source_enum_path=source_file, source_enum_path=source_file,
start_marker='^enum class WebSchedulerTrackedFeature {', start_marker='^enum class WebSchedulerTrackedFeature {',
end_marker='^kMaxValue', end_marker='^kMaxValue',
strip_k_prefix=True) strip_k_prefix=True,
calling_script=os.path.basename(__file__))
...@@ -49,4 +49,5 @@ if __name__ == '__main__': ...@@ -49,4 +49,5 @@ if __name__ == '__main__':
source_enum_path=source_path, source_enum_path=source_path,
start_marker=START_MARKER, start_marker=START_MARKER,
end_marker=END_MARKER, end_marker=END_MARKER,
strip_k_prefix=True) strip_k_prefix=True,
calling_script=os.path.basename(__file__))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment