Index: benchmarks/spinning-balls/v.js |
=================================================================== |
--- benchmarks/spinning-balls/v.js (revision 9575) |
+++ benchmarks/spinning-balls/v.js (working copy) |
@@ -42,6 +42,9 @@ |
} )(); |
} |
+ |
+ |
+ |
var kNPoints = 8000; |
var kNModifications = 20; |
var kNVisiblePoints = 200; |
@@ -54,11 +57,23 @@ |
var dyingPoints = void 0; |
var scene = void 0; |
var renderingStartTime = void 0; |
+var omitFrameDueToVisibilityChange = false; |
var scene = void 0; |
var pausePlot = void 0; |
var splayTree = void 0; |
+handleVisibilityChange(); |
+function handleVisibilityChange() { |
+ console.log("visibility change"); |
+ omitFrameDueToVisibilityChange = true; |
+ document.addEventListener("webkitvisibilitychange", handleVisibilityChange); |
+ document.addEventListener("msvisibilitychange", handleVisibilityChange); |
+ document.addEventListener("mozvisibilitychange", handleVisibilityChange); |
+ document.addEventListener("visibilitychange", handleVisibilityChange); |
+} |
+ |
+ |
function Point(x, y, z, payload) { |
this.x = x; |
this.y = y; |
@@ -353,9 +368,12 @@ |
scene.draw(); |
var renderingEndTime = Date.now(); |
- var pause = renderingEndTime - renderingStartTime; |
- pausePlot.addPause(pause); |
+ if (!omitFrameDueToVisibilityChange) { |
+ var pause = renderingEndTime - renderingStartTime; |
+ pausePlot.addPause(pause); |
+ } |
renderingStartTime = renderingEndTime; |
+ omitFrameDueToVisibilityChange = false; |
pausePlot.draw(); |