Skip to content

Commit 869e97c

Browse files
committed
Fixed complexity runs throw an error
The `Controller` base class was trying to call `_previousFrameComplexity()` which was only implemented on the `RampController` subclass. Since the `Controller` base class allocates the `Samples` object and records samples, we know that all subclasses use the same sample format, so we can move the helper functions that access sample data into the `Controller` class.
1 parent 37c6101 commit 869e97c

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

MotionMark/tests/resources/main.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,29 @@ Controller = Utilities.createClass(
155155
return averageFrameLength;
156156
},
157157

158+
_getFrameType: function(samples, i)
159+
{
160+
return samples[sampleTypeIndex][i];
161+
},
162+
163+
_getComplexity: function(samples, i)
164+
{
165+
return samples[sampleComplexityIndex][i];
166+
},
167+
168+
_getFrameLength: function(samples, i)
169+
{
170+
return samples[sampleTimeIndex][i] - samples[sampleTimeIndex][i - 1];
171+
},
172+
173+
_previousFrameComplexity: function(samples, i)
174+
{
175+
if (i > 0)
176+
return this._getComplexity(samples, i - 1);
177+
178+
return 0;
179+
},
180+
158181
update: function(timestamp, stage)
159182
{
160183
const frameType = this._previousFrameComplexity(this._sampler.samples, this._sampler.sampleCount) != stage.complexity() ? Strings.json.mutationFrameType : Strings.json.animationFrameType
@@ -598,29 +621,6 @@ RampController = Utilities.createSubclass(Controller,
598621
this._possibleMaximumComplexity = this._maximumComplexity;
599622
},
600623

601-
_getFrameType: function(samples, i)
602-
{
603-
return samples[sampleTypeIndex][i];
604-
},
605-
606-
_getComplexity: function(samples, i)
607-
{
608-
return samples[sampleComplexityIndex][i];
609-
},
610-
611-
_getFrameLength: function(samples, i)
612-
{
613-
return samples[sampleTimeIndex][i] - samples[sampleTimeIndex][i - 1];
614-
},
615-
616-
_previousFrameComplexity: function(samples, currentSampleCount)
617-
{
618-
if (currentSampleCount > 0)
619-
return this._getComplexity(samples, currentSampleCount - 1);
620-
621-
return 0;
622-
},
623-
624624
processSamples: function(results)
625625
{
626626
results[Strings.json.marks] = this._processMarks();

0 commit comments

Comments
 (0)