Commit 3e27cb6e authored by robliao's avatar robliao Committed by Commit bot

Reland RedirectNonUINonIOBrowserThreads to TaskScheduler by default on trunk

This reverts commit f07732ec
(https://codereview.chromium.org/2791933004)
and reapplies b6d0c9a0
(https://codereview.chromium.org/2690183002/).

BUG=653916, 707986
TBR=jam@chromium.org, rkaplow@chromium.org
Previously reviewed at https://codereview.chromium.org/2690183002/

Review-Url: https://codereview.chromium.org/2856583002
Cr-Commit-Position: refs/heads/master@{#468376}
parent f00f17c2
...@@ -34,9 +34,11 @@ class Predictor; ...@@ -34,9 +34,11 @@ class Predictor;
namespace content { namespace content {
class BrowserGpuChannelHostFactory; class BrowserGpuChannelHostFactory;
class BrowserGpuMemoryBufferManager; class BrowserGpuMemoryBufferManager;
class BrowserMainLoop;
class BrowserShutdownProfileDumper; class BrowserShutdownProfileDumper;
class BrowserSurfaceViewManager; class BrowserSurfaceViewManager;
class BrowserTestBase; class BrowserTestBase;
class CategorizedWorkerPool;
class NestedMessagePumpAndroid; class NestedMessagePumpAndroid;
class ScopedAllowWaitForAndroidLayoutTests; class ScopedAllowWaitForAndroidLayoutTests;
class ScopedAllowWaitForDebugURL; class ScopedAllowWaitForDebugURL;
...@@ -45,7 +47,6 @@ class SynchronousCompositor; ...@@ -45,7 +47,6 @@ class SynchronousCompositor;
class SynchronousCompositorBrowserFilter; class SynchronousCompositorBrowserFilter;
class SynchronousCompositorHost; class SynchronousCompositorHost;
class TextInputClientMac; class TextInputClientMac;
class CategorizedWorkerPool;
} // namespace content } // namespace content
namespace dbus { namespace dbus {
class Bus; class Bus;
...@@ -185,6 +186,7 @@ class BASE_EXPORT ThreadRestrictions { ...@@ -185,6 +186,7 @@ class BASE_EXPORT ThreadRestrictions {
friend class android_webview::AwFormDatabaseService; friend class android_webview::AwFormDatabaseService;
friend class android_webview::CookieManager; friend class android_webview::CookieManager;
friend class base::StackSamplingProfiler; friend class base::StackSamplingProfiler;
friend class content::BrowserMainLoop;
friend class content::BrowserShutdownProfileDumper; friend class content::BrowserShutdownProfileDumper;
friend class content::BrowserSurfaceViewManager; friend class content::BrowserSurfaceViewManager;
friend class content::BrowserTestBase; friend class content::BrowserTestBase;
......
...@@ -1259,19 +1259,20 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1259,19 +1259,20 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
service_manager_context_.reset(); service_manager_context_.reset();
mojo_ipc_support_.reset(); mojo_ipc_support_.reset();
{
base::ThreadRestrictions::ScopedAllowWait allow_wait_for_join;
// Must be size_t so we can subtract from it. // Must be size_t so we can subtract from it.
for (size_t thread_id = BrowserThread::ID_COUNT - 1; for (size_t thread_id = BrowserThread::ID_COUNT - 1;
thread_id >= (BrowserThread::UI + 1); thread_id >= (BrowserThread::UI + 1); --thread_id) {
--thread_id) {
// Find the thread object we want to stop. Looping over all valid // Find the thread object we want to stop. Looping over all valid
// BrowserThread IDs and DCHECKing on a missing case in the switch // BrowserThread IDs and DCHECKing on a missing case in the switch
// statement helps avoid a mismatch between this code and the // statement helps avoid a mismatch between this code and the
// BrowserThread::ID enumeration. // BrowserThread::ID enumeration.
// //
// The destruction order is the reverse order of occurrence in the // The destruction order is the reverse order of occurrence in the
// BrowserThread::ID list. The rationale for the order is as // BrowserThread::ID list. The rationale for the order is as follows (need
// follows (need to be filled in a bit): // to be filled in a bit):
//
// //
// - The IO thread is the only user of the CACHE thread. // - The IO thread is the only user of the CACHE thread.
// //
...@@ -1327,11 +1328,11 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1327,11 +1328,11 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
} }
// Close the blocking I/O pool after the other threads. Other threads such // Close the blocking I/O pool after the other threads. Other threads such
// as the I/O thread may need to schedule work like closing files or flushing // as the I/O thread may need to schedule work like closing files or
// data during shutdown, so the blocking pool needs to be available. There // flushing data during shutdown, so the blocking pool needs to be
// may also be slow operations pending that will blcok shutdown, so closing // available. There may also be slow operations pending that will blcok
// it here (which will block until required operations are complete) gives // shutdown, so closing it here (which will block until required operations
// more head start for those operations to finish. // are complete) gives more head start for those operations to finish.
{ {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
BrowserThreadImpl::ShutdownThreadPool(); BrowserThreadImpl::ShutdownThreadPool();
...@@ -1340,6 +1341,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1340,6 +1341,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler"); TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler");
base::TaskScheduler::GetInstance()->Shutdown(); base::TaskScheduler::GetInstance()->Shutdown();
} }
}
// Must happen after the IO thread is shutdown since this may be accessed from // Must happen after the IO thread is shutdown since this may be accessed from
// it. // it.
......
...@@ -365,6 +365,7 @@ ...@@ -365,6 +365,7 @@
{ {
"name": "Default", "name": "Default",
"params": { "params": {
"RedirectNonUINonIOBrowserThreads": "true",
"RedirectSequencedWorkerPools": "true" "RedirectSequencedWorkerPools": "true"
} }
}, },
......
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