Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tools/metrics/histograms/update_histogram_enum.py

Issue 1745913002: Add histograms presubmit check for UseCounter.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaked warning message, removed dummy UseCounter Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ba975996719ce541a07445cf4a3a4c4cefb4cd23..ea4e9ddc6514c8d0074beacec5a2f66e75ac126a 100644
--- a/tools/metrics/histograms/update_histogram_enum.py
+++ b/tools/metrics/histograms/update_histogram_enum.py
@@ -142,6 +142,29 @@ def UpdateHistogramDefinitions(histogram_enum_name, source_enum_values,
enum_node.appendChild(new_item_nodes[value])
+def HistogramNeedsUpdate(histogram_enum_name, source_enum_path, start_marker,
+ end_marker):
+ Log('Reading histogram enum definition from "{0}".'.format(source_enum_path))
+ source_enum_values = ReadHistogramValues(source_enum_path, start_marker,
+ end_marker)
+
+ HISTOGRAMS_PATH = path_util.GetHistogramsFile()
+
+ Log('Reading existing histograms from "{0}".'.format(HISTOGRAMS_PATH))
+ with open(HISTOGRAMS_PATH, 'rb') as f:
+ histograms_doc = minidom.parse(f)
+ f.seek(0)
+ xml = f.read()
+
+ Log('Comparing histograms enum with new enum definition.')
+ UpdateHistogramDefinitions(histogram_enum_name, source_enum_values,
+ source_enum_path, histograms_doc)
+
+ new_xml = print_style.GetPrintStyle().PrettyPrintNode(histograms_doc)
Ilya Sherman 2016/03/02 00:59:29 It looks like you copy/pasted lines 151-163 here.
suzyh_UTC10 (ex-contributor) 2016/03/02 03:23:49 Done. It's a bit messy, but I haven't been able to
Ilya Sherman 2016/03/02 23:18:46 Thanks! This is the structure that I was thinking
+
+ return xml != new_xml
+
+
def UpdateHistogramFromDict(histogram_enum_name, source_enum_values,
source_enum_path):
"""Updates |histogram_enum_name| enum in histograms.xml file with values
« no previous file with comments | « third_party/WebKit/Source/core/frame/PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698