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

Unified Diff: tests/benchmark_smoke/benchmark_base.dart

Issue 12259037: Reapply remove setTimeout, take 3. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/benchmark_smoke/benchmark_lib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/benchmark_smoke/benchmark_base.dart
diff --git a/tests/benchmark_smoke/benchmark_base.dart b/tests/benchmark_smoke/benchmark_base.dart
index e2699cd9030fd6828c28af377d63444be7d2227b..6b724c11d7d05596cbc881007783aea362f15edd 100644
--- a/tests/benchmark_smoke/benchmark_base.dart
+++ b/tests/benchmark_smoke/benchmark_base.dart
@@ -94,7 +94,7 @@ class BenchmarkBase {
class BenchmarkSuite {
/** The set of benchmarks that have yet to run. */
List<Function> benchmarks;
-
+
/**
* The set of scores from the benchmarks that have already run. (Used for
* calculating the Geometric mean).
@@ -112,15 +112,15 @@ class BenchmarkSuite {
benchmarks = [() => Smoketest.main()];
totalBenchmarks = benchmarks.length;
}
-
+
/** Run all of the benchmarks that we have in our benchmarks list. */
runBenchmarks() {
runBenchmarksHelper(benchmarks);
}
-
+
/**
* Run the remaining benchmarks in our list. We chain the calls providing
- * little breaks for the main page to gain control, so we don't force the
+ * little breaks for the main page to gain control, so we don't force the
* entire page to hang the whole time.
*/
runBenchmarksHelper(List<Function> remainingBenchmarks) {
@@ -128,10 +128,11 @@ class BenchmarkSuite {
var benchmark = remainingBenchmarks.removeLast();
benchmark();
if (remainingBenchmarks.length > 0) {
- /* Provide small breaks between each benchmark, so that the browser
+ /* Provide small breaks between each benchmark, so that the browser
doesn't get unhappy about long running scripts, and so the user
can regain control of the UI to kill the page as needed. */
- window.setTimeout(() => runBenchmarksHelper(remainingBenchmarks), 25);
+ new Timer(const Duration(milliseconds: 25),
+ () => runBenchmarksHelper(remainingBenchmarks));
} else if (remainingBenchmarks.length == 0) {
// We've run all of the benchmarks. Update the page with the score.
BENCHMARK_VIEW.setScore(geometricMean(scores));
@@ -140,7 +141,7 @@ class BenchmarkSuite {
/** Store the results of a single benchmark run. */
updateIndividualScore(String name, num score) {
- scores.add(score);
+ scores.add(score);
BENCHMARK_VIEW.incrementProgress(name, score, totalBenchmarks);
}
@@ -172,9 +173,9 @@ class BenchmarkView {
body.nodes.add(
new Element.html("<p id='testResultScore'>Score: $newScore</p>"));
}
-
+
/**
- * Update the page HTML to show how much progress we've made through the
+ * Update the page HTML to show how much progress we've made through the
* benchmarks.
*/
incrementProgress(String name, num score, num totalBenchmarks) {
@@ -184,8 +185,8 @@ class BenchmarkView {
// the user we're making progress.
num percentage = 100 * numCompleted ~/ totalBenchmarks;
}
-
- /**
+
+ /**
* Rounds the score to have at least three significant digits (hopefully)
* helping readability of the scores.
*/
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/benchmark_smoke/benchmark_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698