| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Top-level presubmit script for Chromium media component. | 5 """Top-level presubmit script for Chromium media component. |
| 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 depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 # Regular expression that should detect references to the base::Time class | 25 # Regular expression that should detect references to the base::Time class |
| 26 # members, such as a call to base::Time::Now. | 26 # members, such as a call to base::Time::Now. |
| 27 base_time_member_pattern = r'(^|\W)(Time|Clock|DefaultClock)::' | 27 base_time_member_pattern = r'(^|\W)(Time|Clock|DefaultClock)::' |
| 28 | 28 |
| 29 # Regular expression to detect "using base::Time" declarations. We want to | 29 # Regular expression to detect "using base::Time" declarations. We want to |
| 30 # prevent these from triggerring a warning. For example, it's perfectly | 30 # prevent these from triggerring a warning. For example, it's perfectly |
| 31 # reasonable for code to be written like this: | 31 # reasonable for code to be written like this: |
| 32 # | 32 # |
| 33 # using base::Time; | 33 # using base::Time; |
| 34 # ... | 34 # ... |
| 35 # int64 foo_us = foo_s * Time::kMicrosecondsPerSecond; | 35 # int64_t foo_us = foo_s * Time::kMicrosecondsPerSecond; |
| 36 using_base_time_decl_pattern = r'^\s*using\s+(::)?base::Time\s*;' | 36 using_base_time_decl_pattern = r'^\s*using\s+(::)?base::Time\s*;' |
| 37 | 37 |
| 38 # Regular expression to detect references to the kXXX constants in the | 38 # Regular expression to detect references to the kXXX constants in the |
| 39 # base::Time class. We want to prevent these from triggerring a warning. | 39 # base::Time class. We want to prevent these from triggerring a warning. |
| 40 base_time_konstant_pattern = r'(^|\W)Time::k\w+' | 40 base_time_konstant_pattern = r'(^|\W)Time::k\w+' |
| 41 | 41 |
| 42 problem_re = input_api.re.compile( | 42 problem_re = input_api.re.compile( |
| 43 r'(' + base_time_type_pattern + r')|(' + base_time_member_pattern + r')') | 43 r'(' + base_time_type_pattern + r')|(' + base_time_member_pattern + r')') |
| 44 exception_re = input_api.re.compile( | 44 exception_re = input_api.re.compile( |
| 45 r'(' + using_base_time_decl_pattern + r')|(' + | 45 r'(' + using_base_time_decl_pattern + r')|(' + |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) | 167 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) |
| 168 return results | 168 return results |
| 169 | 169 |
| 170 | 170 |
| 171 def CheckChangeOnUpload(input_api, output_api): | 171 def CheckChangeOnUpload(input_api, output_api): |
| 172 return _CheckChange(input_api, output_api) | 172 return _CheckChange(input_api, output_api) |
| 173 | 173 |
| 174 | 174 |
| 175 def CheckChangeOnCommit(input_api, output_api): | 175 def CheckChangeOnCommit(input_api, output_api): |
| 176 return _CheckChange(input_api, output_api) | 176 return _CheckChange(input_api, output_api) |
| OLD | NEW |