Commit f1da68b3 authored by Etienne Pierre-Doray's avatar Etienne Pierre-Doray Committed by Commit Bot

[TaskScheduler]: Migrate off of ScopedAllowWait in /base/android/java_handler_thread.cc

base::ThreadRestrictions::ScopedAllowWait is deprecated in favor of its more
explicit counterpart.

It should have been replaced by :
 * base::ScopedAllowBaseSyncPrimitivesForTesting in test files.
 * base::ScopedAllowBaseSyncPrimitives in non-test files
 * base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope when it's used on threads
   that don't allow blocking
The last one is strongly frowned upon but this CL aims to document existing
behavior rather than address it. Owners are encouraged to follow-up by fixing
unnecessary waits and more particularly unnecessary waits
outside-blocking-scope.

Note: The non-for-testing versions require friend'ing in thread_restrictions.h
but care was taken to add these friends ahead of git cl split (since it wasn't
possible to do a line-by-line associated CL split).
Refer to the top-level CL if necessary :
https://chromium-review.googlesource.com/c/chromium/src/+/1288533

Please CQ if LGTY!

This CL was uploaded by git cl split.

R=rmcilroy@chromium.org

Bug: 766678
Change-Id: Ibed489dd8ea6d845199f91081f3e986f3014cf67
Reviewed-on: https://chromium-review.googlesource.com/c/1325196
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608817}
parent 5560ed3a
...@@ -65,7 +65,7 @@ void JavaHandlerThread::Start() { ...@@ -65,7 +65,7 @@ void JavaHandlerThread::Start() {
reinterpret_cast<intptr_t>(&initialize_event)); reinterpret_cast<intptr_t>(&initialize_event));
// Wait for thread to be initialized so it is ready to be used when Start // Wait for thread to be initialized so it is ready to be used when Start
// returns. // returns.
base::ThreadRestrictions::ScopedAllowWait wait_allowed; base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope wait_allowed;
initialize_event.Wait(); initialize_event.Wait();
} }
......
...@@ -342,7 +342,6 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives { ...@@ -342,7 +342,6 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives {
// Allowed usage: // Allowed usage:
friend class ::BrowserProcessImpl; friend class ::BrowserProcessImpl;
friend class SimpleThread; friend class SimpleThread;
friend class android::JavaHandlerThread;
friend class android_webview::AwFormDatabaseService; friend class android_webview::AwFormDatabaseService;
friend class android_webview::CookieManager; friend class android_webview::CookieManager;
friend class base::GetAppOutputScopedAllowBaseSyncPrimitives; friend class base::GetAppOutputScopedAllowBaseSyncPrimitives;
...@@ -394,6 +393,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitivesOutsideBlockingScope { ...@@ -394,6 +393,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitivesOutsideBlockingScope {
// Allowed usage: // Allowed usage:
friend class ::KeyStorageLinux; friend class ::KeyStorageLinux;
friend class android::JavaHandlerThread;
friend class Thread; friend class Thread;
friend class base::MessageLoopImpl; friend class base::MessageLoopImpl;
friend class content::ScopedAllowWaitForDebugURL; friend class content::ScopedAllowWaitForDebugURL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment