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