Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: content/browser/browser_main_loop.cc

Issue 23691025: Adding shutdown tracing capabilities (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index ee84e7cba66c6364bf2564d35b359470f147225f..31442faa126d8221b6ab790eb908e0aec498e668 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -698,6 +698,8 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
// Called early, nothing to do
return;
}
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp")
+
// Teardown may start in PostMainMessageLoopRun, and during teardown we
// need to be able to perform IO.
base::ThreadRestrictions::SetIOAllowed(true);
@@ -706,24 +708,40 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
true));
- if (parts_)
+ if (parts_) {
+ TRACE_EVENT0("shutdown",
+ "BrowserMainLoop::Subsystem:PostMainMessageLoopRun");
parts_->PostMainMessageLoopRun();
+ }
- trace_memory_controller_.reset();
+ {
+ TRACE_EVENT0("shutdown",
James Cook 2013/08/30 22:54:02 You don't need this one - this controller doesn't
Mr4D (OOO till 08-26) 2013/08/31 02:03:44 Since that might change I thought it is better to
+ "BrowserMainLoop::Subsystem:TraceMemoryController");
+ trace_memory_controller_.reset();
+ }
#if !defined(OS_IOS)
// Destroying the GpuProcessHostUIShims on the UI thread posts a task to
// delete related objects on the GPU thread. This must be done before
// stopping the GPU thread. The GPU thread will close IPC channels to renderer
// processes so this has to happen before stopping the IO thread.
- GpuProcessHostUIShim::DestroyAll();
-
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim");
+ GpuProcessHostUIShim::DestroyAll();
+ }
// Cancel pending requests and prevent new requests.
- if (resource_dispatcher_host_)
+ if (resource_dispatcher_host_) {
+ TRACE_EVENT0("shutdown",
+ "BrowserMainLoop::Subsystem:ResourceDispatcherHost");
resource_dispatcher_host_.get()->Shutdown();
+ }
#if defined(USE_AURA)
- ImageTransportFactory::Terminate();
+ {
+ TRACE_EVENT0("shutdown",
+ "BrowserMainLoop::Subsystem:ImageTransportFactory");
+ ImageTransportFactory::Terminate();
+ }
#endif
// The device monitors are using |system_monitor_| as dependency, so delete
@@ -760,29 +778,42 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
//
// - (Not sure why DB stops last.)
switch (thread_id) {
- case BrowserThread::DB:
- db_thread_.reset();
+ case BrowserThread::DB: {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread");
+ db_thread_.reset();
+ }
break;
- case BrowserThread::FILE_USER_BLOCKING:
- file_user_blocking_thread_.reset();
+ case BrowserThread::FILE_USER_BLOCKING: {
+ TRACE_EVENT0("shutdown",
+ "BrowserMainLoop::Subsystem:FileUserBlockingThread");
+ file_user_blocking_thread_.reset();
+ }
break;
- case BrowserThread::FILE:
+ case BrowserThread::FILE: {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread");
#if !defined(OS_IOS)
- // Clean up state that lives on or uses the file_thread_ before
- // it goes away.
- if (resource_dispatcher_host_)
- resource_dispatcher_host_.get()->save_file_manager()->Shutdown();
+ // Clean up state that lives on or uses the file_thread_ before
+ // it goes away.
+ if (resource_dispatcher_host_)
+ resource_dispatcher_host_.get()->save_file_manager()->Shutdown();
#endif // !defined(OS_IOS)
- file_thread_.reset();
+ file_thread_.reset();
+ }
break;
- case BrowserThread::PROCESS_LAUNCHER:
- process_launcher_thread_.reset();
+ case BrowserThread::PROCESS_LAUNCHER: {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread");
+ process_launcher_thread_.reset();
+ }
break;
- case BrowserThread::CACHE:
- cache_thread_.reset();
+ case BrowserThread::CACHE: {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread");
+ cache_thread_.reset();
+ }
break;
- case BrowserThread::IO:
- io_thread_.reset();
+ case BrowserThread::IO: {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread");
+ io_thread_.reset();
+ }
break;
case BrowserThread::UI:
case BrowserThread::ID_COUNT:
@@ -793,7 +824,10 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
}
#if !defined(OS_IOS)
- indexed_db_thread_.reset();
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread");
+ indexed_db_thread_.reset();
+ }
#endif
// Close the blocking I/O pool after the other threads. Other threads such
@@ -802,23 +836,39 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
// may also be slow operations pending that will blcok shutdown, so closing
// it here (which will block until required operations are complete) gives
// more head start for those operations to finish.
- BrowserThreadImpl::ShutdownThreadPool();
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
+ BrowserThreadImpl::ShutdownThreadPool();
+ }
#if !defined(OS_IOS)
// Must happen after the IO thread is shutdown since this may be accessed from
// it.
- BrowserGpuChannelHostFactory::Terminate();
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory");
+ BrowserGpuChannelHostFactory::Terminate();
+ }
// Must happen after the I/O thread is shutdown since this class lives on the
// I/O thread and isn't threadsafe.
- GamepadService::GetInstance()->Terminate();
- DeviceInertialSensorService::GetInstance()->Shutdown();
-
- URLDataManager::DeleteDataSources();
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService");
+ GamepadService::GetInstance()->Terminate();
+ }
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:SensorService");
+ DeviceInertialSensorService::GetInstance()->Shutdown();
+ }
+ {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources");
James Cook 2013/08/30 22:54:02 This seems like a lot of TRACE_EVENT macros in thi
Mr4D (OOO till 08-26) 2013/08/31 02:03:44 I was trying first to move that into the functions
+ URLDataManager::DeleteDataSources();
+ }
#endif // !defined(OS_IOS)
- if (parts_)
+ if (parts_) {
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads");
parts_->PostDestroyThreads();
+ }
}
void BrowserMainLoop::InitializeMainThread() {

Powered by Google App Engine
This is Rietveld 408576698