Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/browser/browser_main_runner.h" | 5 #include "content/public/browser/browser_main_runner.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_shim.h" | 7 #include "base/allocator/allocator_shim.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 DCHECK(initialization_started_); | 123 DCHECK(initialization_started_); |
| 124 DCHECK(!is_shutdown_); | 124 DCHECK(!is_shutdown_); |
| 125 #ifdef LEAK_SANITIZER | 125 #ifdef LEAK_SANITIZER |
| 126 // Invoke leak detection now, to avoid dealing with shutdown-only leaks. | 126 // Invoke leak detection now, to avoid dealing with shutdown-only leaks. |
| 127 // Normally this will have already happened in | 127 // Normally this will have already happened in |
| 128 // BroserProcessImpl::ReleaseModule(), so this call has no effect. This is | 128 // BroserProcessImpl::ReleaseModule(), so this call has no effect. This is |
| 129 // only for processes which do not instantiate a BrowserProcess. | 129 // only for processes which do not instantiate a BrowserProcess. |
| 130 // If leaks are found, the process will exit here. | 130 // If leaks are found, the process will exit here. |
| 131 __lsan_do_leak_check(); | 131 __lsan_do_leak_check(); |
| 132 #endif | 132 #endif |
| 133 // If startup tracing has not been finished yet, replace it's dumper | |
| 134 // with special version, which would save trace file on exit (i.e. | |
| 135 // startup tracing becomes a version of shutdown tracing). | |
| 136 scoped_ptr<BrowserShutdownProfileDumper> startup_profiler; | |
| 137 if (main_loop_->is_tracing_startup()) { | |
| 138 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.
| |
| 139 new BrowserShutdownProfileDumper(main_loop_->startup_trace_file())); | |
| 140 main_loop_->StopStartupTracingTimer(); | |
| 141 } | |
| 142 | |
| 133 // The shutdown tracing got enabled in AttemptUserExit earlier, but someone | 143 // The shutdown tracing got enabled in AttemptUserExit earlier, but someone |
| 134 // needs to write the result to disc. For that a dumper needs to get created | 144 // needs to write the result to disc. For that a dumper needs to get created |
| 135 // which will dump the traces to disc when it gets destroyed. | 145 // which will dump the traces to disc when it gets destroyed. |
| 136 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 146 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 137 scoped_ptr<BrowserShutdownProfileDumper> profiler; | 147 scoped_ptr<BrowserShutdownProfileDumper> shutdown_profiler; |
| 138 if (command_line.HasSwitch(switches::kTraceShutdown)) | 148 if (command_line.HasSwitch(switches::kTraceShutdown)) { |
| 139 profiler.reset(new BrowserShutdownProfileDumper()); | 149 shutdown_profiler.reset(new BrowserShutdownProfileDumper( |
| 150 BrowserShutdownProfileDumper::GetShutdownProfileFileName())); | |
| 151 } | |
| 140 | 152 |
| 141 { | 153 { |
| 142 // The trace event has to stay between profiler creation and destruction. | 154 // The trace event has to stay between profiler creation and destruction. |
| 143 TRACE_EVENT0("shutdown", "BrowserMainRunner"); | 155 TRACE_EVENT0("shutdown", "BrowserMainRunner"); |
| 144 g_exited_main_message_loop = true; | 156 g_exited_main_message_loop = true; |
| 145 | 157 |
| 146 main_loop_->ShutdownThreadsAndCleanUp(); | 158 main_loop_->ShutdownThreadsAndCleanUp(); |
| 147 | 159 |
| 148 ui::ShutdownInputMethod(); | 160 ui::ShutdownInputMethod(); |
| 149 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 178 | 190 |
| 179 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 191 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
| 180 }; | 192 }; |
| 181 | 193 |
| 182 // static | 194 // static |
| 183 BrowserMainRunner* BrowserMainRunner::Create() { | 195 BrowserMainRunner* BrowserMainRunner::Create() { |
| 184 return new BrowserMainRunnerImpl(); | 196 return new BrowserMainRunnerImpl(); |
| 185 } | 197 } |
| 186 | 198 |
| 187 } // namespace content | 199 } // namespace content |
| OLD | NEW |