OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/tracing/trace_to_console.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/command_line.h" | |
10 #include "components/tracing/tracing_switches.h" | |
11 | |
12 namespace tracing { | |
13 | |
14 namespace { | |
15 // These categories will cause deadlock when ECHO_TO_CONSOLE. crbug.com/325575. | |
16 const char kEchoToConsoleCategoryFilter[] = "-ipc,-toplevel"; | |
17 } // namespace | |
18 | |
19 base::trace_event::TraceConfig GetConfigForTraceToConsole() { | |
20 const base::CommandLine& command_line = | |
21 *base::CommandLine::ForCurrentProcess(); | |
22 DCHECK(command_line.HasSwitch(switches::kTraceToConsole)); | |
23 std::string filter = command_line.GetSwitchValueASCII( | |
24 switches::kTraceToConsole); | |
25 if (filter.empty()) { | |
26 filter = kEchoToConsoleCategoryFilter; | |
27 } else { | |
28 filter.append(","); | |
29 filter.append(kEchoToConsoleCategoryFilter); | |
30 } | |
31 return base::trace_event::TraceConfig( | |
32 filter, base::trace_event::ECHO_TO_CONSOLE); | |
33 } | |
34 | |
35 } // namespace tracing | |
OLD | NEW |