summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_main_runner.cc
diff options
context:
space:
mode:
authoralemate@chromium.org <alemate@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-02 18:01:50 +0000
committeralemate@chromium.org <alemate@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-02 18:01:50 +0000
commitcec95636bbd3585dc60b33c5686213ac463496bb (patch)
tree5bfeae0ee970fe3931730098cdf3b565dbe3e539 /content/browser/browser_main_runner.cc
parent818f73686cbfc0902bd63d22134e4a246474ae4a (diff)
downloadchromium_src-cec95636bbd3585dc60b33c5686213ac463496bb.zip
chromium_src-cec95636bbd3585dc60b33c5686213ac463496bb.tar.gz
chromium_src-cec95636bbd3585dc60b33c5686213ac463496bb.tar.bz2
Store unsaved trace data on exit.
This CL enables chromeos chrome startup trace when chrome in restarted on user log in: startup trace should be saved to disk on process exit if "trace-startup-duration" period has not ended yet. BUG=346913 TEST=manual Review URL: https://codereview.chromium.org/359473006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_main_runner.cc')
-rw-r--r--content/browser/browser_main_runner.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc
index c41fc95..8701c07 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.