diff options
Diffstat (limited to 'catapult/systrace/systrace/prefix.html.template')
-rw-r--r-- | catapult/systrace/systrace/prefix.html.template | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/catapult/systrace/systrace/prefix.html.template b/catapult/systrace/systrace/prefix.html.template new file mode 100644 index 00000000..767a300b --- /dev/null +++ b/catapult/systrace/systrace/prefix.html.template @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<html> +<head i18n-values="dir:textdirection;"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<meta charset="utf-8"/> +<title>Android System Trace</title> +<style> + html, + body { + height: 100%; + } + + body { + -webkit-flex-direction: column; + display: -webkit-flex; + margin: 0; + padding: 0; + } + + body > tr-ui-timeline-view { + -webkit-flex: 1 1 auto; + min-height: 0; + } + body > tr-ui-timeline-view:focus { + outline: none; + } +</style> + +<!-- WebComponent V0 polyfill. See https://crbug.com/1036492 --> +<script> +'use strict'; +{{WEBCOMPONENTS_V0_POLYFILL_JS}} +</script> +{{SYSTRACE_TRACE_VIEWER_HTML}} +</head> +<body> + <tr-ui-timeline-view> + <track-view-container id='track_view_container'></track-view-container> + </tr-ui-timeline-view> + + <script> + 'use strict'; + var timelineViewEl; + + function onLoad() { + timelineViewEl = document.querySelector('tr-ui-timeline-view'); + timelineViewEl.globalMode = true; + + var traceDataEls = document.body.querySelectorAll('.trace-data'); + var traces = []; + for (var i = 0; i < traceDataEls.length; i++) { + var traceText = traceDataEls[i].textContent; + // Remove the leading newline. + traceText = traceText.substring(1); + traces.push(traceText); + } + + var m = new tr.Model(); + var i = new tr.importer.Import(m); + var p = i.importTracesWithProgressDialog(traces); + p.then( + function() { + timelineViewEl.model = m; + timelineViewEl.updateDocumentFavicon(); + timelineViewEl.globalMode = true; + timelineViewEl.viewTitle = 'Android System Trace'; + }, + function(err) { + var overlay = new tr.ui.b.Overlay(); + overlay.textContent = tr.b.normalizeException(err).message; + overlay.title = 'Import error'; + overlay.visible = true; + }); + } + window.addEventListener('load', onLoad); + </script> |