| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import os | 5 import os |
| 6 | 6 |
| 7 from telemetry.core import discover |
| 7 from telemetry.core import util | 8 from telemetry.core import util |
| 8 from telemetry.internal.platform import tracing_agent | 9 from telemetry.internal.platform import tracing_agent |
| 9 from telemetry.internal.platform.tracing_agent import chrome_tracing_agent | 10 from telemetry.internal.platform.tracing_agent import chrome_tracing_agent |
| 10 from telemetry.timeline import trace_data as trace_data_module | 11 from telemetry.timeline import trace_data as trace_data_module |
| 11 from telemetry.timeline import tracing_category_filter | 12 from telemetry.timeline import tracing_category_filter |
| 12 from telemetry.timeline import tracing_options | 13 from telemetry.timeline import tracing_options |
| 13 from telemetry.util import classes_util | |
| 14 | 14 |
| 15 | 15 |
| 16 def _IterAllTracingAgentClasses(): | 16 def _IterAllTracingAgentClasses(): |
| 17 tracing_agent_dir = os.path.join( | 17 tracing_agent_dir = os.path.join( |
| 18 os.path.dirname(os.path.realpath(__file__)), 'tracing_agent') | 18 os.path.dirname(os.path.realpath(__file__)), 'tracing_agent') |
| 19 return classes_util.DiscoverClasses( | 19 return discover.DiscoverClasses( |
| 20 tracing_agent_dir, util.GetTelemetryDir(), tracing_agent.TracingAgent) | 20 tracing_agent_dir, util.GetTelemetryDir(), |
| 21 tracing_agent.TracingAgent).itervalues() |
| 21 | 22 |
| 22 | 23 |
| 23 class TracingControllerBackend(object): | 24 class TracingControllerBackend(object): |
| 24 def __init__(self, platform_backend): | 25 def __init__(self, platform_backend): |
| 25 self._platform_backend = platform_backend | 26 self._platform_backend = platform_backend |
| 26 self._current_trace_options = None | 27 self._current_trace_options = None |
| 27 self._current_category_filter = None | 28 self._current_category_filter = None |
| 28 self._current_chrome_tracing_agent = None | 29 self._current_chrome_tracing_agent = None |
| 29 self._supported_agents_classes = [ | 30 self._supported_agents_classes = [ |
| 30 agent_classes for agent_classes in _IterAllTracingAgentClasses() if | 31 agent_classes for agent_classes in _IterAllTracingAgentClasses() if |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 self._current_category_filter = None | 69 self._current_category_filter = None |
| 69 return trace_data_builder.AsData() | 70 return trace_data_builder.AsData() |
| 70 | 71 |
| 71 def IsChromeTracingSupported(self): | 72 def IsChromeTracingSupported(self): |
| 72 return chrome_tracing_agent.ChromeTracingAgent.IsSupported( | 73 return chrome_tracing_agent.ChromeTracingAgent.IsSupported( |
| 73 self._platform_backend) | 74 self._platform_backend) |
| 74 | 75 |
| 75 @property | 76 @property |
| 76 def is_tracing_running(self): | 77 def is_tracing_running(self): |
| 77 return self._current_trace_options != None | 78 return self._current_trace_options != None |
| OLD | NEW |