diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-20 15:06:40 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-22 11:48:58 +0000 |
commit | daa093eea7c773db06799a13bd7e4e2e2a9f8f14 (patch) | |
tree | 96cc5e7b9194c1b29eab927730bfa419e7111c25 /chromium/PRESUBMIT.py | |
parent | be59a35641616a4cf23c4a13fa0632624b021c1b (diff) | |
download | qtwebengine-chromium-daa093eea7c773db06799a13bd7e4e2e2a9f8f14.tar.gz |
BASELINE: Update Chromium to 63.0.3239.58
Change-Id: Ia93b322a00ba4dd4004f3bcf1254063ba90e1605
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/PRESUBMIT.py')
-rw-r--r-- | chromium/PRESUBMIT.py | 157 |
1 files changed, 97 insertions, 60 deletions
diff --git a/chromium/PRESUBMIT.py b/chromium/PRESUBMIT.py index fbcbd549d90..9e268bbe371 100644 --- a/chromium/PRESUBMIT.py +++ b/chromium/PRESUBMIT.py @@ -10,13 +10,13 @@ for more details about the presubmit API built into depot_tools. _EXCLUDED_PATHS = ( - r"^breakpad[\\\/].*", r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py", r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py", r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", r"^skia[\\\/].*", r"^third_party[\\\/](WebKit|blink)[\\\/].*", + r"^third_party[\\\/]breakpad[\\\/].*", r"^v8[\\\/].*", r".*MakeFile$", r".+_autogen\.h$", @@ -65,6 +65,25 @@ _INCLUDE_ORDER_WARNING = ( 'cppguide.html#Names_and_Order_of_Includes') +_BANNED_JAVA_FUNCTIONS = ( + ( + 'StrictMode.allowThreadDiskReads()', + ( + 'Prefer using StrictModeContext.allowDiskReads() to using StrictMode ' + 'directly.', + ), + False, + ), + ( + 'StrictMode.allowThreadDiskWrites()', + ( + 'Prefer using StrictModeContext.allowDiskWrites() to using StrictMode ' + 'directly.', + ), + False, + ), +) + _BANNED_OBJC_FUNCTIONS = ( ( 'addTrackingRect:', @@ -147,6 +166,15 @@ _BANNED_OBJC_FUNCTIONS = ( ), True, ), + ( + r'__unsafe_unretained', + ( + 'The use of __unsafe_unretained is almost certainly wrong, unless', + 'when interacting with NSFastEnumeration or NSInvocation.', + 'Please use __weak in files build with ARC, nothing otherwise.', + ), + False, + ), ) @@ -199,52 +227,6 @@ _BANNED_CPP_FUNCTIONS = ( ), ), ( - 'ScopedAllowIO', - ( - 'New production code should not use ScopedAllowIO (using it in', - 'tests is fine). Post a task to a MayBlock task runner instead.', - ), - True, - ( - r"^.*(browser|unit)(|_)test[a-z_]*\.cc$", - r"^base[\\\/]memory[\\\/]shared_memory_posix\.cc$", - r"^base[\\\/]process[\\\/]internal_aix\.cc$", - r"^base[\\\/]process[\\\/]process_linux\.cc$", - r"^base[\\\/]process[\\\/]process_metrics_linux\.cc$", - r"^chrome[\\\/]browser[\\\/]chromeos[\\\/]boot_times_recorder\.cc$", - r"^chrome[\\\/]browser[\\\/]extensions[\\\/]" + - r"chrome_test_extension_loader.cc$", - r"^chrome[\\\/]browser[\\\/]lifetime[\\\/]application_lifetime\.cc$", - r"^components[\\\/]crash[\\\/]app[\\\/]breakpad_mac\.mm$", - r"^content[\\\/]shell[\\\/]browser[\\\/]layout_test[\\\/]" + - r"test_info_extractor\.cc$", - r"^content[\\\/]shell[\\\/]browser[\\\/]shell_browser_main\.cc$", - r"^content[\\\/]shell[\\\/]browser[\\\/]shell_message_filter\.cc$", - r"^content[\\\/]test[\\\/]ppapi[\\\/]ppapi_test\.cc$", - r"^media[\\\/]cast[\\\/]test[\\\/]utility[\\\/]" + - r"standalone_cast_environment\.cc$", - r"^mojo[\\\/]edk[\\\/]embedder[\\\/]" + - r"simple_platform_shared_buffer_posix\.cc$", - r"^net[\\\/]disk_cache[\\\/]cache_util\.cc$", - r"^net[\\\/]cert[\\\/]test_root_certs\.cc$", - r"^net[\\\/]test[\\\/]embedded_test_server[\\\/]" + - r"embedded_test_server\.cc$", - r"^net[\\\/]test[\\\/]spawned_test_server[\\\/]local_test_server\.cc$", - r"^net[\\\/]test[\\\/]spawned_test_server[\\\/]" + - r"remote_test_server_config\.cc$", - r"^net[\\\/]test[\\\/]test_data_directory\.cc$", - r"^net[\\\/]url_request[\\\/]test_url_fetcher_factory\.cc$", - r"^remoting[\\\/]protocol[\\\/]webrtc_transport\.cc$", - r"^ui[\\\/]base[\\\/]material_design[\\\/]" - "material_design_controller\.cc$", - r"^ui[\\\/]gl[\\\/]init[\\\/]gl_initializer_mac\.cc$", - r"^ui[\\\/]gl[\\\/]init[\\\/]gl_initializer_win\.cc$", - r"^ui[\\\/]gl[\\\/]init[\\\/]gl_initializer_x11\.cc$", - r"^ui[\\\/]ozone[\\\/]platform[\\\/]drm[\\\/]host[\\\/]" - "drm_display_host_manager\.cc$", - ), - ), - ( 'setMatrixClip', ( 'Overriding setMatrixClip() is prohibited; ', @@ -334,16 +316,6 @@ _BANNED_CPP_FUNCTIONS = ( (), ), ( - r'/(WebThread|BrowserThread)::GetBlockingPool', - ( - 'Use base/task_scheduler/post_task.h instead of the blocking pool. See', - 'mapping between both APIs in content/public/browser/browser_thread.h.', - 'For questions, contact base/task_scheduler/OWNERS.', - ), - True, - (), - ), - ( r'/(WebThread|BrowserThread)::(FILE|FILE_USER_BLOCKING|DB|CACHE)', ( 'The non-UI/IO BrowserThreads are deprecated, please migrate this', @@ -411,6 +383,17 @@ _BANNED_CPP_FUNCTIONS = ( ), ), ( + 'leveldb::NewMemEnv', + ( + 'Instead of leveldb::NewMemEnv() use leveldb_chrome::NewMemEnv() from', + 'third_party/leveldatabase/leveldb_chrome.h.', + ), + True, + ( + r'^third_party/leveldatabase/.*\.(cc|h)$', + ), + ), + ( 'MessageLoop::QuitWhenIdleClosure', ( 'MessageLoop::QuitWhenIdleClosure is deprecated. Please migrate to', @@ -444,7 +427,16 @@ _BANNED_CPP_FUNCTIONS = ( ), True, (), - ) + ), + ( + (r'/base::ThreadRestrictions::(ScopedAllowIO|AssertIOAllowed|' + r'DisallowWaiting|AssertWaitAllowed|SetWaitAllowed|ScopedAllowWait)'), + ( + 'Use the new API in base/threading/thread_restrictions.h.', + ), + True, + (), + ), ) @@ -765,6 +757,12 @@ def _CheckNoBannedFunctions(input_api, output_api): for message_line in message: problems.append(' %s' % message_line) + file_filter = lambda f: f.LocalPath().endswith(('.java')) + for f in input_api.AffectedFiles(file_filter=file_filter): + for line_num, line in f.ChangedContents(): + for func_name, message, error in _BANNED_JAVA_FUNCTIONS: + CheckForMatch(f, line_num, line, func_name, message, error) + file_filter = lambda f: f.LocalPath().endswith(('.mm', '.m', '.h')) for f in input_api.AffectedFiles(file_filter=file_filter): for line_num, line in f.ChangedContents(): @@ -1161,7 +1159,7 @@ def _CheckAddedDepsHaveTargetApprovals(input_api, output_api): if not input_api.change.issue: return [output_api.PresubmitError( "DEPS approval by OWNERS check failed: this change has " - "no Rietveld issue number, so we can't check it for approvals.")] + "no change number, so we can't check it for approvals.")] output = output_api.PresubmitError else: output = output_api.PresubmitNotifyResult @@ -1911,6 +1909,41 @@ def _CheckAndroidNewMdpiAssetLocation(input_api, output_api): return results +def _CheckAndroidWebkitImports(input_api, output_api): + """Checks that code uses org.chromium.base.Callback instead of + android.widget.ValueCallback except in the WebView glue layer. + """ + valuecallback_import_pattern = input_api.re.compile( + r'^import android\.webkit\.ValueCallback;$') + + errors = [] + + sources = lambda affected_file: input_api.FilterSourceFile( + affected_file, + black_list=(_EXCLUDED_PATHS + + _TEST_CODE_EXCLUDED_PATHS + + input_api.DEFAULT_BLACK_LIST + + (r'^android_webview[\\\/]glue[\\\/].*',)), + white_list=(r'.*\.java$',)) + + for f in input_api.AffectedSourceFiles(sources): + for line_num, line in f.ChangedContents(): + if valuecallback_import_pattern.search(line): + errors.append("%s:%d" % (f.LocalPath(), line_num)) + + results = [] + + if errors: + results.append(output_api.PresubmitError( + 'android.webkit.ValueCallback usage is detected outside of the glue' + ' layer. To stay compatible with the support library, android.webkit.*' + ' classes should only be used inside the glue layer and' + ' org.chromium.base.Callback should be used instead.', + errors)) + + return results + + class PydepsChecker(object): def __init__(self, input_api, pydeps_files): self._file_cache = {} @@ -1962,8 +1995,11 @@ class PydepsChecker(object): import difflib old_pydeps_data = self._LoadFile(pydeps_path).splitlines() cmd = old_pydeps_data[1][1:].strip() + env = { + 'PYTHONDONTWRITEBYTECODE': '1' + } new_pydeps_data = self._input_api.subprocess.check_output( - cmd + ' --output ""', shell=True) + cmd + ' --output ""', shell=True, env=env) old_contents = old_pydeps_data[2:] new_contents = new_pydeps_data.splitlines()[2:] if old_pydeps_data[2:] != new_pydeps_data.splitlines()[2:]: @@ -2361,6 +2397,7 @@ def _AndroidSpecificOnUploadChecks(input_api, output_api): results.extend(_CheckAndroidTestJUnitInheritance(input_api, output_api)) results.extend(_CheckAndroidTestJUnitFrameworkImport(input_api, output_api)) results.extend(_CheckAndroidTestAnnotationUsage(input_api, output_api)) + results.extend(_CheckAndroidWebkitImports(input_api, output_api)) return results |