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

Unified Diff: content/browser/browser_main_runner.cc

Issue 23691025: Adding shutdown tracing capabilities (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 years, 3 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
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/browser_shutdown_profile_dumper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..27fb6fcff58bef1aab827f21284526448f31f2f8 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"
@@ -124,20 +125,32 @@ 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");
+ g_exited_main_message_loop = true;
- ui::ShutdownInputMethod();
-#if defined(OS_WIN)
- ole_initializer_.reset(NULL);
-#endif
+ main_loop_->ShutdownThreadsAndCleanUp();
- main_loop_.reset(NULL);
+ ui::ShutdownInputMethod();
+ #if defined(OS_WIN)
+ ole_initializer_.reset(NULL);
+ #endif
- notification_service_.reset(NULL);
+ main_loop_.reset(NULL);
- is_shutdown_ = true;
+ notification_service_.reset(NULL);
+
+ is_shutdown_ = true;
+ }
}
protected:
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/browser_shutdown_profile_dumper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698