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 logging | 5 import logging |
6 import os | 6 import os |
7 | 7 |
8 from telemetry.core import util | 8 from telemetry.core import util |
9 from telemetry.core.backends.chrome import tracing_backend | 9 from telemetry.core.backends.chrome import tracing_backend |
10 from telemetry.core.timeline import model as model_module | 10 from telemetry.core.timeline import model as model_module |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 os.path.join(trace_dir, 'trace')) + '.json' | 144 os.path.join(trace_dir, 'trace')) + '.json' |
145 try: | 145 try: |
146 with open(trace_file_path, 'w') as f: | 146 with open(trace_file_path, 'w') as f: |
147 trace_result.Serialize(f) | 147 trace_result.Serialize(f) |
148 results.AddValue(string_value_module.StringValue( | 148 results.AddValue(string_value_module.StringValue( |
149 page, 'trace_path', 'string', trace_file_path)) | 149 page, 'trace_path', 'string', trace_file_path)) |
150 except IOError, e: | 150 except IOError, e: |
151 logging.error('Cannot open %s. %s' % (trace_file_path, e)) | 151 logging.error('Cannot open %s. %s' % (trace_file_path, e)) |
152 | 152 |
153 model = model_module.TimelineModel(trace_result) | 153 model = model_module.TimelineModel(trace_result) |
154 renderer_thread = model.GetRendererThreadFromTab(tab) | 154 renderer_thread = model.GetRendererThreadFromTabId(tab.id) |
155 meta_metrics = _TimelineBasedMetrics( | 155 meta_metrics = _TimelineBasedMetrics( |
156 model, renderer_thread, self.CreateMetricsForTimelineInteractionRecord) | 156 model, renderer_thread, self.CreateMetricsForTimelineInteractionRecord) |
157 meta_metrics.AddResults(results) | 157 meta_metrics.AddResults(results) |
158 | 158 |
159 def CleanUpAfterPage(self, page, tab): | 159 def CleanUpAfterPage(self, page, tab): |
160 if tab.browser.is_tracing_running: | 160 if tab.browser.is_tracing_running: |
161 tab.browser.StopTracing() | 161 tab.browser.StopTracing() |
OLD | NEW |