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

Side by Side Diff: tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js

Issue 931723002: Add perf tests for animations using different CSS value types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 (function(){ 4 (function(){
qyearsley 2015/02/17 17:51:40 [Optional] You could also make this file match the
alancutter (OOO until 2018) 2015/02/17 20:42:12 Will do in separate patch.
5 'use strict'; 5 'use strict';
6 6
7 if (window.PerfTestHelper) { 7 if (window.PerfTestHelper) {
8 return; 8 return;
9 } 9 }
10 window.PerfTestHelper = {}; 10 window.PerfTestHelper = {};
11 11
12 var randomSeed = 3384413; 12 var randomSeed = 3384413;
13 window.PerfTestHelper.random = function() { 13 window.PerfTestHelper.random = function() {
14 var temp = randomSeed; 14 var temp = randomSeed;
15 // Robert Jenkins' 32 bit integer hash function. 15 // Robert Jenkins' 32 bit integer hash function.
16 temp = ((temp + 0x7ed55d16) + (temp << 12)) & 0xffffffff; 16 temp = ((temp + 0x7ed55d16) + (temp << 12)) & 0xffffffff;
17 temp = ((temp ^ 0xc761c23c) ^ (temp >>> 19)) & 0xffffffff; 17 temp = ((temp ^ 0xc761c23c) ^ (temp >>> 19)) & 0xffffffff;
18 temp = ((temp + 0x165667b1) + (temp << 5)) & 0xffffffff; 18 temp = ((temp + 0x165667b1) + (temp << 5)) & 0xffffffff;
19 temp = ((temp + 0xd3a2646c) ^ (temp << 9)) & 0xffffffff; 19 temp = ((temp + 0xd3a2646c) ^ (temp << 9)) & 0xffffffff;
20 temp = ((temp + 0xfd7046c5) + (temp << 3)) & 0xffffffff; 20 temp = ((temp + 0xfd7046c5) + (temp << 3)) & 0xffffffff;
21 temp = ((temp ^ 0xb55a4f09) ^ (temp >>> 16)) & 0xffffffff; 21 temp = ((temp ^ 0xb55a4f09) ^ (temp >>> 16)) & 0xffffffff;
22 randomSeed = temp; 22 randomSeed = temp;
23 return (randomSeed & 0xfffffff) / 0x10000000; 23 return (randomSeed & 0xfffffff) / 0x10000000;
24 }; 24 };
25 25
26 window.PerfTestHelper.getParameter = function(parameter) {
27 var match = new RegExp(parameter + '=([^&]*)').exec(window.location.search);
28 if (match) {
29 return match[1];
30 }
31 return null;
32 }
33
26 window.PerfTestHelper.getN = function(defaultN) { 34 window.PerfTestHelper.getN = function(defaultN) {
27 var match = /N=(\d+)/.exec(window.location.search); 35 var match = PerfTestHelper.getParameter('N');
28 if (match) { 36 if (match) {
29 return Number(match[1]); 37 var n = Number(match);
38 if (isNaN(n)) {
39 throw 'Invalid N value: ' + match;
40 }
41 return n;
30 } 42 }
31 if (typeof defaultN === 'undefined') { 43 if (typeof defaultN === 'undefined') {
32 throw 'Default N value required'; 44 throw 'Default N value required';
33 } 45 }
34 return defaultN; 46 return defaultN;
35 }; 47 };
36 48
37 window.PerfTestHelper.signalReady = function() { 49 window.PerfTestHelper.signalReady = function() {
38 requestAnimationFrame(function() { 50 requestAnimationFrame(function() {
39 // FIXME: We must wait at least two frames before 51 // FIXME: We must wait at least two frames before
40 // measuring to allow the GC to clean up the 52 // measuring to allow the GC to clean up the
41 // previous test. 53 // previous test.
42 requestAnimationFrame(function() { 54 requestAnimationFrame(function() {
43 window.measurementReady = true; 55 window.measurementReady = true;
44 }); 56 });
45 }); 57 });
46 }; 58 };
47 59
48 })(); 60 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698