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

Unified Diff: lib/src/runner/runner_suite.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. 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 | « lib/src/runner/loader.dart ('k') | lib/src/util/async_thunk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/runner_suite.dart
diff --git a/lib/src/runner/runner_suite.dart b/lib/src/runner/runner_suite.dart
index 589178ff7b3d3ebe6994ae76293e392b6b3a22b6..10064afe244a84c8fcda7b4e9f23c07c8307297a 100644
--- a/lib/src/runner/runner_suite.dart
+++ b/lib/src/runner/runner_suite.dart
@@ -6,12 +6,13 @@ library test.runner.runner_suite;
import 'dart:async';
+import 'package:async/async.dart';
+
import '../backend/metadata.dart';
import '../backend/operating_system.dart';
import '../backend/suite.dart';
import '../backend/test.dart';
import '../backend/test_platform.dart';
-import '../util/async_thunk.dart';
import '../utils.dart';
/// A suite produced and consumed by the test runner that has runner-specific
@@ -21,8 +22,8 @@ import '../utils.dart';
/// eventually become its own package) is primarily for test code itself to use,
/// for which the [RunnerSuite] APIs don't make sense.
class RunnerSuite extends Suite {
- /// The thunk for running [close] exactly once.
- final _closeThunk = new AsyncThunk();
+ /// The memoizer for running [close] exactly once.
+ final _closeMemo = new AsyncMemoizer();
/// The function to call when the suite is closed.
final AsyncFunction _onClose;
@@ -52,7 +53,7 @@ class RunnerSuite extends Suite {
/// Closes the suite and releases any resources associated with it.
Future close() {
- return _closeThunk.run(() async {
+ return _closeMemo.runOnce(() async {
if (_onClose != null) await _onClose();
});
}
« no previous file with comments | « lib/src/runner/loader.dart ('k') | lib/src/util/async_thunk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698