Index: canvas_bench/bench.js |
=================================================================== |
--- canvas_bench/bench.js (revision 0) |
+++ canvas_bench/bench.js (revision 0) |
@@ -0,0 +1,29 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+var bench = (function() { |
+ var rafFunc; |
+ var drawFunc; |
+ |
+ function tick() { |
+ drawFunc(); |
+ rafFunc(tick); |
+ }; |
+ |
+ function startAnimation() { |
+ rafFunc = window.requestAnimationFrame || |
+ window.webkitRequestAnimationFrame || |
+ window.mozRequestAnimationFrame || |
+ window.oRequestAnimationFrame || |
+ window.msRequestAnimationFrame; |
+ rafFunc(tick); |
+ }; |
+ |
+ var bench = {}; |
+ bench.run = function(df) { |
+ drawFunc = df; |
+ startAnimation(); |
+ }; |
+ return bench; |
+})(); |
Property changes on: canvas_bench\bench.js |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |