Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome/browser/resources/tracing/timeline_test.html

Issue 8513009: Add TRACE_COUNTER support to about:tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Copyright (c) 2010 The Chromium Authors. All rights reserved.
James Hawkins 2011/11/16 17:41:38 2011.
nduca 2011/11/16 19:03:56 Done.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
7 -->
8 <head i18n-values="dir:textdirection;">
9 <title>Interactive Timeline Tests</title>
10 <style>
James Hawkins 2011/11/16 17:41:38 Move to a CSS file.
nduca 2011/11/16 19:03:56 Killed this entirely. It was just convenience stuf
11 * {
12 box-sizing: border-box;
13 -webkit-user-select: none;
14 }
15
16 .timeline-container {
17 border: 1px solid red;
18 }
19
20 </style>
21 <link rel="stylesheet" href="timeline.css">
22 <script src="../shared/js/cr.js"></script>
23 <script src="../shared/js/cr/event_target.js"></script>
24 <script src="../shared/js/cr/ui.js"></script>
25 <script src="../shared/js/util.js"></script>
26 <script src="timeline_model.js"></script>
27 <script src="sorted_array_utils.js"></script>
28 <script src="measuring_stick.js"></script>
29 <script src="timeline.js"></script>
30 <script src="timeline_track.js"></script>
31 <script src="fast_rect_renderer.js"></script>
32 </head>
33 <body>
34 <script>
35 function get(url, cb) {
James Hawkins 2011/11/16 17:41:38 Move to a JS file.
nduca 2011/11/16 19:03:56 Done.
36 var req = new XMLHttpRequest();
37 req.open('GET', url, true);
38 req.onreadystatechange = function(aEvt) {
39 if (req.readyState == 4) {
40 window.setTimeout(function() {
41 if (req.status == 200) {
42 var resp = JSON.parse(req.responseText);
43 if (resp.traceEvents)
44 cb(resp.traceEvents);
45 else
46 cb(resp);
47 } else {
48 console.log('Failed to load ' + url);
49 }
50 }, 0);
51 }
52 }
53 req.send(null);
54 }
55 </script>
56
57 <div class="timeline-test" src="./tests/trivial_trace.json" create-detached=1>
58 </div>
59
60 <div class="timeline-test" src="./tests/trivial_trace.json">
61 </div>
62
63 <div class="timeline-test" src="./tests/simple_trace.json">
64 </div>
65
66 <div class="timeline-test" src="./tests/nonnested_trace.json">
67 </div>
68
69 <div class="timeline-test" src="./tests/tall_trace.json">
70 </div>
71
72 <div class="timeline-test" src="./tests/big_trace.json">
73 </div>
74
75 <div class="timeline-test" src="./tests/huge_trace.json">
76 </div>
77
78 <script>
79 function load(parentEl) {
James Hawkins 2011/11/16 17:41:38 Move to a JS file.
nduca 2011/11/16 19:03:56 This code is specific to this test group. I was co
80 var src = parentEl.getAttribute('src');
81 if (document.location.hash && document.location.hash.substring(1) != src) {
82 parentEl.hidden = true;
83 return;
84 }
85 parentEl.hidden = false;
86 parentEl.textContent = '';
87 var titleEl = document.createElement('h3');
88 var linkEl = document.createElement('a');
89 linkEl.textContent = src;
90 linkEl.href = '#' + src;
91 titleEl.appendChild(linkEl);
92
93 var containerEl = document.createElement('div');
94 containerEl.tabIndex = 0;
95 containerEl.className = 'timeline-container';
96
97 var timelineEl = document.createElement('div');
98 cr.ui.decorate(timelineEl, tracing.Timeline);
99 timelineEl.focusElement = containerEl;
100
101 parentEl.appendChild(titleEl);
102 parentEl.appendChild(containerEl);
103
104 // Creating attached vs detached stress tests the canvas- and viewport-
105 // setup code.
106 var create_detached = parentEl.getAttribute('create-attached') == 1;
107 if (create_detached) {
108 containerEl.appendChild(timelineEl);
109 get(src, function(events) {
110 var model = new tracing.TimelineModel(events);
111 timelineEl.model = model;
112 });
113 } else {
114 get(src, function(events) {
115 var model = new tracing.TimelineModel(events);
116 timelineEl.model = model;
117 containerEl.appendChild(timelineEl);
118 });
119 }
120 }
121 function onLoad() {
122 Array.prototype.forEach.call(document.querySelectorAll('.timeline-test'),
123 load);
124 }
125
126 document.addEventListener('DOMContentLoaded', onLoad);
127 window.addEventListener('hashchange', onLoad);
128 </script>
129 </body>
130 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698