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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 base.exportTo('ccfv', function() { | 7 base.exportTo('ccfv', function() { |
8 function assert(bool) { | 8 function assert(bool) { |
9 if (bool) | 9 if (bool) |
10 return; | 10 return; |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 var num_args = launch_event.args[0] | 23 var num_args = launch_event.args[0] |
24 chromeapp.sendEvent('load', 'please', onLoadResult, onLoadError); | 24 chromeapp.sendEvent('load', 'please', onLoadResult, onLoadError); |
25 } | 25 } |
26 | 26 |
27 function onLoadResult(res) { | 27 function onLoadResult(res) { |
28 var trace = JSON.parse(res); | 28 var trace = JSON.parse(res); |
29 | 29 |
30 window.g_lastResult = trace; | 30 window.g_lastResult = trace; |
31 var model = new ccfv.Model(); | 31 var model = new ccfv.Model(); |
32 model.initFromTraceEvents(trace); | 32 try { |
| 33 model.initFromTraceEvents(trace); |
| 34 } catch(e) { |
| 35 onLoadError(e); |
| 36 return; |
| 37 } |
33 window.g_model = model; | 38 window.g_model = model; |
34 | 39 |
35 var modelViewEl = new ccfv.ModelView(); | 40 var modelViewEl = new ccfv.ModelView(); |
36 modelViewEl.model = model; | 41 modelViewEl.model = model; |
37 window.g_modelViewEl = modelViewEl; | 42 window.g_modelViewEl = modelViewEl; |
38 | 43 |
39 viewerEl.appendChild(modelViewEl); | 44 viewerEl.appendChild(modelViewEl); |
40 } | 45 } |
41 | 46 |
42 function onLoadError(err) { | 47 function onLoadError(err) { |
43 viewerEl.textContent = 'error loading: ' + err; | 48 viewerEl.textContent = 'error loading: ' + err; |
44 } | 49 } |
45 | 50 |
46 function onClosed() { | 51 function onClosed() { |
47 chromeapp.exit(1); | 52 chromeapp.exit(1); |
48 } | 53 } |
49 | 54 |
50 }); | 55 }); |
OLD | NEW |