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

Side by Side Diff: third_party/WebKit/Source/core/frame/PRESUBMIT.py

Issue 1745913002: Add histograms presubmit check for UseCounter.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-remove dummy UseCounter Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Blink frame presubmit script 5 """Blink frame presubmit script
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 return [message_type( 43 return [message_type(
44 'Largest found CSSProperty bucket Id (%d) does not match ' 44 'Largest found CSSProperty bucket Id (%d) does not match '
45 'maximumCSSSampleId (%d)' % 45 'maximumCSSSampleId (%d)' %
46 (largestFoundBucket, maximumBucket), 46 (largestFoundBucket, maximumBucket),
47 items=[useCounterCpp.LocalPath()])] 47 items=[useCounterCpp.LocalPath()])]
48 48
49 return [] 49 return []
50 50
51 51
52 def _RunUmaHistogramChecks(input_api, output_api):
53 import sys
54
55 original_sys_path = sys.path
56 try:
57 sys.path = sys.path + [input_api.os_path.join(
58 input_api.PresubmitLocalPath(), '..', '..', '..', '..', '..',
59 'tools', 'metrics', 'histograms')]
60 import update_histogram_enum
61 finally:
62 sys.path = original_sys_path
63
64 source_path = ''
65 for f in input_api.AffectedFiles():
66 if f.LocalPath().endswith('UseCounter.h'):
67 source_path = f.LocalPath()
68 break
69 else:
70 return []
71
72 START_MARKER = '^enum Feature {'
73 END_MARKER = '^NumberOfFeatures'
74 if update_histogram_enum.HistogramNeedsUpdate(
75 histogram_enum_name='FeatureObserver',
76 source_enum_path=source_path,
77 start_marker=START_MARKER,
78 end_marker=END_MARKER):
79 return [output_api.PresubmitPromptWarning(
80 'UseCounter::Feature has been updated and the UMA mapping needs to '
81 'be regenerated. Please run update_use_counter_feature_enum.py in '
82 'src/tools/metrics/histograms/ to update the mapping.',
83 items=[source_path])]
84
85 return []
86
87
52 def CheckChangeOnUpload(input_api, output_api): 88 def CheckChangeOnUpload(input_api, output_api):
53 return _RunUseCounterChecks(input_api, output_api) 89 results = []
90 results.extend(_RunUseCounterChecks(input_api, output_api))
91 results.extend(_RunUmaHistogramChecks(input_api, output_api))
92 return results
54 93
55 94
56 def CheckChangeOnCommit(input_api, output_api): 95 def CheckChangeOnCommit(input_api, output_api):
57 return _RunUseCounterChecks(input_api, output_api) 96 results = []
97 results.extend(_RunUseCounterChecks(input_api, output_api))
98 results.extend(_RunUmaHistogramChecks(input_api, output_api))
99 return results
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/update_histogram_enum.py » ('j') | tools/metrics/histograms/update_histogram_enum.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698