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

Side by Side Diff: content/browser/browser_main_runner.cc

Issue 2530043002: Set process phases in the StackSamplingProfiler. (Closed)
Patch Set: improved comment Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/public/browser/browser_main_parts.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 int Run() override { 138 int Run() override {
139 DCHECK(initialization_started_); 139 DCHECK(initialization_started_);
140 DCHECK(!is_shutdown_); 140 DCHECK(!is_shutdown_);
141 main_loop_->RunMainMessageLoopParts(); 141 main_loop_->RunMainMessageLoopParts();
142 return main_loop_->GetResultCode(); 142 return main_loop_->GetResultCode();
143 } 143 }
144 144
145 void Shutdown() override { 145 void Shutdown() override {
146 DCHECK(initialization_started_); 146 DCHECK(initialization_started_);
147 DCHECK(!is_shutdown_); 147 DCHECK(!is_shutdown_);
148
148 #ifdef LEAK_SANITIZER 149 #ifdef LEAK_SANITIZER
149 // Invoke leak detection now, to avoid dealing with shutdown-only leaks. 150 // Invoke leak detection now, to avoid dealing with shutdown-only leaks.
150 // Normally this will have already happened in 151 // Normally this will have already happened in
151 // BroserProcessImpl::ReleaseModule(), so this call has no effect. This is 152 // BroserProcessImpl::ReleaseModule(), so this call has no effect. This is
152 // only for processes which do not instantiate a BrowserProcess. 153 // only for processes which do not instantiate a BrowserProcess.
153 // If leaks are found, the process will exit here. 154 // If leaks are found, the process will exit here.
154 __lsan_do_leak_check(); 155 __lsan_do_leak_check();
155 #endif 156 #endif
157
158 main_loop_->PreShutdown();
159
156 // If startup tracing has not been finished yet, replace it's dumper 160 // If startup tracing has not been finished yet, replace it's dumper
157 // with special version, which would save trace file on exit (i.e. 161 // with special version, which would save trace file on exit (i.e.
158 // startup tracing becomes a version of shutdown tracing). 162 // startup tracing becomes a version of shutdown tracing).
159 // There are two cases: 163 // There are two cases:
160 // 1. Startup duration is not reached. 164 // 1. Startup duration is not reached.
161 // 2. Or startup duration is not specified for --trace-config-file flag. 165 // 2. Or startup duration is not specified for --trace-config-file flag.
162 std::unique_ptr<BrowserShutdownProfileDumper> startup_profiler; 166 std::unique_ptr<BrowserShutdownProfileDumper> startup_profiler;
163 if (main_loop_->is_tracing_startup_for_duration()) { 167 if (main_loop_->is_tracing_startup_for_duration()) {
164 main_loop_->StopStartupTracingTimer(); 168 main_loop_->StopStartupTracingTimer();
165 if (main_loop_->startup_trace_file() != 169 if (main_loop_->startup_trace_file() !=
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 BrowserMainRunner* BrowserMainRunner::Create() { 240 BrowserMainRunner* BrowserMainRunner::Create() {
237 return new BrowserMainRunnerImpl(); 241 return new BrowserMainRunnerImpl();
238 } 242 }
239 243
240 // static 244 // static
241 bool BrowserMainRunner::ExitedMainMessageLoop() { 245 bool BrowserMainRunner::ExitedMainMessageLoop() {
242 return g_exited_main_message_loop; 246 return g_exited_main_message_loop;
243 } 247 }
244 248
245 } // namespace content 249 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/public/browser/browser_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698