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

Side by Side Diff: chrome/test/data/perf/latency_suite.html

Issue 10829015: Add compositor thread mode to latency tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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
« no previous file with comments | « no previous file | chrome/test/perf/rendering/latency_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript"> 3 <script type="text/javascript">
4 /** 4 /**
5 * @fileoverview This page executes various animation behaviors based on URL 5 * @fileoverview This page executes various animation behaviors based on URL
6 * arguments to test input latency. There are two main modes of 6 * arguments to test input latency. There are two main modes of
7 * operation: webgl and software. Both modes use 7 * operation: webgl and software. Both modes use
8 * requestAnimationFrame to drive the update rate. The basic task 8 * requestAnimationFrame to drive the update rate. The basic task
9 * of the page is to collect mouse input coordinates in the input 9 * of the page is to collect mouse input coordinates in the input
10 * handler and render with the latest input coordinate in RAF. The 10 * handler and render with the latest input coordinate in RAF. The
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 mouseX.toString(); 51 mouseX.toString();
52 } 52 }
53 if (testParams.inputHeavy) { 53 if (testParams.inputHeavy) {
54 sleep(parseInt(testParams.delayTimeMS)); 54 sleep(parseInt(testParams.delayTimeMS));
55 } 55 }
56 } 56 }
57 57
58 function init() { 58 function init() {
59 parseParams(); 59 parseParams();
60 60
61 if (testParams.mode == 'webgl') { 61 if (testParams.mode.indexOf('webgl') != -1) {
62 var canvas = document.getElementById('canvas'); 62 var canvas = document.getElementById('canvas');
63 if (!canvas) 63 if (!canvas)
64 return false; 64 return false;
65 canvas.width = parseInt(testParams.canvasWidth); 65 canvas.width = parseInt(testParams.canvasWidth);
66 canvas.height = parseInt(testParams.canvasWidth); 66 canvas.height = parseInt(testParams.canvasWidth);
67 try { 67 try {
68 // Specify antialiasing to ensure that we get a BlitFramebufferEXT in 68 // Specify antialiasing to ensure that we get a BlitFramebufferEXT in
69 // the trace when the compositor consumes a webgl frame. 69 // the trace when the compositor consumes a webgl frame.
70 gl = canvas.getContext('webgl', { antialias: true }); 70 gl = canvas.getContext('webgl', { antialias: true });
71 } catch (e) {} 71 } catch (e) {}
(...skipping 22 matching lines...) Expand all
94 function sleep(milliseconds) { 94 function sleep(milliseconds) {
95 var start = Date.now(); 95 var start = Date.now();
96 while(Date.now() - start <= milliseconds); 96 while(Date.now() - start <= milliseconds);
97 } 97 }
98 98
99 function draw() { 99 function draw() {
100 if (testParams.rafHeavy) { 100 if (testParams.rafHeavy) {
101 sleep(parseInt(testParams.delayTimeMS)); 101 sleep(parseInt(testParams.delayTimeMS));
102 } 102 }
103 103
104 if (testParams.mode == 'webgl') { 104 if (testParams.mode.indexOf('webgl') != -1) {
105 gl.viewport(0, 0, testParams.canvasWidth, testParams.canvasWidth); 105 gl.viewport(0, 0, testParams.canvasWidth, testParams.canvasWidth);
106 if (testParams.paintHeavy) { 106 if (testParams.paintHeavy) {
107 gl.clearColor(0, 0, 0.0, 1.0); 107 gl.clearColor(0, 0, 0.0, 1.0);
108 for (var i = 0; i < 1000; ++i) 108 for (var i = 0; i < 1000; ++i)
109 gl.clear(gl.COLOR_BUFFER_BIT); 109 gl.clear(gl.COLOR_BUFFER_BIT);
110 } 110 }
111 gl.clearColor(mouseX, testParams.clearColorGreen, 0.0, 1.0); 111 gl.clearColor(mouseX, testParams.clearColorGreen, 0.0, 1.0);
112 gl.clear(gl.COLOR_BUFFER_BIT); 112 gl.clear(gl.COLOR_BUFFER_BIT);
113 } else if (testParams.mode == 'software') { 113 } else if (testParams.mode == 'software') {
114 var table = document.getElementById('table'); 114 var table = document.getElementById('table');
115 // Encode mouse x value into color channels (support up to 64k x values). 115 // Encode mouse x value into color channels (support up to 64k x values).
116 var g = (mouseX & 0xff00) >> 8; 116 var g = (mouseX & 0xff00) >> 8;
117 var b = (mouseX & 0xff); 117 var b = (mouseX & 0xff);
118 table.style.backgroundColor = 'rgb(0, ' + g + ', ' + b + ')'; 118 table.style.backgroundColor = 'rgb(0, ' + g + ', ' + b + ')';
119 // When no inputs are coming in, the first table won't change. Since we 119 // When no inputs are coming in, the first table won't change. Since we
120 // still need to cause a paint, toggle the color of another element: 120 // still need to cause a paint, toggle the color of another element:
121 var table2 = document.getElementById('table2'); 121 var table2 = document.getElementById('table2');
122 table2.style.backgroundColor = (frameCount & 1) ? 'gray' : 'silver'; 122 table2.style.backgroundColor = (frameCount & 1) ? 'gray' : 'silver';
123 if (testParams.paintHeavy) { 123 if (testParams.paintHeavy) {
124 var body = document.getElementById('body'); 124 var body = document.getElementById('body');
125 body.style.backgroundColor = (frameCount & 1) ? 'silver' : 'gray'; 125 body.style.backgroundColor = (frameCount & 1) ? 'silver' : 'gray';
126 } 126 }
127 } 127 }
128 128
129 frameCount++; 129 frameCount++;
130 if (frameCount == parseInt(testParams.numFrames)) { 130 if (frameCount == parseInt(testParams.numFrames)) {
131 if (testParams.mode == 'webgl') 131 if (testParams.mode.indexOf('webgl') != -1)
132 gl.finish(); 132 gl.finish();
133 endTest(); 133 endTest();
134 } else { 134 } else {
135 window.webkitRequestAnimationFrame(draw); 135 window.webkitRequestAnimationFrame(draw);
136 } 136 }
137 } 137 }
138 138
139 function endTest() { 139 function endTest() {
140 testIsRunning = false; 140 testIsRunning = false;
141 domAutomationController.setAutomationId(1); 141 domAutomationController.setAutomationId(1);
142 domAutomationController.send('FINISHED'); 142 domAutomationController.send('FINISHED');
143 } 143 }
144 </script> 144 </script>
145 </head> 145 </head>
146 <style> 146 <style>
147 #table { 147 #table {
148 height: 10px; 148 height: 10px;
149 width: 10px; 149 width: 10px;
150 } 150 }
151 </style> 151 </style>
152 <body id="body" style="margin:0px" onload="onLoad()" 152 <body id="body" style="margin:0px" onload="onLoad()"
153 onmousemove="setCoordinates(event)"> 153 onmousemove="setCoordinates(event)">
154 <table id="table"><tr/></table> 154 <table id="table"><tr/></table>
155 <table id="table2"><tr/></table> 155 <table id="table2"><tr/></table>
156 <canvas id="canvas"></canvas> 156 <canvas id="canvas"></canvas>
157 <p><b id="text">x</b></p> 157 <p><b id="text">x</b></p>
158 </body> 158 </body>
159 </html> 159 </html>
OLDNEW
« no previous file with comments | « no previous file | chrome/test/perf/rendering/latency_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698