Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview FrameRateTest harness variant for benchmarking | |
| 7 * pages that contain content that is animated (e.g. canvas2d, webGL) | |
| 8 * | |
| 9 * How to instrument an animated web page for use with the frame rate test | |
| 10 * harness: | |
| 11 * 1. Include head.js followed by head_animation.js in the head of the test | |
| 12 * page. | |
| 13 * 2. If the animation loop does not already use requestAnimationFrame, convert | |
| 14 * it. For maximum portability and functionality, use the __raf function | |
| 15 * defined in head.js (included by this file). Using __raf instead of | |
| 16 * requestAnimationFrame is essential for the *_noraf tests to work | |
| 17 * properly. | |
| 18 * 3. Add a call to __animation_hook() at the end of the animation loop | |
| 19 */ | |
| 20 | |
| 21 // default gestures for animated content | |
| 22 __gestures = { | |
| 23 none: __gesture_library["stationary"] | |
| 24 }; | |
| 25 | |
| 26 // Don't start benchmarking animated pages right away. | |
| 27 // wait for initialization to complete. | |
| 28 __initialized = false; | |
| 29 | |
| 30 // Indicate to the test harness that the test page has its own | |
| 31 // animation loop. | |
| 32 __animation = true; | |
|
nduca
2011/10/14 21:01:46
as I mentioend before, how about just saying __ani
| |
| 33 | |
| 34 // Draw this many frames before starting test. | |
| 35 // This is a delay to allow caches and other resources to spin-up to reach a | |
| 36 // steady running state before benchmarking begins. | |
| 37 var __warmup_frames = 10; | |
| 38 | |
| 39 function __animation_hook() { | |
| 40 if (__warmup_frames > 0){ | |
| 41 __warmup_frames--; | |
| 42 return; | |
| 43 } | |
| 44 | |
| 45 // Signal that page is ready to begin benchamarking | |
| 46 __initialized = true; | |
| 47 | |
| 48 if (__running) { | |
| 49 __advance_gesture(); | |
| 50 __update_fps(); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 | |
| 55 | |
| OLD | NEW |