Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // There are tests for computeStatistics() located in LayoutTests/fast/harness/p erftests | 1 // There are tests for computeStatistics() located in LayoutTests/fast/harness/p erftests |
| 2 | 2 |
| 3 if (window.testRunner) { | 3 if (window.testRunner) { |
| 4 testRunner.waitUntilDone(); | 4 testRunner.waitUntilDone(); |
| 5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
| 6 } | 6 } |
| 7 | 7 |
| 8 (function () { | 8 (function () { |
| 9 var logLines = null; | 9 var logLines = null; |
| 10 var completedIterations = -1; | 10 var completedIterations = -1; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 logLines.push(text); | 130 logLines.push(text); |
| 131 else | 131 else |
| 132 logInDocument(text); | 132 logInDocument(text); |
| 133 } | 133 } |
| 134 | 134 |
| 135 PerfTestRunner.logFatalError = function (text) { | 135 PerfTestRunner.logFatalError = function (text) { |
| 136 PerfTestRunner.log(text); | 136 PerfTestRunner.log(text); |
| 137 finish(); | 137 finish(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Force a layout (including style recalc) if window.fullRenderingMeasuremen t is false, | |
| 141 // or a full rendering (including style recalc, layout, compositing update a nd paint invalidation, | |
| 142 // not including painting). | |
| 143 PerfTestRunner.layoutOrFullyRender = function(doc) { | |
|
Julien - ping for review
2014/11/17 19:05:46
Not a huge fan of this name (render is quite an ov
Xianzhu
2014/11/17 20:44:12
Renamed to forcelayoutOrFullFrame.
| |
| 144 doc = doc || document; | |
| 145 // Forcing full rendering is only feasible when window.internals is avai lable. | |
| 146 if (window.fullRenderingMeasurement) { | |
| 147 if (window.internals) | |
| 148 internals.forceCompositingUpdate(doc); | |
| 149 else | |
| 150 PerfTestRunner.logFatalError('window.internals API is required f or full rendering measurement.'); | |
| 151 return; | |
| 152 } | |
| 153 | |
| 154 // Otherwise just force style recalc and layout without compositing upda te and paint invalidation. | |
| 155 if (doc.body) | |
| 156 doc.body.offsetHeight; | |
| 157 else if (doc.documentElement) | |
| 158 doc.documentElement.offsetHeight; | |
| 159 }; | |
| 160 | |
| 140 function start(test, runner) { | 161 function start(test, runner) { |
| 141 if (!test) { | 162 if (!test) { |
| 142 PerfTestRunner.logFatalError("Got a bad test object."); | 163 PerfTestRunner.logFatalError("Got a bad test object."); |
| 143 return; | 164 return; |
| 144 } | 165 } |
| 145 currentTest = test; | 166 currentTest = test; |
| 146 // FIXME: We should be using multiple instances of test runner on Dromae o as well but it's too slow now. | 167 // FIXME: We should be using multiple instances of test runner on Dromae o as well but it's too slow now. |
| 147 // FIXME: Don't hard code the number of in-process iterations to use ins ide a test runner. | 168 // FIXME: Don't hard code the number of in-process iterations to use ins ide a test runner. |
| 148 iterationCount = test.dromaeoIterationCount || (window.testRunner ? 5 : 20); | 169 iterationCount = test.dromaeoIterationCount || (window.testRunner ? 5 : 20); |
| 149 logLines = window.testRunner ? [] : null; | 170 logLines = window.testRunner ? [] : null; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 var iframe = document.createElement("iframe"); | 325 var iframe = document.createElement("iframe"); |
| 305 document.body.appendChild(iframe); | 326 document.body.appendChild(iframe); |
| 306 | 327 |
| 307 iframe.sandbox = ''; // Prevent external loads which could cause wr ite() to return before completing the parse. | 328 iframe.sandbox = ''; // Prevent external loads which could cause wr ite() to return before completing the parse. |
| 308 iframe.style.width = "600px"; // Have a reasonable size so we're not line-breaking on every character. | 329 iframe.style.width = "600px"; // Have a reasonable size so we're not line-breaking on every character. |
| 309 iframe.style.height = "800px"; | 330 iframe.style.height = "800px"; |
| 310 iframe.contentDocument.open(); | 331 iframe.contentDocument.open(); |
| 311 | 332 |
| 312 for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) { | 333 for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) { |
| 313 iframe.contentDocument.write(chunks[chunkIndex]); | 334 iframe.contentDocument.write(chunks[chunkIndex]); |
| 314 // Note that we won't cause a style resolve until we've encounte red the <body> element. | 335 PerfTestRunner.layoutOrFullyRender(iframe.contentDocument); |
| 315 // Thus the number of chunks counted above is not exactly equal to the number of style resolves. | |
| 316 if (iframe.contentDocument.body) | |
| 317 iframe.contentDocument.body.clientHeight; // Force a full la yout/style-resolve. | |
| 318 else if (iframe.documentElement.localName == 'html') | |
| 319 iframe.contentDocument.documentElement.offsetWidth; // Force the painting. | |
| 320 } | 336 } |
| 321 | 337 |
| 322 iframe.contentDocument.close(); | 338 iframe.contentDocument.close(); |
| 323 document.body.removeChild(iframe); | 339 document.body.removeChild(iframe); |
| 324 }; | 340 }; |
| 325 | 341 |
| 326 PerfTestRunner.measureTime(test); | 342 PerfTestRunner.measureTime(test); |
| 327 } | 343 } |
| 328 | 344 |
| 329 window.PerfTestRunner = PerfTestRunner; | 345 window.PerfTestRunner = PerfTestRunner; |
| 330 })(); | 346 })(); |
| OLD | NEW |