Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4718)

Unified Diff: canvas_bench/bench.js

Issue 9355020: Added framework for canvas benchmark and two examples that stress drawImage. One example draws mult… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | canvas_bench/many_images.html » ('j') | canvas_bench/single_image.html » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | canvas_bench/many_images.html » ('j') | canvas_bench/single_image.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698