Options are only needed when initializing the stage or benchmark, so there's no
need to also keep a reference to it.
* Animometer/tests/resources/main.js: Get rid of options variable in Benchmark.
Pass options to Controllers and Stages.
(Controller.Utilities.createClass):
(Benchmark.Utilities.createClass):
(get options): Deleted.
* Animometer/tests/bouncing-particles/resources/bouncing-canvas-images.js:
* Animometer/tests/bouncing-particles/resources/bouncing-canvas-particles.js:
* Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js:
* Animometer/tests/bouncing-particles/resources/bouncing-css-images.js:
* Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
* Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
* Animometer/tests/bouncing-particles/resources/bouncing-svg-images.js:
* Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js:
* Animometer/tests/master/resources/canvas-stage.js:
* Animometer/tests/master/resources/canvas-tests.js:
* Animometer/tests/master/resources/particles.js:
* Animometer/tests/misc/resources/canvas-electrons.js:
* Animometer/tests/misc/resources/canvas-stars.js:
* Animometer/tests/misc/resources/compositing-transforms.js:
* Animometer/tests/simple/resources/simple-canvas-paths.js:
* Animometer/tests/simple/resources/tiled-canvas-image.js:
* Animometer/tests/template/resources/template-canvas.js:
* Animometer/tests/template/resources/template-css.js:
* Animometer/tests/template/resources/template-svg.js:
* Animometer/tests/text/resources/layering-text.js:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196289
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
BouncingCanvasParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark);
- var imageSrc = benchmark.options["imageSrc"] || "resources/yin-yang.svg";
+ BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark, options);
+ var imageSrc = options["imageSrc"] || "resources/yin-yang.svg";
this.imageElement = document.querySelector(".hidden[src=\"" + imageSrc + "\"]");
},
BouncingParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingParticlesStage.prototype.initialize.call(this, benchmark);
+ BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
this.context = this.element.getContext("2d");
},
BouncingCanvasParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark);
- this.parseShapeParameters(benchmark.options);
+ BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark, options);
+ this.parseShapeParameters(options);
},
createParticle: function()
BouncingParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingParticlesStage.prototype.initialize.call(this, benchmark);
- this.imageSrc = benchmark.options["imageSrc"] || "../resources/yin-yang.svg";
+ BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
+ this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
},
createParticle: function()
BouncingParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingParticlesStage.prototype.initialize.call(this, benchmark);
- this.parseShapeParameters(benchmark.options);
+ BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
+ this.parseShapeParameters(options);
},
createParticle: function()
this.particles = [];
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
- this.particleSize = new Point(parseInt(benchmark.options["particleWidth"]) || 10, parseInt(benchmark.options["particleHeight"]) || 10);
- this.maxVelocity = Math.max(parseInt(benchmark.options["maxVelocity"]) || 500, 100);
+ Stage.prototype.initialize.call(this, benchmark, options);
+ this.particleSize = new Point(parseInt(options["particleWidth"]) || 10, parseInt(options["particleHeight"]) || 10);
+ this.maxVelocity = Math.max(parseInt(options["maxVelocity"]) || 500, 100);
},
parseShapeParameters: function(options)
BouncingSvgParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark);
- this.imageSrc = benchmark.options["imageSrc"] || "resources/yin-yang.svg";
+ BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark, options);
+ this.imageSrc = options["imageSrc"] || "resources/yin-yang.svg";
},
createParticle: function()
BouncingSvgParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark);
- this.parseShapeParameters(benchmark.options);
+ BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark, options);
+ this.parseShapeParameters(options);
this._gradientsCount = 0;
},
this.objects = [];
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this.context = this.element.getContext("2d");
},
SimpleCanvasStage.call(this, CanvasLineSegment);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- SimpleCanvasStage.prototype.initialize.call(this, benchmark);
- this.context.lineCap = benchmark.options["lineCap"] || "butt";
+ SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
+ this.context.lineCap = options["lineCap"] || "butt";
this.circleRadius = this.size.x / 3 / 2 - 20;
},
SimpleCanvasStage.call(this, CanvasLinePoint);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- SimpleCanvasStage.prototype.initialize.call(this, benchmark);
- this.context.lineJoin = benchmark.options["lineJoin"] || "bevel";
- this.context.lineCap = benchmark.options["lineCap"] || "butt";
+ SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
+ this.context.lineJoin = options["lineJoin"] || "bevel";
+ this.context.lineCap = options["lineCap"] || "butt";
},
animate: function() {
this.particles = [];
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this.emissionSpin = Stage.random(0, 3);
this.emitSteps = Stage.randomInt(4, 6);
},
this._electrons = [];
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this.context = this.element.getContext("2d");
},
this._objects = [];
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this.context = this.element.getContext("2d");
},
BouncingParticlesStage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- BouncingParticlesStage.prototype.initialize.call(this, benchmark);
+ BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
- this.imageSrc = benchmark.options["imageSrc"] || "../resources/yin-yang.svg";
- this.useFilters = benchmark.options["filters"] == "yes";
+ this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
+ this.useFilters = options["filters"] == "yes";
},
createParticle: function()
-
Controller = Utilities.createClass(
- function(testLength, benchmark, seriesCount)
+ function(testLength, benchmark, options)
{
// Initialize timestamps relative to the start of the benchmark
// In start() the timestamps are offset by the start timestamp
this._startTimestamp = 0;
this._endTimestamp = testLength;
// Default data series: timestamp, complexity, estimatedFrameLength
- this._sampler = new Sampler(seriesCount || 3, 60 * testLength, this);
- this._estimator = new SimpleKalmanEstimator(benchmark.options["kalman-process-error"], benchmark.options["kalman-measurement-error"]);
+ this._sampler = new Sampler(options["series-count"] || 3, 60 * testLength, this);
+ this._estimator = new SimpleKalmanEstimator(options["kalman-process-error"], options["kalman-measurement-error"]);
this.initialComplexity = 0;
}, {
});
FixedComplexityController = Utilities.createSubclass(Controller,
- function(testInterval, benchmark)
+ function(testInterval, benchmark, options)
{
- Controller.call(this, testInterval, benchmark);
- this.initialComplexity = benchmark.options["complexity"];
+ Controller.call(this, testInterval, benchmark, options);
+ this.initialComplexity = options["complexity"];
}
);
AdaptiveController = Utilities.createSubclass(Controller,
- function(testInterval, benchmark)
+ function(testInterval, benchmark, options)
{
// Data series: timestamp, complexity, estimatedIntervalFrameLength
- Controller.call(this, testInterval, benchmark);
+ Controller.call(this, testInterval, benchmark, options);
// All tests start at 0, so we expect to see 60 fps quickly.
this._samplingTimestamp = testInterval / 2;
this._startedSampling = false;
- this._targetFrameRate = benchmark.options["frame-rate"];
+ this._targetFrameRate = options["frame-rate"];
this._pid = new PIDController(this._targetFrameRate);
this._intervalFrameCount = 0;
Benchmark = Utilities.createClass(
function(stage, options)
{
- this._options = options;
this._animateLoop = this._animateLoop.bind(this);
this._stage = stage;
- this._stage.initialize(this);
+ this._stage.initialize(this, options);
var testIntervalMilliseconds = options["test-interval"] * 1000;
switch (options["adjustment"])
{
case "fixed":
- this._controller = new FixedComplexityController(testIntervalMilliseconds, this);
+ this._controller = new FixedComplexityController(testIntervalMilliseconds, this, options);
break;
case "adaptive":
default:
- this._controller = new AdaptiveController(testIntervalMilliseconds, this);
+ this._controller = new AdaptiveController(testIntervalMilliseconds, this, options);
break;
}
}, {
- get options()
- {
- return this._options;
- },
-
get stage()
{
return this._stage;
SimpleCanvasStage.call(this, CanvasLineSegment);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- SimpleCanvasStage.prototype.initialize.call(this, benchmark);
- this.context.lineCap = benchmark.options["lineCap"] || "butt";
+ SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
+ this.context.lineCap = options["lineCap"] || "butt";
}
});
SimpleCanvasPathStrokeStage.call(this, CanvasLinePoint);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- SimpleCanvasPathStrokeStage.prototype.initialize.call(this, benchmark);
- this.context.lineJoin = benchmark.options["lineJoin"] || "bevel";
+ SimpleCanvasPathStrokeStage.prototype.initialize.call(this, benchmark, options);
+ this.context.lineJoin = options["lineJoin"] || "bevel";
}
});
this._step = 0;
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- SimpleCanvasStage.prototype.initialize.call(this, benchmark);
+ SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
this.context.setLineDash([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
this.context.lineWidth = 1;
this.context.strokeStyle = "#000";
Stage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this.context = this.element.getContext("2d");
this._setupTiles();
},
Stage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this.context = this.element.getContext("2d");
// Define a collection for your objects.
Stage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
// Do initialization here.
},
Stage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
// Do initialization here.
},
Stage.call(this);
}, {
- initialize: function(benchmark)
+ initialize: function(benchmark, options)
{
- Stage.prototype.initialize.call(this, benchmark);
+ Stage.prototype.initialize.call(this, benchmark, options);
this._textElementParent = this.element;
this._textElements = [];
this._textItemIndex = 0;
+2016-02-07 Jon Lee <jonlee@apple.com>
+
+ Get rid of options member variable in Benchmark.
+
+ Options are only needed when initializing the stage or benchmark, so there's no
+ need to also keep a reference to it.
+
+ * Animometer/tests/resources/main.js: Get rid of options variable in Benchmark.
+ Pass options to Controllers and Stages.
+ (Controller.Utilities.createClass):
+ (Benchmark.Utilities.createClass):
+ (get options): Deleted.
+
+ * Animometer/tests/bouncing-particles/resources/bouncing-canvas-images.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-canvas-particles.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-css-images.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-svg-images.js:
+ * Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js:
+ * Animometer/tests/master/resources/canvas-stage.js:
+ * Animometer/tests/master/resources/canvas-tests.js:
+ * Animometer/tests/master/resources/particles.js:
+ * Animometer/tests/misc/resources/canvas-electrons.js:
+ * Animometer/tests/misc/resources/canvas-stars.js:
+ * Animometer/tests/misc/resources/compositing-transforms.js:
+ * Animometer/tests/simple/resources/simple-canvas-paths.js:
+ * Animometer/tests/simple/resources/tiled-canvas-image.js:
+ * Animometer/tests/template/resources/template-canvas.js:
+ * Animometer/tests/template/resources/template-css.js:
+ * Animometer/tests/template/resources/template-svg.js:
+ * Animometer/tests/text/resources/layering-text.js:
+
2016-02-07 Jon Lee <jonlee@apple.com>
Update how the benchmark is run