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

Side by Side Diff: mojo/runner/desktop/launcher_process.cc

Issue 1312833007: Revert of Reland [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 | « mandoline/app/desktop/launcher_process.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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
11 #include "base/base_switches.h" 11 #include "base/base_switches.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "components/tracing/trace_config_file.h" 18 #include "components/tracing/startup_tracing.h"
19 #include "components/tracing/tracing_switches.h" 19 #include "components/tracing/tracing_switches.h"
20 #include "mojo/runner/context.h" 20 #include "mojo/runner/context.h"
21 #include "mojo/runner/switches.h" 21 #include "mojo/runner/switches.h"
22 22
23 namespace mojo { 23 namespace mojo {
24 namespace runner { 24 namespace runner {
25 namespace { 25 namespace {
26 26
27 // Whether we're currently tracing. 27 // Whether we're currently tracing.
28 bool g_tracing = false; 28 bool g_tracing = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 int LauncherProcessMain(int argc, char** argv) { 82 int LauncherProcessMain(int argc, char** argv) {
83 const base::CommandLine& command_line = 83 const base::CommandLine& command_line =
84 *base::CommandLine::ForCurrentProcess(); 84 *base::CommandLine::ForCurrentProcess();
85 if (command_line.HasSwitch(switches::kTraceStartup)) { 85 if (command_line.HasSwitch(switches::kTraceStartup)) {
86 g_tracing = true; 86 g_tracing = true;
87 base::trace_event::TraceConfig trace_config( 87 base::trace_event::TraceConfig trace_config(
88 command_line.GetSwitchValueASCII(switches::kTraceStartup), 88 command_line.GetSwitchValueASCII(switches::kTraceStartup),
89 base::trace_event::RECORD_UNTIL_FULL); 89 base::trace_event::RECORD_UNTIL_FULL);
90 base::trace_event::TraceLog::GetInstance()->SetEnabled( 90 base::trace_event::TraceLog::GetInstance()->SetEnabled(
91 trace_config, base::trace_event::TraceLog::RECORDING_MODE); 91 trace_config, base::trace_event::TraceLog::RECORDING_MODE);
92 } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) { 92 } else {
93 g_tracing = true; 93 // |g_tracing| is not touched in this case and Telemetry will stop tracing
94 base::trace_event::TraceLog::GetInstance()->SetEnabled( 94 // on demand later.
95 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(), 95 tracing::EnableStartupTracingIfConfigFileExists();
96 base::trace_event::TraceLog::RECORDING_MODE);
97 } 96 }
98 97
99 // We want the shell::Context to outlive the MessageLoop so that pipes are 98 // We want the shell::Context to outlive the MessageLoop so that pipes are
100 // all gracefully closed / error-out before we try to shut the Context down. 99 // all gracefully closed / error-out before we try to shut the Context down.
101 Context shell_context; 100 Context shell_context;
102 { 101 {
103 base::MessageLoop message_loop; 102 base::MessageLoop message_loop;
104 if (!shell_context.Init()) { 103 if (!shell_context.Init()) {
105 return 0; 104 return 0;
106 } 105 }
(...skipping 13 matching lines...) Expand all
120 shell_context.Shutdown(); 119 shell_context.Shutdown();
121 } 120 }
122 121
123 if (g_tracing) 122 if (g_tracing)
124 StopTracingAndFlushToDisk(); 123 StopTracingAndFlushToDisk();
125 return 0; 124 return 0;
126 } 125 }
127 126
128 } // namespace runner 127 } // namespace runner
129 } // namespace mojo 128 } // namespace mojo
OLDNEW
« no previous file with comments | « mandoline/app/desktop/launcher_process.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698