Chromium Code Reviews| Index: content/browser/browser_main_runner.cc |
| diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc |
| index f97318a690657892c4676b1b1d454f9dd75f8a1b..bd44a2dda99c4012ac0204ab270cfbef9efec372 100644 |
| --- a/content/browser/browser_main_runner.cc |
| +++ b/content/browser/browser_main_runner.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/metrics/histogram.h" |
| #include "base/metrics/statistics_recorder.h" |
| #include "content/browser/browser_main_loop.h" |
| +#include "content/browser/browser_shutdown_profile_dumper.h" |
| #include "content/browser/notification_service_impl.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/main_function_params.h" |
| @@ -122,22 +123,34 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { |
| } |
| virtual void Shutdown() OVERRIDE { |
| - DCHECK(initialization_started_); |
| - DCHECK(!is_shutdown_); |
| - g_exited_main_message_loop = true; |
| + // The shutdown tracing got enabled in AttemptUserExit earlier, but someone |
| + // needs to write the result to disc. For that a dumper needs to get created |
| + // which will dump the traces to disc when it gets destroyed. |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + scoped_ptr<BrowserShutdownProfileDumper> profiler; |
| + if (command_line.HasSwitch(switches::kTraceShutdown)) |
| + profiler.reset(new BrowserShutdownProfileDumper()); |
| - main_loop_->ShutdownThreadsAndCleanUp(); |
| + { |
| + // The trace event has to stay between profiler creation and destruction. |
| + TRACE_EVENT0("shutdown", "BrowserMainRunner"); |
| + DCHECK(initialization_started_); |
|
sky
2013/09/05 00:00:14
I would actually keep these three above your chang
Mr4D (OOO till 08-26)
2013/09/05 00:13:40
Done.
|
| + DCHECK(!is_shutdown_); |
| + g_exited_main_message_loop = true; |
| - ui::ShutdownInputMethod(); |
| -#if defined(OS_WIN) |
| - ole_initializer_.reset(NULL); |
| -#endif |
| + main_loop_->ShutdownThreadsAndCleanUp(); |
| + |
| + ui::ShutdownInputMethod(); |
| + #if defined(OS_WIN) |
| + ole_initializer_.reset(NULL); |
| + #endif |
| - main_loop_.reset(NULL); |
| + main_loop_.reset(NULL); |
| - notification_service_.reset(NULL); |
| + notification_service_.reset(NULL); |
| - is_shutdown_ = true; |
| + is_shutdown_ = true; |
| + } |
| } |
| protected: |