| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Perform various "gestures" and calculate average frame rate. | 6 * @fileoverview Perform various "gestures" and calculate average frame rate. |
| 7 * "Gestures" are recorded scrolling behaviors in terms of time (ms) and | 7 * "Gestures" are recorded scrolling behaviors in terms of time (ms) and |
| 8 * absolute positions. | 8 * absolute positions. |
| 9 * | 9 * |
| 10 * How to run a single gesture: | 10 * How to run a single gesture: |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 __raf_is_live = true; | 275 __raf_is_live = true; |
| 276 if (__running) { | 276 if (__running) { |
| 277 // Only update the FPS if a gesture movement occurs. Otherwise, the frame | 277 // Only update the FPS if a gesture movement occurs. Otherwise, the frame |
| 278 // rate average becomes inaccurate after any pause. | 278 // rate average becomes inaccurate after any pause. |
| 279 if (__advance_gesture()) | 279 if (__advance_gesture()) |
| 280 __update_fps(); | 280 __update_fps(); |
| 281 else | 281 else |
| 282 __t_last = new Date().getTime(); | 282 __t_last = new Date().getTime(); |
| 283 } | 283 } |
| 284 __sched_update(); | 284 __sched_update(); |
| 285 }); | 285 }, document.body); |
| 286 } | 286 } |
| 287 | 287 |
| 288 function __start_recording() { | 288 function __start_recording() { |
| 289 __start(__advance_gesture_recording); | 289 __start(__advance_gesture_recording); |
| 290 } | 290 } |
| 291 | 291 |
| 292 function __start(gesture_function) { | 292 function __start(gesture_function) { |
| 293 if (__running) | 293 if (__running) |
| 294 return; | 294 return; |
| 295 // Attempt to create a gesture function from a string name. | 295 // Attempt to create a gesture function from a string name. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 __running = false; | 352 __running = false; |
| 353 __running_all = false; | 353 __running_all = false; |
| 354 document.title = __old_title; | 354 document.title = __old_title; |
| 355 document.body.scrollTop = 0; | 355 document.body.scrollTop = 0; |
| 356 __init_stats(); | 356 __init_stats(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 function __force_compositor() { | 359 function __force_compositor() { |
| 360 document.body.style.webkitTransform = "translateZ(0)"; | 360 document.body.style.webkitTransform = "translateZ(0)"; |
| 361 } | 361 } |
| OLD | NEW |