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

[TaskScheduler]: Cleanup ScopedAllowWait.

Delete deprecated ScopedAllowWait and remove related friendship in
ThreadRestrictions.

Bug: 766678
Change-Id: I25c33b87150c6dbfb3325c4591d34919b975e59d
Reviewed-on: https://chromium-review.googlesource.com/c/1417790Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarEtienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625440}
parent 98c7fe34
...@@ -188,13 +188,6 @@ bool ThreadRestrictions::SetWaitAllowed(bool allowed) { ...@@ -188,13 +188,6 @@ bool ThreadRestrictions::SetWaitAllowed(bool allowed) {
return !previous_disallowed; return !previous_disallowed;
} }
ThreadRestrictions::ScopedAllowWait::ScopedAllowWait()
: was_allowed_(SetWaitAllowed(true)) {}
ThreadRestrictions::ScopedAllowWait::~ScopedAllowWait() {
SetWaitAllowed(was_allowed_);
}
} // namespace base } // namespace base
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
...@@ -260,7 +260,6 @@ class ScopedAllowThreadRecallForStackSamplingProfiler; ...@@ -260,7 +260,6 @@ class ScopedAllowThreadRecallForStackSamplingProfiler;
class SimpleThread; class SimpleThread;
class StackSamplingProfiler; class StackSamplingProfiler;
class Thread; class Thread;
class ThreadTestHelper;
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
#define INLINE_IF_DCHECK_IS_OFF BASE_EXPORT #define INLINE_IF_DCHECK_IS_OFF BASE_EXPORT
...@@ -456,8 +455,8 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitivesOutsideBlockingScope { ...@@ -456,8 +455,8 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitivesOutsideBlockingScope {
MultiThreadedProxyResolverScopedAllowJoinOnIO; // http://crbug.com/69710 MultiThreadedProxyResolverScopedAllowJoinOnIO; // http://crbug.com/69710
friend class net::NetworkChangeNotifierMac; // http://crbug.com/125097 friend class net::NetworkChangeNotifierMac; // http://crbug.com/125097
friend class net:: friend class net::
ScopedAllowThreadJoinForProxyResolverV8Tracing; // http://crbug.com/69710 ScopedAllowThreadJoinForProxyResolverV8Tracing; // http://crbug.com/69710
friend class printing::PrinterQuery; // http://crbug.com/66082 friend class printing::PrinterQuery; // http://crbug.com/66082
// Not used in production yet, https://crbug.com/844078. // Not used in production yet, https://crbug.com/844078.
friend class service_manager::ServiceProcessLauncher; friend class service_manager::ServiceProcessLauncher;
friend class ui::WindowResizeHelperMac; // http://crbug.com/902829 friend class ui::WindowResizeHelperMac; // http://crbug.com/902829
...@@ -557,52 +556,24 @@ class BASE_EXPORT ThreadRestrictions { ...@@ -557,52 +556,24 @@ class BASE_EXPORT ThreadRestrictions {
#endif #endif
private: private:
// TODO(etiennep): Remove friendship for ScopedAllowWait.
// DO NOT ADD ANY OTHER FRIEND STATEMENTS. // DO NOT ADD ANY OTHER FRIEND STATEMENTS.
// BEGIN ALLOWED USAGE. // BEGIN ALLOWED USAGE.
friend class android_webview::AwFormDatabaseService;
friend class android_webview::CookieManager;
friend class base::StackSamplingProfiler;
friend class content::BrowserMainLoop; friend class content::BrowserMainLoop;
friend class content::BrowserShutdownProfileDumper; friend class content::BrowserShutdownProfileDumper;
friend class content::BrowserTestBase; friend class content::BrowserTestBase;
friend class content::NestedMessagePumpAndroid;
friend class content::ScopedAllowWaitForDebugURL; friend class content::ScopedAllowWaitForDebugURL;
friend class ::HistogramSynchronizer; friend class ::HistogramSynchronizer;
friend class internal::TaskTracker; friend class internal::TaskTracker;
friend class cc::CompletionEvent;
friend class cc::SingleThreadTaskGraphRunner;
friend class content::CategorizedWorkerPool;
friend class remoting::AutoThread;
friend class ui::WindowResizeHelperMac;
friend class web::WebMainLoop; friend class web::WebMainLoop;
friend class MessagePumpDefault; friend class MessagePumpDefault;
friend class SimpleThread;
friend class Thread;
friend class ThreadTestHelper;
friend class PlatformThread; friend class PlatformThread;
friend class android::JavaHandlerThread;
friend class mojo::SyncCallRestrictions;
friend class ui::CommandBufferClientImpl; friend class ui::CommandBufferClientImpl;
friend class ui::CommandBufferLocal; friend class ui::CommandBufferLocal;
friend class ui::GpuState; friend class ui::GpuState;
// END ALLOWED USAGE. // END ALLOWED USAGE.
// BEGIN USAGE THAT NEEDS TO BE FIXED. // BEGIN USAGE THAT NEEDS TO BE FIXED.
friend class ::chromeos::BlockingMethodCaller; // http://crbug.com/125360
friend class ::chromeos::system::StatisticsProviderImpl; // http://crbug.com/125385
friend class chrome_browser_net::Predictor; // http://crbug.com/78451 friend class chrome_browser_net::Predictor; // http://crbug.com/78451
friend class
content::BrowserGpuChannelHostFactory; // http://crbug.com/125248
friend class content::TextInputClientMac; // http://crbug.com/121917
friend class dbus::Bus; // http://crbug.com/125222
friend class disk_cache::BackendImpl; // http://crbug.com/74623
friend class disk_cache::InFlightIO; // http://crbug.com/74623
friend class gpu::GpuChannelHost; // http://crbug.com/125264
friend class net::internal::AddressTrackerLinux; // http://crbug.com/125097
friend class net::NetworkChangeNotifierMac; // http://crbug.com/125097
friend class ::BrowserProcessImpl; // http://crbug.com/125207
friend class ::NativeBackendKWallet; // http://crbug.com/125331
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
friend class content::SoftwareOutputDeviceMus; // Interim non-production code friend class content::SoftwareOutputDeviceMus; // Interim non-production code
#endif #endif
...@@ -615,24 +586,6 @@ class BASE_EXPORT ThreadRestrictions { ...@@ -615,24 +586,6 @@ class BASE_EXPORT ThreadRestrictions {
static bool SetWaitAllowed(bool allowed) { return true; } static bool SetWaitAllowed(bool allowed) { return true; }
#endif #endif
// Constructing a ScopedAllowWait temporarily allows waiting on the current
// thread. Doing this is almost always incorrect, which is why we limit who
// can use this through friend.
//
// DEPRECATED. Use ScopedAllowBaseSyncPrimitives.
class BASE_EXPORT ScopedAllowWait {
public:
ScopedAllowWait() EMPTY_BODY_IF_DCHECK_IS_OFF;
~ScopedAllowWait() EMPTY_BODY_IF_DCHECK_IS_OFF;
private:
#if DCHECK_IS_ON()
const bool was_allowed_;
#endif
DISALLOW_COPY_AND_ASSIGN(ScopedAllowWait);
};
DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadRestrictions); DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadRestrictions);
}; };
......
...@@ -98,7 +98,6 @@ void NestedMessagePumpAndroid::Run(Delegate* delegate) { ...@@ -98,7 +98,6 @@ void NestedMessagePumpAndroid::Run(Delegate* delegate) {
env, g_message_handler_obj.Get()); env, g_message_handler_obj.Get());
CHECK(ret) << "Error running java message loop, tests will likely fail."; CHECK(ret) << "Error running java message loop, tests will likely fail.";
base::ThreadRestrictions::ScopedAllowWait allow_wait;
if (state_->delayed_work_time.is_null()) { if (state_->delayed_work_time.is_null()) {
state_->waitable_event.TimedWait(max_delay); state_->waitable_event.TimedWait(max_delay);
} else { } else {
......
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