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

Unified Diff: content/browser/browser_main_runner.cc

Issue 359473006: Store unsaved trace data on exit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build. Created 6 years, 6 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 c41fc9541c982949b4e338e4dead6a4005c91616..8701c07cb0aa058e286b2052d1c1381c1a7b4731 100644
--- a/content/browser/browser_main_runner.cc
+++ b/content/browser/browser_main_runner.cc
@@ -130,13 +130,28 @@ class BrowserMainRunnerImpl : public BrowserMainRunner {
// If leaks are found, the process will exit here.
__lsan_do_leak_check();
#endif
+ // If startup tracing has not been finished yet, replace it's dumper
+ // with special version, which would save trace file on exit (i.e.
+ // startup tracing becomes a version of shutdown tracing).
+ scoped_ptr<BrowserShutdownProfileDumper> startup_profiler;
+ if (main_loop_->is_tracing_startup()) {
+ main_loop_->StopStartupTracingTimer();
+ if (main_loop_->startup_trace_file() !=
+ base::FilePath().AppendASCII("none")) {
+ startup_profiler.reset(
+ new BrowserShutdownProfileDumper(main_loop_->startup_trace_file()));
+ }
+ }
+
// 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());
+ scoped_ptr<BrowserShutdownProfileDumper> shutdown_profiler;
+ if (command_line.HasSwitch(switches::kTraceShutdown)) {
+ shutdown_profiler.reset(new BrowserShutdownProfileDumper(
+ BrowserShutdownProfileDumper::GetShutdownProfileFileName()));
+ }
{
// The trace event has to stay between profiler creation and destruction.
« 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