| OLD | NEW |
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 return [message_type( | 46 return [message_type( |
| 47 'Largest found CSSProperty bucket Id (%d) does not match ' | 47 'Largest found CSSProperty bucket Id (%d) does not match ' |
| 48 'maximumCSSSampleId (%d)' % ( | 48 'maximumCSSSampleId (%d)' % ( |
| 49 largest_found_bucket, expected_max_bucket), | 49 largest_found_bucket, expected_max_bucket), |
| 50 items=[use_counter_cpp_file.LocalPath()])] | 50 items=[use_counter_cpp_file.LocalPath()])] |
| 51 | 51 |
| 52 return [] | 52 return [] |
| 53 | 53 |
| 54 | 54 |
| 55 def _RunUmaHistogramChecks(input_api, output_api): | |
| 56 import sys | |
| 57 | |
| 58 original_sys_path = sys.path | |
| 59 try: | |
| 60 sys.path = sys.path + [input_api.os_path.join( | |
| 61 input_api.PresubmitLocalPath(), '..', '..', '..', '..', '..', | |
| 62 'tools', 'metrics', 'histograms')] | |
| 63 import update_histogram_enum | |
| 64 finally: | |
| 65 sys.path = original_sys_path | |
| 66 | |
| 67 source_path = '' | |
| 68 for f in input_api.AffectedFiles(): | |
| 69 if f.LocalPath().endswith('UseCounter.h'): | |
| 70 source_path = f.LocalPath() | |
| 71 break | |
| 72 else: | |
| 73 return [] | |
| 74 | |
| 75 start_marker = '^enum Feature : uint32_t {' | |
| 76 end_marker = '^kNumberOfFeatures' | |
| 77 presubmit_error = update_histogram_enum.CheckPresubmitErrors( | |
| 78 histogram_enum_name='FeatureObserver', | |
| 79 update_script_name='update_use_counter_feature_enum.py', | |
| 80 source_enum_path=source_path, | |
| 81 start_marker=start_marker, | |
| 82 end_marker=end_marker, | |
| 83 strip_k_prefix=True) | |
| 84 if presubmit_error: | |
| 85 return [output_api.PresubmitPromptWarning(presubmit_error, | |
| 86 items=[source_path])] | |
| 87 return [] | |
| 88 | |
| 89 | |
| 90 def CheckChangeOnUpload(input_api, output_api): | 55 def CheckChangeOnUpload(input_api, output_api): |
| 91 results = [] | 56 results = [] |
| 92 results.extend(_RunUseCounterChecks(input_api, output_api)) | 57 results.extend(_RunUseCounterChecks(input_api, output_api)) |
| 93 results.extend(_RunUmaHistogramChecks(input_api, output_api)) | |
| 94 return results | 58 return results |
| 95 | 59 |
| 96 | 60 |
| 97 def CheckChangeOnCommit(input_api, output_api): | 61 def CheckChangeOnCommit(input_api, output_api): |
| 98 results = [] | 62 results = [] |
| 99 results.extend(_RunUseCounterChecks(input_api, output_api)) | 63 results.extend(_RunUseCounterChecks(input_api, output_api)) |
| 100 results.extend(_RunUmaHistogramChecks(input_api, output_api)) | |
| 101 return results | 64 return results |
| OLD | NEW |