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

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

Issue 2825573003: Update update_histogram_enum.py and update_use_counter_feature_enum.py for Blink rename (Closed)
Patch Set: Created 3 years, 8 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 sys.path = original_sys_path 65 sys.path = original_sys_path
66 66
67 source_path = '' 67 source_path = ''
68 for f in input_api.AffectedFiles(): 68 for f in input_api.AffectedFiles():
69 if f.LocalPath().endswith('UseCounter.h'): 69 if f.LocalPath().endswith('UseCounter.h'):
70 source_path = f.LocalPath() 70 source_path = f.LocalPath()
71 break 71 break
72 else: 72 else:
73 return [] 73 return []
74 74
75 START_MARKER = '^enum Feature : uint32_t {' 75 start_marker = '^enum Feature : uint32_t {'
Timothy Loh 2017/04/18 05:26:11 pylint doesn't like it, I prefer to rename rather
76 END_MARKER = '^NumberOfFeatures' 76 end_marker = '^kNumberOfFeatures'
77 should_update_histogram, duplicated_values = update_histogram_enum.Histogram NeedsUpdate( 77 should_update_histogram, duplicated_values = update_histogram_enum.Histogram NeedsUpdate(
78 histogram_enum_name='FeatureObserver', 78 histogram_enum_name='FeatureObserver',
79 source_enum_path=source_path, 79 source_enum_path=source_path,
80 start_marker=START_MARKER, 80 start_marker=start_marker,
81 end_marker=END_MARKER) 81 end_marker=end_marker,
82 strip_k_prefix=True)
82 if duplicated_values: 83 if duplicated_values:
83 return [output_api.PresubmitPromptWarning( 84 return [output_api.PresubmitPromptWarning(
84 'UseCounter::Feature has been updated and there exists duplicated ' 85 'UseCounter::Feature has been updated and there exists duplicated '
85 'values between (%s) and (%s)' % duplicated_values, 86 'values between (%s) and (%s)' % duplicated_values,
86 items=[source_path])] 87 items=[source_path])]
87 if should_update_histogram: 88 if should_update_histogram:
88 return [output_api.PresubmitPromptWarning( 89 return [output_api.PresubmitPromptWarning(
89 'UseCounter::Feature has been updated and the UMA mapping needs to ' 90 'UseCounter::Feature has been updated and the UMA mapping needs to '
90 'be regenerated. Please run update_use_counter_feature_enum.py in ' 91 'be regenerated. Please run update_use_counter_feature_enum.py in '
91 'src/tools/metrics/histograms/ to update the mapping.', 92 'src/tools/metrics/histograms/ to update the mapping.',
92 items=[source_path])] 93 items=[source_path])]
93 94
94 return [] 95 return []
95 96
96 97
97 def CheckChangeOnUpload(input_api, output_api): 98 def CheckChangeOnUpload(input_api, output_api):
98 results = [] 99 results = []
99 results.extend(_RunUseCounterChecks(input_api, output_api)) 100 results.extend(_RunUseCounterChecks(input_api, output_api))
100 results.extend(_RunUmaHistogramChecks(input_api, output_api)) 101 results.extend(_RunUmaHistogramChecks(input_api, output_api))
101 return results 102 return results
102 103
103 104
104 def CheckChangeOnCommit(input_api, output_api): 105 def CheckChangeOnCommit(input_api, output_api):
105 results = [] 106 results = []
106 results.extend(_RunUseCounterChecks(input_api, output_api)) 107 results.extend(_RunUseCounterChecks(input_api, output_api))
107 results.extend(_RunUmaHistogramChecks(input_api, output_api)) 108 results.extend(_RunUmaHistogramChecks(input_api, output_api))
108 return results 109 return results
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698