| OLD | NEW | 
|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 cStringIO | 5 import cStringIO | 
| 6 import json | 6 import json | 
| 7 import logging | 7 import logging | 
| 8 import socket | 8 import socket | 
| 9 import threading | 9 import threading | 
| 10 | 10 | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 36     else: | 36     else: | 
| 37       f.write(d[0]) | 37       f.write(d[0]) | 
| 38       for i in range(1, len(d)): | 38       for i in range(1, len(d)): | 
| 39         f.write(',') | 39         f.write(',') | 
| 40         f.write(d[i]) | 40         f.write(d[i]) | 
| 41     f.write(']}') | 41     f.write(']}') | 
| 42 | 42 | 
| 43   def AsTimelineModel(self): | 43   def AsTimelineModel(self): | 
| 44     f = cStringIO.StringIO() | 44     f = cStringIO.StringIO() | 
| 45     self.Serialize(f) | 45     self.Serialize(f) | 
| 46     return model.TimelineModel(event_data=f.getvalue()) | 46     return model.TimelineModel( | 
|  | 47       event_data=f.getvalue(), | 
|  | 48       shift_world_to_zero=False) | 
| 47 | 49 | 
| 48 class TracingBackend(object): | 50 class TracingBackend(object): | 
| 49   def __init__(self, devtools_port): | 51   def __init__(self, devtools_port): | 
| 50     debugger_url = 'ws://localhost:%i/devtools/browser' % devtools_port | 52     debugger_url = 'ws://localhost:%i/devtools/browser' % devtools_port | 
| 51     self._socket = websocket.create_connection(debugger_url) | 53     self._socket = websocket.create_connection(debugger_url) | 
| 52     self._next_request_id = 0 | 54     self._next_request_id = 0 | 
| 53     self._cur_socket_timeout = 0 | 55     self._cur_socket_timeout = 0 | 
| 54     self._thread = None | 56     self._thread = None | 
| 55     self._tracing_data = [] | 57     self._tracing_data = [] | 
| 56 | 58 | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 125       logging.debug('got [%s]', data) | 127       logging.debug('got [%s]', data) | 
| 126       res = json.loads(data) | 128       res = json.loads(data) | 
| 127       if res['id'] != req['id']: | 129       if res['id'] != req['id']: | 
| 128         logging.debug('Dropped reply: %s', json.dumps(res)) | 130         logging.debug('Dropped reply: %s', json.dumps(res)) | 
| 129         continue | 131         continue | 
| 130       if res.get('response'): | 132       if res.get('response'): | 
| 131         raise TracingUnsupportedException( | 133         raise TracingUnsupportedException( | 
| 132             'Tracing not supported for this browser') | 134             'Tracing not supported for this browser') | 
| 133       elif 'error' in res: | 135       elif 'error' in res: | 
| 134         return | 136         return | 
| OLD | NEW | 
|---|