Chromium Code Reviews

Unified Diff: lib/src/runner.dart

Issue 1260253005: Switch from AsyncThunk to AsyncMemoizer. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | lib/src/runner/browser/compiler_pool.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner.dart
diff --git a/lib/src/runner.dart b/lib/src/runner.dart
index 58c2a68f5c8609d49ccb29a0453b8dc5a64f97c1..64b58122c78e718eecacf4293113143540df1b8d 100644
--- a/lib/src/runner.dart
+++ b/lib/src/runner.dart
@@ -7,6 +7,8 @@ library test.runner;
import 'dart:async';
import 'dart:io';
+import 'package:async/async.dart';
+
import 'backend/metadata.dart';
import 'backend/test_platform.dart';
import 'runner/application_exception.dart';
@@ -19,7 +21,6 @@ import 'runner/reporter.dart';
import 'runner/reporter/compact.dart';
import 'runner/reporter/expanded.dart';
import 'runner/runner_suite.dart';
-import 'util/async_thunk.dart';
import 'util/io.dart';
import 'utils.dart';
@@ -48,9 +49,9 @@ class Runner {
/// The subscription to the stream returned by [_loadSuites].
StreamSubscription _suiteSubscription;
- /// The thunk for ensuring [close] only runs once.
- final _closeThunk = new AsyncThunk();
- bool get _closed => _closeThunk.hasRun;
+ /// The memoizer for ensuring [close] only runs once.
+ final _closeMemo = new AsyncMemoizer();
+ bool get _closed => _closeMemo.hasRun;
/// Creates a new runner based on [configuration].
factory Runner(Configuration configuration) {
@@ -131,7 +132,7 @@ class Runner {
/// This stops any future test suites from running. It will wait for any
/// currently-running VM tests, in case they have stuff to clean up on the
/// filesystem.
- Future close() => _closeThunk.run(() async {
+ Future close() => _closeMemo.runOnce(() async {
var timer;
if (!_engine.isIdle) {
// Wait a bit to print this message, since printing it eagerly looks weird
« no previous file with comments | « no previous file | lib/src/runner/browser/compiler_pool.dart » ('j') | no next file with comments »

Powered by Google App Engine