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

Side by Side Diff: third_party/WebKit/PerformanceTests/Bindings/post-message.html

Issue 1921503002: [Binding][PerformanceTest] Fix post-message.html to wait messages' responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 isDone = false;
5 6
6 var times = 100000; 7 function runTest() {
7 var worker = new Worker('resources/worker.js'); 8 var numRound = 1000;
8 worker.onmessage = function(event) { 9 var worker = new Worker('resources/worker.js');
9 console.log("received"); 10
11 var startTime = PerfTestRunner.now();
12 worker.onmessage = function(event) {
13 numRound--;
14 if (numRound > 0) {
15 worker.postMessage('next');
16 } else {
17 PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
18 if (!isDone)
19 runTest();
20 }
21 };
22 worker.postMessage('start');
23 }
24
25 function testDone() {
26 isDone = true;
27 }
28
29 window.onload = function () {
30 PerfTestRunner.prepareToMeasureValuesAsync({
31 description: "Measures time to run 1000 postMessage round trips in seria l.",
32 unit: 'ms',
33 done: testDone,
34 });
35 runTest();
10 }; 36 };
11
12 PerfTestRunner.measureTime({
13 description: "Measures performance of postMessage().",
14 run: function() {
15 for (var i = 0; i < times; i++)
16 worker.postMessage('foo');
17 }
18 });
19 </script> 37 </script>
38 <div id="log"></div>
20 </body> 39 </body>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698