| Index: tools/telemetry/telemetry/inspector_timeline.py
|
| ===================================================================
|
| --- tools/telemetry/telemetry/inspector_timeline.py (revision 177224)
|
| +++ tools/telemetry/telemetry/inspector_timeline.py (working copy)
|
| @@ -4,7 +4,7 @@
|
| from telemetry.timeline_event import TimelineEvent
|
| from telemetry.timeline_model import TimelineModel
|
|
|
| -class TabBackendException(Exception):
|
| +class InspectorBackendException(Exception):
|
| pass
|
|
|
| class InspectorTimeline(object):
|
| @@ -20,8 +20,9 @@
|
| def __exit__(self, *args):
|
| self._timeline.Stop()
|
|
|
| - def __init__(self, tab_backend):
|
| - self._tab_backend = tab_backend
|
| + def __init__(self, inspector_backend, tab):
|
| + self._inspector_backend = inspector_backend
|
| + self._tab = tab
|
| self._is_recording = False
|
| self._timeline_model = None
|
|
|
| @@ -34,24 +35,24 @@
|
| return
|
| self._is_recording = True
|
| self._timeline_model = TimelineModel()
|
| - self._tab_backend.RegisterDomain('Timeline',
|
| + self._inspector_backend.RegisterDomain('Timeline',
|
| self._OnNotification, self._OnClose)
|
| req = {'method': 'Timeline.start'}
|
| self._SendSyncRequest(req)
|
|
|
| def Stop(self):
|
| if not self._is_recording:
|
| - raise TabBackendException('Stop() called but not started')
|
| + raise InspectorBackendException('Stop() called but not started')
|
| self._is_recording = False
|
| self._timeline_model.DidFinishRecording()
|
| req = {'method': 'Timeline.stop'}
|
| self._SendSyncRequest(req)
|
| - self._tab_backend.UnregisterDomain('Timeline')
|
| + self._inspector_backend.UnregisterDomain('Timeline')
|
|
|
| def _SendSyncRequest(self, req, timeout=60):
|
| - res = self._tab_backend.SyncRequest(req, timeout)
|
| + res = self._inspector_backend.SyncRequest(req, timeout)
|
| if 'error' in res:
|
| - raise TabBackendException(res['error']['message'])
|
| + raise InspectorBackendException(res['error']['message'])
|
| return res['result']
|
|
|
| def _OnNotification(self, msg):
|
| @@ -119,5 +120,5 @@
|
|
|
| def _OnClose(self):
|
| if self._is_recording:
|
| - raise TabBackendException('InspectTimeline received OnClose whilst '
|
| + raise InspectorBackendException('InspectTimeline received OnClose whilst '
|
| 'recording.')
|
|
|