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

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

Issue 1319093002: Revert of [Startup Tracing] Add --trace-config-file flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/browser/gpu/gpu_process_host.cc » ('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/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/metrics/statistics_recorder.h" 12 #include "base/metrics/statistics_recorder.h"
13 #include "base/profiler/scoped_profile.h" 13 #include "base/profiler/scoped_profile.h"
14 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "base/tracked_objects.h" 16 #include "base/tracked_objects.h"
17 #include "components/tracing/trace_config_file.h"
18 #include "components/tracing/tracing_switches.h" 17 #include "components/tracing/tracing_switches.h"
19 #include "content/browser/browser_main_loop.h" 18 #include "content/browser/browser_main_loop.h"
20 #include "content/browser/browser_shutdown_profile_dumper.h" 19 #include "content/browser/browser_shutdown_profile_dumper.h"
21 #include "content/browser/notification_service_impl.h" 20 #include "content/browser/notification_service_impl.h"
22 #include "content/public/browser/tracing_controller.h"
23 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
24 #include "content/public/common/main_function_params.h" 22 #include "content/public/common/main_function_params.h"
25 #include "ui/base/ime/input_method_initializer.h" 23 #include "ui/base/ime/input_method_initializer.h"
26 24
27 #if defined(OS_ANDROID)
28 #include "content/browser/android/tracing_controller_android.h"
29 #endif
30
31 #if defined(OS_WIN) 25 #if defined(OS_WIN)
32 #include "base/win/win_util.h" 26 #include "base/win/win_util.h"
33 #include "base/win/windows_version.h" 27 #include "base/win/windows_version.h"
34 #include "net/cert/sha256_legacy_support_win.h" 28 #include "net/cert/sha256_legacy_support_win.h"
35 #include "sandbox/win/src/sidestep/preamble_patcher.h" 29 #include "sandbox/win/src/sidestep/preamble_patcher.h"
36 #include "ui/base/win/scoped_ole_initializer.h" 30 #include "ui/base/win/scoped_ole_initializer.h"
37 #include "ui/gfx/switches.h" 31 #include "ui/gfx/switches.h"
38 #include "ui/gfx/win/direct_write.h" 32 #include "ui/gfx/win/direct_write.h"
39 #endif 33 #endif
40 34
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // Invoke leak detection now, to avoid dealing with shutdown-only leaks. 222 // Invoke leak detection now, to avoid dealing with shutdown-only leaks.
229 // Normally this will have already happened in 223 // Normally this will have already happened in
230 // BroserProcessImpl::ReleaseModule(), so this call has no effect. This is 224 // BroserProcessImpl::ReleaseModule(), so this call has no effect. This is
231 // only for processes which do not instantiate a BrowserProcess. 225 // only for processes which do not instantiate a BrowserProcess.
232 // If leaks are found, the process will exit here. 226 // If leaks are found, the process will exit here.
233 __lsan_do_leak_check(); 227 __lsan_do_leak_check();
234 #endif 228 #endif
235 // If startup tracing has not been finished yet, replace it's dumper 229 // If startup tracing has not been finished yet, replace it's dumper
236 // with special version, which would save trace file on exit (i.e. 230 // with special version, which would save trace file on exit (i.e.
237 // startup tracing becomes a version of shutdown tracing). 231 // startup tracing becomes a version of shutdown tracing).
238 // There are two cases:
239 // 1. Startup duration is not reached.
240 // 2. Or startup duration is not specified for --trace-config-file flag.
241 scoped_ptr<BrowserShutdownProfileDumper> startup_profiler; 232 scoped_ptr<BrowserShutdownProfileDumper> startup_profiler;
242 if (main_loop_->is_tracing_startup_for_duration()) { 233 if (main_loop_->is_tracing_startup()) {
243 main_loop_->StopStartupTracingTimer(); 234 main_loop_->StopStartupTracingTimer();
244 if (main_loop_->startup_trace_file() != 235 if (main_loop_->startup_trace_file() !=
245 base::FilePath().AppendASCII("none")) { 236 base::FilePath().AppendASCII("none")) {
246 startup_profiler.reset( 237 startup_profiler.reset(
247 new BrowserShutdownProfileDumper(main_loop_->startup_trace_file())); 238 new BrowserShutdownProfileDumper(main_loop_->startup_trace_file()));
248 } 239 }
249 } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled() &&
250 TracingController::GetInstance()->IsRecording()) {
251 base::FilePath result_file;
252 #if defined(OS_ANDROID)
253 TracingControllerAndroid::GenerateTracingFilePath(&result_file);
254 #else
255 result_file = tracing::TraceConfigFile::GetInstance()->GetResultFile();
256 #endif
257 startup_profiler.reset(new BrowserShutdownProfileDumper(result_file));
258 } 240 }
259 241
260 // The shutdown tracing got enabled in AttemptUserExit earlier, but someone 242 // The shutdown tracing got enabled in AttemptUserExit earlier, but someone
261 // needs to write the result to disc. For that a dumper needs to get created 243 // needs to write the result to disc. For that a dumper needs to get created
262 // which will dump the traces to disc when it gets destroyed. 244 // which will dump the traces to disc when it gets destroyed.
263 const base::CommandLine& command_line = 245 const base::CommandLine& command_line =
264 *base::CommandLine::ForCurrentProcess(); 246 *base::CommandLine::ForCurrentProcess();
265 scoped_ptr<BrowserShutdownProfileDumper> shutdown_profiler; 247 scoped_ptr<BrowserShutdownProfileDumper> shutdown_profiler;
266 if (command_line.HasSwitch(switches::kTraceShutdown)) { 248 if (command_line.HasSwitch(switches::kTraceShutdown)) {
267 shutdown_profiler.reset(new BrowserShutdownProfileDumper( 249 shutdown_profiler.reset(new BrowserShutdownProfileDumper(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 291
310 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); 292 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl);
311 }; 293 };
312 294
313 // static 295 // static
314 BrowserMainRunner* BrowserMainRunner::Create() { 296 BrowserMainRunner* BrowserMainRunner::Create() {
315 return new BrowserMainRunnerImpl(); 297 return new BrowserMainRunnerImpl();
316 } 298 }
317 299
318 } // namespace content 300 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698