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/timeline_view.html"> | 8 <link rel="import" href="/tracing/ui/timeline_view.html"> |
9 <script> | 9 <script> |
10 'use strict'; | 10 'use strict'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 '}', | 24 '}', |
25 'tr-ui-timeline-view {', | 25 'tr-ui-timeline-view {', |
26 ' width: 100%;', | 26 ' width: 100%;', |
27 ' height: 100%;', | 27 ' height: 100%;', |
28 '}', | 28 '}', |
29 'tr-ui-timeline-view:focus {', | 29 'tr-ui-timeline-view:focus {', |
30 ' outline: none;', | 30 ' outline: none;', |
31 '}' | 31 '}' |
32 ]; | 32 ]; |
33 styleEl.textContent = lines.join('\n'); | 33 styleEl.textContent = lines.join('\n'); |
34 document.head.appendChild(styleEl); | 34 Polymer.dom(document.head).appendChild(styleEl); |
35 })(); | 35 })(); |
36 | 36 |
37 document.addEventListener('DOMContentLoaded', function() { | 37 document.addEventListener('DOMContentLoaded', function() { |
38 var container = document.createElement('track-view-container'); | 38 var container = document.createElement('track-view-container'); |
39 container.id = 'track_view_container'; | 39 container.id = 'track_view_container'; |
40 | 40 |
41 g_timelineViewEl = document.createElement('tr-ui-timeline-view'); | 41 g_timelineViewEl = document.createElement('tr-ui-timeline-view'); |
42 g_timelineViewEl.appendChild(container); | 42 Polymer.dom(g_timelineViewEl).appendChild(container); |
43 | 43 |
44 document.body.appendChild(g_timelineViewEl); | 44 Polymer.dom(document.body).appendChild(g_timelineViewEl); |
45 | 45 |
46 var traces = []; | 46 var traces = []; |
47 var viewerDataScripts = document.querySelectorAll('#viewer-data'); | 47 var viewerDataScripts = document.querySelectorAll('#viewer-data'); |
48 for (var i = 0; i < viewerDataScripts.length; i++) { | 48 for (var i = 0; i < viewerDataScripts.length; i++) { |
49 var text = viewerDataScripts[i].textContent; | 49 var text = viewerDataScripts[i].textContent; |
50 // Trim leading newlines off the text. They happen during writing. | 50 // Trim leading newlines off the text. They happen during writing. |
51 while (text[0] == '\n') | 51 while (text[0] == '\n') |
52 text = text.substring(1); | 52 text = text.substring(1); |
53 traces.push(tr.b.Base64.atob(text)); | 53 traces.push(tr.b.Base64.atob(text)); |
54 } | 54 } |
55 | 55 |
56 var m = new tr.Model(); | 56 var m = new tr.Model(); |
57 var i = new tr.importer.Import(m); | 57 var i = new tr.importer.Import(m); |
58 var p = i.importTracesWithProgressDialog(traces); | 58 var p = i.importTracesWithProgressDialog(traces); |
59 p.then( | 59 p.then( |
60 function() { | 60 function() { |
61 g_timelineViewEl.model = m; | 61 g_timelineViewEl.model = m; |
62 g_timelineViewEl.updateDocumentFavicon(); | 62 g_timelineViewEl.updateDocumentFavicon(); |
63 g_timelineViewEl.globalMode = true; | 63 g_timelineViewEl.globalMode = true; |
64 g_timelineViewEl.viewTitle = document.title; | 64 g_timelineViewEl.viewTitle = document.title; |
65 }, | 65 }, |
66 function(err) { | 66 function(err) { |
67 var overlay = new tr.ui.b.Overlay(); | 67 var overlay = new tr.ui.b.Overlay(); |
68 overlay.textContent = tr.b.normalizeException(err).message; | 68 overlay.textContent = tr.b.normalizeException(err).message; |
69 overlay.title = 'Import error'; | 69 overlay.title = 'Import error'; |
70 overlay.visible = true; | 70 overlay.visible = true; |
71 }); | 71 }); |
72 }); | 72 }); |
73 </script> | 73 </script> |
OLD | NEW |