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

Side by Side Diff: third_party/WebKit/PerformanceTests/Parser/html-parser-threaded.html

Issue 2858783003: Refactor prepareToMeasureValuesAsync to startMeasureValuesAsyn which run test through callback (Closed)
Patch Set: Address Xianzhu's review comments Created 3 years, 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <body> 2 <body>
3 <script src="../resources/runner.js"></script> 3 <script src="../resources/runner.js"></script>
4 <script> 4 <script>
5 var specURL = "resources/html5.html"; 5 var specURL = "resources/html5.html";
6 6
7 var iframe = document.createElement("iframe"); 7 var iframe = document.createElement("iframe");
8 iframe.style.display = "none"; // Prevent creation of the rendering tree, so we only test HTML parsing. 8 iframe.style.display = "none"; // Prevent creation of the rendering tree, so we only test HTML parsing.
9 iframe.sandbox = ''; // Prevent external script loads which could cause write() to return before completing the parse. 9 iframe.sandbox = ''; // Prevent external script loads which could cause write() to return before completing the parse.
10 document.body.appendChild(iframe); 10 document.body.appendChild(iframe);
11 11
12 PerfTestRunner.prepareToMeasureValuesAsync({
13 description: "Measures performance of the threaded HTML parser (if available ).",
14 done: onCompletedRun,
15 unit: 'ms'
16 });
17
18 iframe.onload = function() {
19 var now = PerfTestRunner.now();
20 PerfTestRunner.measureValueAsync(now - then);
21 then = now;
22 iframe.src = specURL;
23 }
24 var then = PerfTestRunner.now();
25 iframe.src = specURL;
26
27 function onCompletedRun() { 12 function onCompletedRun() {
28 iframe.onload = null; 13 iframe.onload = null;
29 // FIXME: This should probably remove the iframe, but that currently 14 // FIXME: This should probably remove the iframe, but that currently
30 // causes the threaded-parser to never send the load event for the main page . 15 // causes the threaded-parser to never send the load event for the main page .
31 // document.body.removeChild(iframe); 16 // document.body.removeChild(iframe);
32 } 17 }
18
19
20 PerfTestRunner.startMeasureValuesAsync({
21 description: "Measures performance of the threaded HTML parser (if available ).",
22 done: onCompletedRun,
23 unit: 'ms',
24 run: function() {
25 iframe.onload = function() {
26 var now = PerfTestRunner.now();
27 PerfTestRunner.measureValueAsync(now - then);
28 then = now;
29 iframe.src = specURL;
30 }
31 var then = PerfTestRunner.now();
32 iframe.src = specURL;
33 }
34 });
35
33 </script> 36 </script>
34 </body> 37 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698