Index: tools/testing/dart/dependency_graph.dart |
diff --git a/tools/testing/dart/dependency_graph.dart b/tools/testing/dart/dependency_graph.dart |
index f7e43f800fb9bfdcff2431dc92e11e09fda82c9d..688987868366c0d5aafd4409db9f98cf64d7908b 100644 |
--- a/tools/testing/dart/dependency_graph.dart |
+++ b/tools/testing/dart/dependency_graph.dart |
@@ -28,15 +28,18 @@ import 'utils.dart'; |
*/ |
class Graph { |
final _nodes = new Set<Node>(); |
- final _eventController = new StreamController<GraphEvent>(); |
- final _stateCounts = new Map<NodeState, int>(); |
- var _eventStream; |
+ final StreamController<GraphEvent> _eventController; |
+ final _stateCounts = <NodeState, int>{}; |
+ final Stream<GraphEvent> _eventStream; |
bool _isSealed = false; |
- Graph() { |
- _eventStream = _eventController.stream.asBroadcastStream(); |
+ factory Graph() { |
+ var controller = new StreamController<GraphEvent>(); |
+ return new Graph._(controller, controller.stream.asBroadcastStream()); |
} |
+ Graph._(this._eventController, this._eventStream); |
+ |
Iterable<Node> get nodes => _nodes; |
Stream<GraphEvent> get events => _eventStream; |
bool get isSealed => _isSealed; |
@@ -88,7 +91,7 @@ class Graph { |
_emitEvent(new StateChangedEvent(node, fromState, newState)); |
} |
- _emitEvent(GraphEvent event) { |
+ void _emitEvent(GraphEvent event) { |
// We emit events asynchronously so the graph can be build up in small |
// batches and the events are delivered in small batches. |
Timer.run(() { |