Chromium Code Reviews

Unified Diff: lib/src/runner/browser/dartium.dart

Issue 1414793015: Use the async package's CancelableOperation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 1 month 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 | « lib/src/runner/browser/browser_manager.dart ('k') | lib/src/runner/environment.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/dartium.dart
diff --git a/lib/src/runner/browser/dartium.dart b/lib/src/runner/browser/dartium.dart
index b7ae86f68c0bf7f2a309b93e5eb96cafbc23eb7e..b89983ecb0714ffa15c5ff2b1499edf1a0b6140d 100644
--- a/lib/src/runner/browser/dartium.dart
+++ b/lib/src/runner/browser/dartium.dart
@@ -11,7 +11,6 @@ import 'dart:io';
import 'package:async/async.dart';
import 'package:path/path.dart' as p;
-import '../../util/cancelable_future.dart';
import '../../util/io.dart';
import '../../utils.dart';
import 'browser.dart';
@@ -121,7 +120,7 @@ class Dartium extends Browser {
return match == null ? null : Uri.parse(match[1]);
}).where((line) => line != null));
- var futures = [
+ var operations = [
urlQueue.next,
urlQueue.next,
urlQueue.next
@@ -133,19 +132,19 @@ class Dartium extends Browser {
/// check whether it's actually connected to an isolate, indicating that
/// it's the observatory for the main page. Once we find the one that is, we
/// cancel the other requests and return it.
- return inCompletionOrder(futures)
+ return inCompletionOrder(operations)
.firstWhere((url) => url != null, defaultValue: () => null);
}
/// If the URL returned by [future] corresponds to the correct Observatory
/// instance, returns it. Otherwise, returns `null`.
///
- /// If the returned future is canceled before it fires, the WebSocket
+ /// If the returned operation is canceled before it fires, the WebSocket
/// connection with the given Observatory will be closed immediately.
- static CancelableFuture<Uri> _checkObservatoryUrl(Future<Uri> future) {
+ static CancelableOperation<Uri> _checkObservatoryUrl(Future<Uri> future) {
var webSocket;
var canceled = false;
- var completer = new CancelableCompleter(() {
+ var completer = new CancelableCompleter(onCancel: () {
canceled = true;
if (webSocket != null) webSocket.close();
});
@@ -248,6 +247,6 @@ class Dartium extends Browser {
if (!completer.isCompleted) completer.completeError(error, stackTrace);
});
- return completer.future;
+ return completer.operation;
}
}
« no previous file with comments | « lib/src/runner/browser/browser_manager.dart ('k') | lib/src/runner/environment.dart » ('j') | no next file with comments »

Powered by Google App Engine