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

Unified Diff: lib/src/runner/browser/compiler_pool.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.dart ('k') | lib/src/runner/browser/server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/compiler_pool.dart
diff --git a/lib/src/runner/browser/compiler_pool.dart b/lib/src/runner/browser/compiler_pool.dart
index d881a9406f1dcd447d005d98b2e7ec758d7b74e8..edeefaec8a08c31a25ca142744d1c7f96a8d9252 100644
--- a/lib/src/runner/browser/compiler_pool.dart
+++ b/lib/src/runner/browser/compiler_pool.dart
@@ -8,10 +8,10 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
+import 'package:async/async.dart';
import 'package:path/path.dart' as p;
import 'package:pool/pool.dart';
-import '../../util/async_thunk.dart';
import '../../util/io.dart';
import '../load_exception.dart';
@@ -29,10 +29,10 @@ class CompilerPool {
final _processes = new Set<Process>();
/// Whether [close] has been called.
- bool get _closed => _closeThunk.hasRun;
+ bool get _closed => _closeMemo.hasRun;
- /// The thunk for running [close] exactly once.
- final _closeThunk = new AsyncThunk();
+ /// The memoizer for running [close] exactly once.
+ final _closeMemo = new AsyncMemoizer();
/// Creates a compiler pool that runs up to [concurrency] instances of
/// `dart2js` at once.
@@ -125,7 +125,7 @@ void main(_) {
/// be started. It returns a [Future] that completes once all the compilers
/// have been killed and all resources released.
Future close() {
- return _closeThunk.run(() async {
+ return _closeMemo.runOnce(() async {
await Future.wait(_processes.map((process) async {
process.kill();
await process.exitCode;
« no previous file with comments | « lib/src/runner.dart ('k') | lib/src/runner/browser/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698