summaryrefslogtreecommitdiff
path: root/systrace/catapult/systrace/systrace/prefix.html.template
blob: 767a300bfc5db0eee55546ec15041b78ccf8b954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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>