diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/base/PRESUBMIT.py | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/PRESUBMIT.py')
-rw-r--r-- | chromium/base/PRESUBMIT.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chromium/base/PRESUBMIT.py b/chromium/base/PRESUBMIT.py index 7996eab3b87..1a08a7f188a 100644 --- a/chromium/base/PRESUBMIT.py +++ b/chromium/base/PRESUBMIT.py @@ -32,12 +32,60 @@ def _CheckNoInterfacesInBase(input_api, output_api): return [] +def _CheckNoTraceEventInclude(input_api, output_api): + """Verify that //base includes base_tracing.h instead of trace event headers. + + Checks that files outside trace event implementation include the + base_tracing.h header instead of specific trace event implementation headers + to maintain compatibility with the gn flag "enable_base_tracing = false". + """ + discouraged_includes = [ + r'^#include "base/trace_event/blame_context.h"$', + r'^#include "base/trace_event/memory_allocator_dump_guid.h"$', + r'^#include "base/trace_event/memory_dump_provider.h"$', + r'^#include "base/trace_event/trace_event.h"$', + r'^#include "base/trace_event/traced_value.h"$', + ] + + white_list = [ + r".*\.(h|cc|mm)$", + ] + black_list = [ + r".*[\\/]trace_event[\\/].*", + r".*[\\/]tracing[\\/].*", + ] + + def FilterFile(affected_file): + return input_api.FilterSourceFile( + affected_file, + white_list=white_list, + black_list=black_list) + + locations = [] + for f in input_api.AffectedSourceFiles(FilterFile): + for line_num, line in f.ChangedContents(): + for include in discouraged_includes: + if input_api.re.search(include, line): + locations.append(" %s:%d" % (f.LocalPath(), line_num)) + break + + if locations: + return [ output_api.PresubmitPromptWarning( + 'Consider replacing includes to trace_event implementation headers\n' + + 'in //base with "base/trace_event/base_tracing.h" and/or verify\n' + + 'that base_unittests still passes with gn arg\n' + + 'enable_base_tracing = false.\n' + '\n'.join(locations)) ] + return [] + + def _CommonChecks(input_api, output_api): """Checks common to both upload and commit.""" results = [] results.extend(_CheckNoInterfacesInBase(input_api, output_api)) + results.extend(_CheckNoTraceEventInclude(input_api, output_api)) return results + def CheckChangeOnUpload(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) |