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. |
| 16 * 3. Add a call to __animation_hook() at the end of the animation loop |
| 17 */ |
| 18 |
| 19 // default gestures for animated content |
| 20 __gestures = { |
| 21 none: __gesture_library["stationary"] |
| 22 }; |
| 23 |
| 24 // Don't start benchmarking animated pages right away. |
| 25 // wait for initialization to complete. |
| 26 __initialized = false; |
| 27 |
| 28 // Indicate to the test harness that the test page has its own |
| 29 // animation loop. |
| 30 __animation = true; |
| 31 |
| 32 // Draw this many frames before starting test. |
| 33 // This is a delay to allow caches and other resources to spin-up to reach a |
| 34 // steady running state before benchmarking begins. |
| 35 var __warmup_frames = 10; |
| 36 |
| 37 function __animation_hook() { |
| 38 if (__warmup_frames > 0){ |
| 39 __warmup_frames--; |
| 40 return; |
| 41 } |
| 42 |
| 43 // Signal that page is ready to begin benchamarking |
| 44 __initialized = true; |
| 45 |
| 46 if (__running) { |
| 47 __advance_gesture(); |
| 48 __update_fps(); |
| 49 } |
| 50 } |
| 51 |
| 52 |
| 53 |
OLD | NEW |