Commit bcc4146d authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[TaskScheduler]: Migrate off of ScopedAllowWait in /android_webview

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=torne@chromium.org

Bug: 766678
Change-Id: I30e57cb0d9a0b1a449a4227561e97ea330ff6a12
Reviewed-on: https://chromium-review.googlesource.com/c/1325195
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607674}
parent 80a30288
......@@ -84,7 +84,7 @@ bool AwFormDatabaseService::HasFormData() {
base::IgnoreResult(&awds::GetCountOfValuesContainedBetween),
autofill_data_, base::Time(), base::Time::Max(), this));
{
base::ThreadRestrictions::ScopedAllowWait wait;
base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait;
has_form_data_completion_.Wait();
}
return has_form_data_result_;
......
......@@ -247,7 +247,7 @@ void CookieManager::ExecCookieTaskSync(
base::WaitableEvent::InitialState::NOT_SIGNALED);
ExecCookieTask(base::BindOnce(
std::move(task), BoolCallbackAdapter(SignalEventClosure(&completion))));
base::ThreadRestrictions::ScopedAllowWait wait;
base::ScopedAllowBaseSyncPrimitives wait;
completion.Wait();
}
......@@ -258,7 +258,7 @@ void CookieManager::ExecCookieTaskSync(
base::WaitableEvent::InitialState::NOT_SIGNALED);
ExecCookieTask(base::BindOnce(
std::move(task), IntCallbackAdapter(SignalEventClosure(&completion))));
base::ThreadRestrictions::ScopedAllowWait wait;
base::ScopedAllowBaseSyncPrimitives wait;
completion.Wait();
}
......@@ -270,7 +270,7 @@ void CookieManager::ExecCookieTaskSync(
base::WaitableEvent::InitialState::NOT_SIGNALED);
ExecCookieTask(
base::BindOnce(std::move(task), SignalEventClosure(&completion)));
base::ThreadRestrictions::ScopedAllowWait wait;
base::ScopedAllowBaseSyncPrimitives wait;
completion.Wait();
}
......
......@@ -343,7 +343,6 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives {
friend class ::BrowserProcessImpl;
friend class SimpleThread;
friend class android::JavaHandlerThread;
friend class android_webview::AwFormDatabaseService;
friend class android_webview::CookieManager;
friend class base::GetAppOutputScopedAllowBaseSyncPrimitives;
friend class base::StackSamplingProfiler;
......@@ -394,19 +393,21 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitivesOutsideBlockingScope {
// Allowed usage:
friend class ::KeyStorageLinux;
friend class Thread;
friend class android_webview::
AwFormDatabaseService; // http://crbug.com/904431
friend class base::MessageLoopImpl;
friend class content::ScopedAllowWaitForDebugURL;
friend class content::SynchronousCompositor;
friend class content::SynchronousCompositorHost;
friend class content::SynchronousCompositorSyncCallBridge;
friend class mojo::SyncCallRestrictions;
friend class Thread;
friend class viz::HostGpuMemoryBufferManager;
// Usage that should be fixed:
friend class ::chromeos::BlockingMethodCaller; // http://crbug.com/125360
friend class cc::CompletionEvent; // http://crbug.com/902653
friend class cc::SingleThreadTaskGraphRunner; // http://crbug.com/902823
friend class cc::CompletionEvent; // http://crbug.com/902653
friend class cc::SingleThreadTaskGraphRunner; // http://crbug.com/902823
friend class content::
BrowserGpuChannelHostFactory; // http://crbug.com/125248
friend class content::CategorizedWorkerPool; // http://crbug.com/902823
......
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