| Index: ui/PRESUBMIT.py
|
| diff --git a/ui/PRESUBMIT.py b/ui/PRESUBMIT.py
|
| index d8fe08861bcd6a94b008c6ab851902c0fc1f807a..482299dda2fc92123ffb5e9c3fa2e8240b2efb7f 100644
|
| --- a/ui/PRESUBMIT.py
|
| +++ b/ui/PRESUBMIT.py
|
| @@ -12,7 +12,7 @@ INCLUDE_CPP_FILES_ONLY = (
|
| r'.*\.(cc|h|mm)$',
|
| )
|
|
|
| -def CheckScopedPtr(input_api, output_api,
|
| +def CheckUniquePtr(input_api, output_api,
|
| white_list=INCLUDE_CPP_FILES_ONLY, black_list=None):
|
| black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST)
|
| source_file_filter = lambda x: input_api.FilterSourceFile(x,
|
| @@ -22,29 +22,29 @@ def CheckScopedPtr(input_api, output_api,
|
| for f in input_api.AffectedSourceFiles(source_file_filter):
|
| for line_number, line in f.ChangedContents():
|
| # Disallow:
|
| - # return scoped_ptr<T>(foo);
|
| - # bar = scoped_ptr<T>(foo);
|
| + # return std::unique_ptr<T>(foo);
|
| + # bar = std::unique_ptr<T>(foo);
|
| # But allow:
|
| - # return scoped_ptr<T[]>(foo);
|
| - # bar = scoped_ptr<T[]>(foo);
|
| + # return std::unique_ptr<T[]>(foo);
|
| + # bar = std::unique_ptr<T[]>(foo);
|
| if input_api.re.search(
|
| - r'(=|\breturn)\s*scoped_ptr<[^\[\]>]+>\([^)]+\)', line):
|
| + r'(=|\breturn)\s*std::unique_ptr<[^\[\]>]+>\([^)]+\)', line):
|
| errors.append(output_api.PresubmitError(
|
| - ('%s:%d uses explicit scoped_ptr constructor. ' +
|
| - 'Use make_scoped_ptr() instead.') % (f.LocalPath(), line_number)))
|
| + ('%s:%d uses explicit std::unique_ptr constructor. ' +
|
| + 'Use base::WrapUnique() instead.') % (f.LocalPath(), line_number)))
|
| # TODO(sky): this incorrectly catches templates. Fix and reenable.
|
| # Disallow:
|
| - # scoped_ptr<T>()
|
| - # if input_api.re.search(r'\bscoped_ptr<.*?>\(\)', line):
|
| + # std::unique_ptr<T>()
|
| + # if input_api.re.search(r'\bstd::unique_ptr<.*?>\(\)', line):
|
| # errors.append(output_api.PresubmitError(
|
| - # '%s:%d uses scoped_ptr<T>(). Use nullptr instead.' %
|
| + # '%s:%d uses std::unique_ptr<T>(). Use nullptr instead.' %
|
| # (f.LocalPath(), line_number)))
|
| return errors
|
|
|
|
|
| def CheckChange(input_api, output_api):
|
| results = []
|
| - results += CheckScopedPtr(input_api, output_api)
|
| + results += CheckUniquePtr(input_api, output_api)
|
| return results
|
|
|
|
|
|
|