Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: tools/telemetry/telemetry/core/chrome/tracing_backend.py

Issue 19790005: Reland [telemetry] Timeline model cleanups (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « tools/telemetry/docs/telemetry.page.record_wpr.html ('k') | tools/telemetry/telemetry/core/timeline/async_slice.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698