Chromium Code Reviews| Index: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
| diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
| index 218b95c5734a11551c177abebe4a350a33245033..5b20c3e9ac0d6233691657ded436eff840ed3b73 100644 |
| --- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
| +++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py |
| @@ -25,9 +25,8 @@ class TracingBackend(object): |
| self._inspector_websocket.Connect( |
| 'ws://127.0.0.1:%i/devtools/browser' % devtools_port) |
| - self._category_filter = None |
| - self._nesting = 0 |
| self._tracing_data = [] |
| + self._category_filter = None |
| self._is_tracing_running = False |
| self._chrome_browser_backend = chrome_browser_backend |
| @@ -36,10 +35,9 @@ class TracingBackend(object): |
| return self._is_tracing_running |
| def StartTracing(self, trace_options, custom_categories=None, timeout=10): |
| - """ Starts tracing on the first nested call and returns True. Returns False |
| + """ Starts tracing on the first call and returns True. Returns False |
| and does nothing on subsequent nested calls. |
| """ |
| - self._nesting += 1 |
| if self.is_tracing_running: |
|
dtu
2014/09/15 22:06:33
Maybe we don't need this check and/or this variabl
nednguyen
2014/09/15 22:09:47
No, if we allow StartTracing to be called multiple
chrishenry
2014/09/23 17:49:26
Should we throw exception? The return value from S
nednguyen
2014/10/03 17:13:47
done.
nednguyen
2014/10/03 17:13:47
tracing_controller_backend return False in case it
|
| new_category_filter = tracing_category_filter.TracingCategoryFilter( |
| filter_string=custom_categories) |
| @@ -76,12 +74,9 @@ class TracingBackend(object): |
| return True |
| def StopTracing(self, timeout=30): |
| - """ Stops tracing on the innermost (!) nested call, because we cannot get |
| - results otherwise. Resets _tracing_data on the outermost nested call. |
| - Returns the result of the trace, as TracingTimelineData object. |
| + """ Stops tracing and returns the raw json trace result. It this is called |
| + after tracing has been stopped, empty trace data is returned. |
| """ |
| - self._nesting -= 1 |
| - assert self._nesting >= 0 |
| if self.is_tracing_running: |
| req = {'method': 'Tracing.end'} |
| self._inspector_websocket.SendAndIgnoreResponse(req) |
| @@ -98,19 +93,10 @@ class TracingBackend(object): |
| 'seconds. If the trace data is big, you may want to increase the ' |
| 'time out amount.' % err.elapsed_time) |
| self._is_tracing_running = False |
| - if self._nesting == 0: |
| - self._category_filter = None |
| - return self._GetTraceResultAndReset() |
| - else: |
| - return self._GetTraceResult() |
| - |
| - def _GetTraceResult(self): |
| - assert not self.is_tracing_running |
| - return self._tracing_data |
| + return self._GetTraceResultAndReset() |
| def _GetTraceResultAndReset(self): |
| - result = self._GetTraceResult() |
| - |
| + result = self._tracing_data |
| self._tracing_data = [] |
| return result |