| Index: third_party/WebKit/PerformanceTests/Bindings/post-message.html
|
| diff --git a/third_party/WebKit/PerformanceTests/Bindings/post-message.html b/third_party/WebKit/PerformanceTests/Bindings/post-message.html
|
| index 862aa8249a2417c7cb887b212378593d5bac1c57..5745861725132670f3077a95aa054a06e76a1375 100644
|
| --- a/third_party/WebKit/PerformanceTests/Bindings/post-message.html
|
| +++ b/third_party/WebKit/PerformanceTests/Bindings/post-message.html
|
| @@ -2,19 +2,38 @@
|
| <body>
|
| <script src="../resources/runner.js"></script>
|
| <script>
|
| +var isDone = false;
|
|
|
| -var times = 100000;
|
| -var worker = new Worker('resources/worker.js');
|
| -worker.onmessage = function(event) {
|
| - console.log("received");
|
| -};
|
| +function runTest() {
|
| + var numRound = 1000;
|
| + var worker = new Worker('resources/worker.js');
|
| +
|
| + var startTime = PerfTestRunner.now();
|
| + worker.onmessage = function(event) {
|
| + numRound--;
|
| + if (numRound > 0) {
|
| + worker.postMessage('next');
|
| + } else {
|
| + PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
|
| + if (!isDone)
|
| + runTest();
|
| + }
|
| + };
|
| + worker.postMessage('start');
|
| +}
|
|
|
| -PerfTestRunner.measureTime({
|
| - description: "Measures performance of postMessage().",
|
| - run: function() {
|
| - for (var i = 0; i < times; i++)
|
| - worker.postMessage('foo');
|
| - }
|
| -});
|
| +function testDone() {
|
| + isDone = true;
|
| +}
|
| +
|
| +window.onload = function () {
|
| + PerfTestRunner.prepareToMeasureValuesAsync({
|
| + description: "Measures time to run 1000 postMessage round trips in serial.",
|
| + unit: 'ms',
|
| + done: testDone,
|
| + });
|
| + runTest();
|
| +};
|
| </script>
|
| +<div id="log"></div>
|
| </body>
|
|
|