Chromium Code Reviews| Index: content/browser/browser_main_loop.cc |
| diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
| index c5c50741838b03d2225f44d1dc340c610702d674..12d829dee7d349634bfcb0e7bfe47369bb86f271 100644 |
| --- a/content/browser/browser_main_loop.cc |
| +++ b/content/browser/browser_main_loop.cc |
| @@ -239,6 +239,45 @@ bool ShouldInitializeBrowserGpuChannelAndTransportSurface() { |
| } |
| #endif |
| +// Disable optimizations for this block of functions so the compiler doesn't |
| +// merge them all together. This makes it possible to tell what thread was |
| +// unresponsive by inspecting the callstack. |
| +MSVC_DISABLE_OPTIMIZE() |
| +MSVC_PUSH_DISABLE_WARNING(4748) |
| + |
| +NOINLINE void ResetThread_DB(scoped_ptr<BrowserProcessSubThread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +NOINLINE void ResetThread_FILE(scoped_ptr<BrowserProcessSubThread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +NOINLINE void ResetThread_FILE_USER_BLOCKING( |
| + scoped_ptr<BrowserProcessSubThread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +NOINLINE void ResetThread_PROCESS_LAUNCHER( |
| + scoped_ptr<BrowserProcessSubThread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +NOINLINE void ResetThread_CACHE(scoped_ptr<BrowserProcessSubThread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +NOINLINE void ResetThread_IO(scoped_ptr<BrowserProcessSubThread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +NOINLINE void ResetThread_IndexedDb(scoped_ptr<base::Thread> thread) { |
| + thread.reset(); |
| +} |
| + |
| +MSVC_POP_WARNING() |
| +MSVC_ENABLE_OPTIMIZE(); |
| + |
| } // namespace |
| // The currently-running BrowserMainLoop. There can be one or zero. |
| @@ -808,13 +847,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| switch (thread_id) { |
| case BrowserThread::DB: { |
| TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread"); |
|
sky
2014/08/15 04:48:01
nit: spacing is off in all these case statements,
rvargas (doing something else)
2014/08/15 18:01:26
Done.
|
| - db_thread_.reset(); |
| - } |
| - break; |
| - case BrowserThread::FILE_USER_BLOCKING: { |
| - TRACE_EVENT0("shutdown", |
| - "BrowserMainLoop::Subsystem:FileUserBlockingThread"); |
| - file_user_blocking_thread_.reset(); |
| + ResetThread_DB(db_thread_.Pass()); |
| } |
| break; |
| case BrowserThread::FILE: { |
| @@ -825,22 +858,28 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| if (resource_dispatcher_host_) |
| resource_dispatcher_host_.get()->save_file_manager()->Shutdown(); |
| #endif // !defined(OS_IOS) |
| - file_thread_.reset(); |
| + ResetThread_FILE(file_thread_.Pass()); |
| + } |
| + break; |
| + case BrowserThread::FILE_USER_BLOCKING: { |
| + TRACE_EVENT0("shutdown", |
| + "BrowserMainLoop::Subsystem:FileUserBlockingThread"); |
| + ResetThread_FILE_USER_BLOCKING(file_user_blocking_thread_.Pass()); |
| } |
| break; |
| case BrowserThread::PROCESS_LAUNCHER: { |
| TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); |
| - process_launcher_thread_.reset(); |
| + ResetThread_PROCESS_LAUNCHER(process_launcher_thread_.Pass()); |
| } |
| break; |
| case BrowserThread::CACHE: { |
| TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread"); |
| - cache_thread_.reset(); |
| + ResetThread_CACHE(cache_thread_.Pass()); |
| } |
| break; |
| case BrowserThread::IO: { |
| TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); |
| - io_thread_.reset(); |
| + ResetThread_IO(io_thread_.Pass()); |
| } |
| break; |
| case BrowserThread::UI: |
| @@ -854,7 +893,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| #if !defined(OS_IOS) |
| { |
| TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); |
| - indexed_db_thread_.reset(); |
| + ResetThread_IndexedDb(indexed_db_thread_.Pass()); |
| } |
| #endif |