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

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: Update after review. 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
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..8ffb806c9a4293d4007ac87e9cb7f6e5185a6556 100644
--- a/content/browser/browser_main_runner.cc
+++ b/content/browser/browser_main_runner.cc
@@ -130,13 +130,25 @@ 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()) {
+ startup_profiler.reset(
jochen (gone - plz use gerrit) 2014/07/02 13:31:34 why if the trace file name is none here?
Alexander Alekseev 2014/07/02 13:36:16 Done.
+ new BrowserShutdownProfileDumper(main_loop_->startup_trace_file()));
+ main_loop_->StopStartupTracingTimer();
+ }
+
// 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.

Powered by Google App Engine
This is Rietveld 408576698