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

Side by Side Diff: mandoline/app/desktop/launcher_process.cc

Issue 1177853003: [Startup Tracing] Enable startup tracing from config file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fix Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <iostream> 9 #include <iostream>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int LauncherProcessMain(int argc, char** argv) { 81 int LauncherProcessMain(int argc, char** argv) {
82 const base::CommandLine& command_line = 82 const base::CommandLine& command_line =
83 *base::CommandLine::ForCurrentProcess(); 83 *base::CommandLine::ForCurrentProcess();
84 if (command_line.HasSwitch(switches::kTraceStartup)) { 84 if (command_line.HasSwitch(switches::kTraceStartup)) {
85 g_tracing = true; 85 g_tracing = true;
86 base::trace_event::TraceConfig trace_config( 86 base::trace_event::TraceConfig trace_config(
87 command_line.GetSwitchValueASCII(switches::kTraceStartup), 87 command_line.GetSwitchValueASCII(switches::kTraceStartup),
88 base::trace_event::RECORD_UNTIL_FULL); 88 base::trace_event::RECORD_UNTIL_FULL);
89 base::trace_event::TraceLog::GetInstance()->SetEnabled( 89 base::trace_event::TraceLog::GetInstance()->SetEnabled(
90 trace_config, base::trace_event::TraceLog::RECORDING_MODE); 90 trace_config, base::trace_event::TraceLog::RECORDING_MODE);
91 } else {
92 base::trace_event::EnableStartupTracingIfConfigFileExists();
91 } 93 }
92 94
93 // We want the runner::Context to outlive the MessageLoop so that pipes are 95 // We want the runner::Context to outlive the MessageLoop so that pipes are
94 // all gracefully closed / error-out before we try to shut the Context down. 96 // all gracefully closed / error-out before we try to shut the Context down.
95 mojo::runner::Context shell_context; 97 mojo::runner::Context shell_context;
96 InitCoreServicesForContext(&shell_context); 98 InitCoreServicesForContext(&shell_context);
97 { 99 {
98 base::MessageLoop message_loop; 100 base::MessageLoop message_loop;
99 if (!shell_context.Init()) { 101 if (!shell_context.Init()) {
100 return 0; 102 return 0;
(...skipping 13 matching lines...) Expand all
114 // Must be called before |message_loop| is destroyed. 116 // Must be called before |message_loop| is destroyed.
115 shell_context.Shutdown(); 117 shell_context.Shutdown();
116 } 118 }
117 119
118 if (g_tracing) 120 if (g_tracing)
119 StopTracingAndFlushToDisk(); 121 StopTracingAndFlushToDisk();
120 return 0; 122 return 0;
121 } 123 }
122 124
123 } // namespace mandoline 125 } // namespace mandoline
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698