Skip to content

Commit fe95c03

Browse files
committed
Rebase
1 parent bfe702d commit fe95c03

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

MotionMark/tests/dev/radial-chart/radial-chart.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
<script src="../../../resources/extensions.js"></script>
4343
<script src="../../../resources/statistics.js"></script>
4444
<script src="../../resources/math.js"></script>
45-
<script src="../../resources/main.js"></script>
45+
<script src="../../resources/benchmark.js"></script>
46+
<script src="../../resources/controllers.js"></script>
47+
<script src="../../resources/stage.js"></script>
4648
<script src="resources/radial-chart.js"></script>
4749
</body>
4850
</html>

MotionMark/tests/dev/radial-chart/resources/radial-chart.js

+7-22
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ class RadialChartStage extends Stage {
473473
this.instanceData = [];
474474
}
475475

476-
initialize(benchmark, options)
476+
async initialize(benchmark, options)
477477
{
478-
super.initialize(benchmark, options);
478+
await super.initialize(benchmark, options);
479479

480480
const dpr = window.devicePixelRatio || 1;
481481
this.canvasDPR = Math.min(Math.floor(dpr), 2); // Just use 1 or 2.
@@ -488,7 +488,8 @@ class RadialChartStage extends Stage {
488488
this.canvasSize = new Size(this._canvasObject.width / this.canvasDPR, this._canvasObject.height / this.canvasDPR);
489489
this._complexity = 0;
490490

491-
this.#startLoadingData(benchmark);
491+
await this.#loadDataJSON();
492+
await this.#loadImages();
492493

493494
this.context = this._canvasObject.getContext("2d");
494495
this.context.scale(this.canvasDPR, this.canvasDPR);
@@ -504,16 +505,6 @@ class RadialChartStage extends Stage {
504505
this.#setupCharts();
505506
}
506507

507-
#startLoadingData(benchmark)
508-
{
509-
setTimeout(async () => {
510-
await this.#loadDataJSON();
511-
await this.#loadImages();
512-
513-
benchmark.readyPromise.resolve();
514-
}, 0);
515-
}
516-
517508
async #loadDataJSON()
518509
{
519510
const url = "resources/departements-region.json";
@@ -534,9 +525,8 @@ class RadialChartStage extends Stage {
534525
async #loadImages()
535526
{
536527
let promises = [];
537-
for (const instance of this.instanceData) {
528+
for (const instance of this.instanceData)
538529
promises.push(instance.loadImage());
539-
}
540530

541531
await Promise.all(promises);
542532
}
@@ -607,12 +597,6 @@ class RadialChartBenchmark extends Benchmark {
607597
const canvas = document.getElementById('stage-canvas');
608598
super(new RadialChartStage(canvas), options);
609599
}
610-
611-
waitUntilReady()
612-
{
613-
this.readyPromise = new SimplePromise;
614-
return this.readyPromise;
615-
}
616600
}
617601

618602
window.benchmarkClass = RadialChartBenchmark;
@@ -637,12 +621,13 @@ class FakeController {
637621
}
638622

639623
// Testing
640-
window.addEventListener('load', () => {
624+
window.addEventListener('load', async () => {
641625
if (!(window === window.parent))
642626
return;
643627

644628
var benchmark = new window.benchmarkClass({ });
645629
benchmark._controller = new FakeController();
630+
await benchmark.initialize({ });
646631

647632
benchmark.run().then(function(testData) {
648633

0 commit comments

Comments
 (0)