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 c41fc9541c982949b4e338e4dead6a4005c91616..7b1856d3d2c86f08926746212c64cae3331ffa4d 100644 |
| --- a/content/browser/browser_main_runner.cc |
| +++ b/content/browser/browser_main_runner.cc |
| @@ -130,13 +130,23 @@ 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. |
|
sky
2014/06/26 16:39:27
It's not clear to me why this is done. Update comm
Alexander Alekseev
2014/06/27 20:09:50
Done.
|
| + scoped_ptr<BrowserShutdownProfileDumper> startup_profiler; |
| + if (main_loop_->is_tracing_startup()) { |
| + startup_profiler.reset( |
| + 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(GetShutdownProfileFileName())); |
| + } |
| { |
| // The trace event has to stay between profiler creation and destruction. |
| @@ -164,6 +174,19 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { |
| } |
| protected: |
| + // Returns the file name where we should save the shutdown trace dump to. |
| + static base::FilePath GetShutdownProfileFileName() { |
|
sky
2014/06/26 16:39:27
Move this to a common place so it isn't duplicated
Alexander Alekseev
2014/06/27 20:09:49
It's now a static method of BrowserShutdownProfile
|
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + base::FilePath trace_file = |
| + command_line.GetSwitchValuePath(switches::kTraceShutdownFile); |
| + |
| + if (!trace_file.empty()) |
| + return trace_file; |
| + |
| + // Default to saving the startup trace into the current dir. |
| + return base::FilePath().AppendASCII("chrometrace.log"); |
| + } |
| + |
| // True if we have started to initialize the runner. |
| bool initialization_started_; |