OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 function onModelLoaded() { | 5 function onModelLoaded() { |
6 viewer.globalMode = true; | 6 viewer.globalMode = true; |
7 viewer.model = model; | 7 viewer.model = model; |
8 } | 8 } |
9 | 9 |
10 function clearTimeline() { | 10 function clearTimeline() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 pendingRequests--; | 48 pendingRequests--; |
49 if (pendingRequests == 0) { | 49 if (pendingRequests == 0) { |
50 console.log("Got all timeline parts"); | 50 console.log("Got all timeline parts"); |
51 updateTimeline(traceObject); | 51 updateTimeline(traceObject); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 function fetchTimelineOnLoad(event) { | 55 function fetchTimelineOnLoad(event) { |
56 var xhr = event.target; | 56 var xhr = event.target; |
57 var response = JSON.parse(xhr.responseText); | 57 var response = JSON.parse(xhr.responseText); |
58 var result = response['result']; | |
59 var newStackFrames = result['stackFrames']; // Map. | |
60 var newTraceEvents = result['traceEvents']; // List. | |
61 | 58 |
62 // Merge in timeline events. | 59 if (response.error) { |
63 traceObject.traceEvents = traceObject.traceEvents.concat(newTraceEvents); | 60 // Maybe profiling is disabled. |
64 for (var key in newStackFrames) { | 61 console.log("ERROR " + response.error.message); |
65 if (newStackFrames.hasOwnProperty(key)) { | 62 } else { |
66 traceObject.stackFrames[key] = newStackFrames[key]; | 63 var result = response['result']; |
| 64 var newStackFrames = result['stackFrames']; // Map. |
| 65 var newTraceEvents = result['traceEvents']; // List. |
| 66 |
| 67 // Merge in timeline events. |
| 68 traceObject.traceEvents = traceObject.traceEvents.concat(newTraceEvents); |
| 69 for (var key in newStackFrames) { |
| 70 if (newStackFrames.hasOwnProperty(key)) { |
| 71 traceObject.stackFrames[key] = newStackFrames[key]; |
| 72 } |
67 } | 73 } |
68 } | 74 } |
69 | 75 |
70 gotReponse(); | 76 gotReponse(); |
71 } | 77 } |
72 | 78 |
73 function fetchTimelineOnError(event) { | 79 function fetchTimelineOnError(event) { |
74 var xhr = event.target; | 80 var xhr = event.target; |
75 console.log(xhr.statusText); | 81 console.log(xhr.statusText); |
76 gotReponse(); | 82 gotReponse(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 viewer = document.createElement('tr-ui-timeline-view'); | 218 viewer = document.createElement('tr-ui-timeline-view'); |
213 viewer.track_view_container = container; | 219 viewer.track_view_container = container; |
214 viewer.appendChild(container); | 220 viewer.appendChild(container); |
215 viewer.id = 'trace-viewer'; | 221 viewer.id = 'trace-viewer'; |
216 viewer.globalMode = true; | 222 viewer.globalMode = true; |
217 document.body.appendChild(viewer); | 223 document.body.appendChild(viewer); |
218 registerForMessages(); | 224 registerForMessages(); |
219 }); | 225 }); |
220 | 226 |
221 console.log('loaded'); | 227 console.log('loaded'); |
OLD | NEW |