| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 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 | 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 "components/tracing/trace_to_console.h" | 5 #include "components/tracing/common/trace_to_console.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "components/tracing/tracing_switches.h" | 10 #include "components/tracing/common/tracing_switches.h" |
| 11 | 11 |
| 12 namespace tracing { | 12 namespace tracing { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 // These categories will cause deadlock when ECHO_TO_CONSOLE. crbug.com/325575. | 15 // These categories will cause deadlock when ECHO_TO_CONSOLE. crbug.com/325575. |
| 16 const char kEchoToConsoleCategoryFilter[] = "-ipc,-toplevel"; | 16 const char kEchoToConsoleCategoryFilter[] = "-ipc,-toplevel"; |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 base::trace_event::TraceConfig GetConfigForTraceToConsole() { | 19 base::trace_event::TraceConfig GetConfigForTraceToConsole() { |
| 20 const base::CommandLine& command_line = | 20 const base::CommandLine& command_line = |
| 21 *base::CommandLine::ForCurrentProcess(); | 21 *base::CommandLine::ForCurrentProcess(); |
| 22 DCHECK(command_line.HasSwitch(switches::kTraceToConsole)); | 22 DCHECK(command_line.HasSwitch(switches::kTraceToConsole)); |
| 23 std::string filter = command_line.GetSwitchValueASCII( | 23 std::string filter = command_line.GetSwitchValueASCII( |
| 24 switches::kTraceToConsole); | 24 switches::kTraceToConsole); |
| 25 if (filter.empty()) { | 25 if (filter.empty()) { |
| 26 filter = kEchoToConsoleCategoryFilter; | 26 filter = kEchoToConsoleCategoryFilter; |
| 27 } else { | 27 } else { |
| 28 filter.append(","); | 28 filter.append(","); |
| 29 filter.append(kEchoToConsoleCategoryFilter); | 29 filter.append(kEchoToConsoleCategoryFilter); |
| 30 } | 30 } |
| 31 return base::trace_event::TraceConfig( | 31 return base::trace_event::TraceConfig( |
| 32 filter, base::trace_event::ECHO_TO_CONSOLE); | 32 filter, base::trace_event::ECHO_TO_CONSOLE); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace tracing | 35 } // namespace tracing |
| OLD | NEW |