Bug 1034651 - The framerate front's `plotFPS` should be a static method, r=pbrosset

This commit is contained in:
Victor Porof 2014-07-07 07:20:47 -04:00
Родитель 4eed9cf8c9
Коммит 1d81b115df
3 изменённых файлов: 50 добавлений и 51 удалений

Просмотреть файл

@ -121,7 +121,8 @@ let FramerateFront = exports.FramerateFront = protocol.FrontClass(FramerateActor
initialize: function(client, { framerateActor }) {
protocol.Front.prototype.initialize.call(this, client, { actor: framerateActor });
this.manage(this);
},
}
});
/**
* Plots the frames per second on a timeline.
@ -137,7 +138,7 @@ let FramerateFront = exports.FramerateFront = protocol.FrontClass(FramerateActor
* A collection of { delta, value } objects representing the
* framerate value at every delta time.
*/
plotFPS: function(ticks, interval = 100, clamp = 60) {
FramerateFront.plotFPS = function(ticks, interval = 100, clamp = 60) {
let timeline = [];
let totalTicks = ticks.length;
@ -170,9 +171,7 @@ let FramerateFront = exports.FramerateFront = protocol.FrontClass(FramerateActor
}
return timeline;
}
});
};
/**
* Gets the top level browser window from a content window.

Просмотреть файл

@ -58,7 +58,7 @@ window.onload = function() {
function onRecordingStopped(front, rawData) {
ok(rawData, "There should be a recording available.");
var timeline = front.plotFPS(rawData);
var timeline = FramerateFront.plotFPS(rawData);
ok(timeline.length >= 2,
"There should be at least one measurement available, with two entries.");

Просмотреть файл

@ -47,7 +47,7 @@ window.onload = function() {
ok(rawData, "There should be a recording available.");
is(rawData.length, 0, "...but it should be empty.");
var timeline = front.plotFPS(rawData);
var timeline = FramerateFront.plotFPS(rawData);
is(timeline.length, 2,
"There should be one measurement plotted, with two entries.");