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

Unified Diff: tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js

Issue 941773002: Revert of Clean up perftesthelper.js style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@+newCSSValueTypePerfTests
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/page_sets/tough_animation_cases/resources/perf_test_helper.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js
diff --git a/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js b/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js
new file mode 100644
index 0000000000000000000000000000000000000000..f159fd376f68e4b163549c1d62697714e2196ec1
--- /dev/null
+++ b/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js
@@ -0,0 +1,60 @@
+// Copyright 2014 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.
+(function(){
+'use strict';
+
+if (window.PerfTestHelper) {
+ return;
+}
+window.PerfTestHelper = {};
+
+var randomSeed = 3384413;
+window.PerfTestHelper.random = function() {
+ var temp = randomSeed;
+ // Robert Jenkins' 32 bit integer hash function.
+ temp = ((temp + 0x7ed55d16) + (temp << 12)) & 0xffffffff;
+ temp = ((temp ^ 0xc761c23c) ^ (temp >>> 19)) & 0xffffffff;
+ temp = ((temp + 0x165667b1) + (temp << 5)) & 0xffffffff;
+ temp = ((temp + 0xd3a2646c) ^ (temp << 9)) & 0xffffffff;
+ temp = ((temp + 0xfd7046c5) + (temp << 3)) & 0xffffffff;
+ temp = ((temp ^ 0xb55a4f09) ^ (temp >>> 16)) & 0xffffffff;
+ randomSeed = temp;
+ return (randomSeed & 0xfffffff) / 0x10000000;
+};
+
+window.PerfTestHelper.getParameter = function(parameter) {
+ var match = new RegExp(parameter + '=([^&]*)').exec(window.location.search);
+ if (match) {
+ return match[1];
+ }
+ return null;
+}
+
+window.PerfTestHelper.getN = function(defaultN) {
+ var match = PerfTestHelper.getParameter('N');
+ if (match) {
+ var n = Number(match);
+ if (isNaN(n)) {
+ throw 'Invalid N value: ' + match;
+ }
+ return n;
+ }
+ if (typeof defaultN === 'undefined') {
+ throw 'Default N value required';
+ }
+ return defaultN;
+};
+
+window.PerfTestHelper.signalReady = function() {
+ requestAnimationFrame(function() {
+ // FIXME: We must wait at least two frames before
+ // measuring to allow the GC to clean up the
+ // previous test.
+ requestAnimationFrame(function() {
+ window.measurementReady = true;
+ });
+ });
+};
+
+})();
« no previous file with comments | « tools/perf/page_sets/tough_animation_cases/resources/perf_test_helper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698