Chromium Code Reviews| Index: media/PRESUBMIT.py |
| diff --git a/media/PRESUBMIT.py b/media/PRESUBMIT.py |
| index 993de38a7d0cb23b45d472c30d0284ecbfd82ad1..0949957bff376ce8970513e83cf1c15800bdd37f 100644 |
| --- a/media/PRESUBMIT.py |
| +++ b/media/PRESUBMIT.py |
| @@ -167,11 +167,31 @@ def _CheckPassByValue(input_api, output_api): |
| return [] |
| +def _CheckForUseOfLazyInstance(input_api, output_api): |
| + """Check that base::Time and derived classes are passed by value, and not by |
|
jrummell
2017/02/11 00:10:55
Comment needs updating?
DaleCurtis
2017/02/11 00:13:35
Done.
|
| + const reference """ |
| + |
| + problems = [] |
| + |
| + lazy_instance_re = re.compile(r'(^|\W)base::LazyInstance<') |
| + |
| + for f in input_api.AffectedSourceFiles(_FilterFile): |
| + for line_number, line in f.ChangedContents(): |
| + if lazy_instance_re.search(line): |
| + problems.append('%s:%d' % (f, line_number)) |
| + |
| + if problems: |
| + return [output_api.PresubmitError( |
| + 'base::LazyInstance is deprecated; use a thread safe static.', problems)] |
| + return [] |
| + |
| + |
| def _CheckChange(input_api, output_api): |
| results = [] |
| results.extend(_CheckForUseOfWrongClock(input_api, output_api)) |
| results.extend(_CheckPassByValue(input_api, output_api)) |
| results.extend(_CheckForHistogramOffByOne(input_api, output_api)) |
| + results.extend(_CheckForUseOfLazyInstance(input_api, output_api)) |
| return results |