OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 <link rel="import" href="/tracing/base/base64.html"> | 7 <link rel="import" href="/tracing/base/base64.html"> |
8 <link rel="import" href="/tracing/ui/base/base.html"> | 8 <link rel="import" href="/tracing/ui/base/base.html"> |
9 <link rel="import" href="/tracing/ui/timeline_view.html"> | 9 <link rel="import" href="/tracing/ui/timeline_view.html"> |
10 <script> | 10 <script> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 Polymer.dom(g_timelineViewEl).appendChild(container); | 43 Polymer.dom(g_timelineViewEl).appendChild(container); |
44 | 44 |
45 Polymer.dom(document.body).appendChild(g_timelineViewEl); | 45 Polymer.dom(document.body).appendChild(g_timelineViewEl); |
46 | 46 |
47 var traces = []; | 47 var traces = []; |
48 var viewerDataScripts = Polymer.dom(document).querySelectorAll( | 48 var viewerDataScripts = Polymer.dom(document).querySelectorAll( |
49 '#viewer-data'); | 49 '#viewer-data'); |
50 for (var i = 0; i < viewerDataScripts.length; i++) { | 50 for (var i = 0; i < viewerDataScripts.length; i++) { |
51 var text = Polymer.dom(viewerDataScripts[i]).textContent; | 51 var text = Polymer.dom(viewerDataScripts[i]).textContent; |
52 // Trim leading newlines off the text. They happen during writing. | 52 // Trim leading newlines off the text. They happen during writing. |
53 while (text[0] === '\n') | 53 while (text[0] === '\n') { |
54 text = text.substring(1); | 54 text = text.substring(1); |
| 55 } |
55 traces.push(tr.b.Base64.atob(text)); | 56 traces.push(tr.b.Base64.atob(text)); |
56 } | 57 } |
57 | 58 |
58 var m = new tr.Model(); | 59 var m = new tr.Model(); |
59 var i = new tr.importer.Import(m); | 60 var i = new tr.importer.Import(m); |
60 var p = i.importTracesWithProgressDialog(traces); | 61 var p = i.importTracesWithProgressDialog(traces); |
61 p.then( | 62 p.then( |
62 function() { | 63 function() { |
63 g_timelineViewEl.model = m; | 64 g_timelineViewEl.model = m; |
64 g_timelineViewEl.updateDocumentFavicon(); | 65 g_timelineViewEl.updateDocumentFavicon(); |
65 g_timelineViewEl.globalMode = true; | 66 g_timelineViewEl.globalMode = true; |
66 g_timelineViewEl.viewTitle = document.title; | 67 g_timelineViewEl.viewTitle = document.title; |
67 }, | 68 }, |
68 function(err) { | 69 function(err) { |
69 var overlay = new tr.ui.b.Overlay(); | 70 var overlay = new tr.ui.b.Overlay(); |
70 Polymer.dom(overlay).textContent = tr.b.normalizeException(err).message; | 71 Polymer.dom(overlay).textContent = tr.b.normalizeException(err).message; |
71 overlay.title = 'Import error'; | 72 overlay.title = 'Import error'; |
72 overlay.visible = true; | 73 overlay.visible = true; |
73 }); | 74 }); |
74 }); | 75 }); |
75 </script> | 76 </script> |
OLD | NEW |