Remove rAF usage and inline into _step ()

This commit is contained in:
Tim Mickel 2016-10-26 11:32:15 -04:00 committed by GitHub
parent 2f0ce7137c
commit 1dc4aaa2d7
3 changed files with 6 additions and 30 deletions

View file

@ -231,9 +231,7 @@ window.onload = function() {
// Inform VM of animation frames. // Inform VM of animation frames.
var animate = function() { var animate = function() {
stats.end(); stats.update();
stats.begin();
window.vm.animationFrame();
requestAnimationFrame(animate); requestAnimationFrame(animate);
}; };
requestAnimationFrame(animate); requestAnimationFrame(animate);

View file

@ -101,13 +101,6 @@ var Runtime = function () {
*/ */
this.compatibilityMode = false; this.compatibilityMode = false;
/**
* How fast in ms "single stepping mode" should run, in ms.
* Can be updated dynamically.
* @type {!number}
*/
this.singleStepInterval = 1000 / 10;
/** /**
* A reference to the current runtime stepping interval, set * A reference to the current runtime stepping interval, set
* by a `setInterval`. * by a `setInterval`.
@ -534,6 +527,10 @@ Runtime.prototype._step = function () {
this.redrawRequested = false; this.redrawRequested = false;
var inactiveThreads = this.sequencer.stepThreads(); var inactiveThreads = this.sequencer.stepThreads();
this._updateGlows(inactiveThreads); this._updateGlows(inactiveThreads);
if (this.renderer) {
// @todo: Only render when this.redrawRequested or clones rendered.
this.renderer.draw();
}
}; };
/** /**
@ -729,24 +726,12 @@ Runtime.prototype.requestRedraw = function () {
this.redrawRequested = true; this.redrawRequested = true;
}; };
/**
* Handle an animation frame from the main thread.
*/
Runtime.prototype.animationFrame = function () {
if (this.renderer) {
// @todo: Only render when this.redrawRequested or clones rendered.
this.renderer.draw();
}
};
/** /**
* Set up timers to repeatedly step in a browser. * Set up timers to repeatedly step in a browser.
*/ */
Runtime.prototype.start = function () { Runtime.prototype.start = function () {
var interval = Runtime.THREAD_STEP_INTERVAL; var interval = Runtime.THREAD_STEP_INTERVAL;
if (this.singleStepping) { if (this.compatibilityMode) {
interval = this.singleStepInterval;
} else if (this.compatibilityMode) {
interval = Runtime.THREAD_STEP_INTERVAL_COMPATIBILITY; interval = Runtime.THREAD_STEP_INTERVAL_COMPATIBILITY;
} }
this.currentStepTime = interval; this.currentStepTime = interval;

View file

@ -120,13 +120,6 @@ VirtualMachine.prototype.getPlaygroundData = function () {
}); });
}; };
/**
* Handle an animation frame.
*/
VirtualMachine.prototype.animationFrame = function () {
this.runtime.animationFrame();
};
/** /**
* Post I/O data to the virtual devices. * Post I/O data to the virtual devices.
* @param {?string} device Name of virtual I/O device. * @param {?string} device Name of virtual I/O device.