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

Side by Side Diff: pkg/barback/lib/src/phase_input.dart

Issue 200473006: Make barback's onAsset streams broadcast rather than single-subscriber. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/phase.dart ('k') | pkg/barback/lib/src/phase_output.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library barback.phase_input; 5 library barback.phase_input;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'asset_forwarder.dart'; 9 import 'asset_forwarder.dart';
10 import 'asset_node.dart'; 10 import 'asset_node.dart';
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 /// This is synchronous in order to guarantee that it will emit an event as 43 /// This is synchronous in order to guarantee that it will emit an event as
44 /// soon as [isDirty] flips from `true` to `false`. 44 /// soon as [isDirty] flips from `true` to `false`.
45 Stream get onDone => _onDoneController.stream; 45 Stream get onDone => _onDoneController.stream;
46 final _onDoneController = new StreamController.broadcast(sync: true); 46 final _onDoneController = new StreamController.broadcast(sync: true);
47 47
48 /// A stream that emits any new assets emitted by [this]. 48 /// A stream that emits any new assets emitted by [this].
49 /// 49 ///
50 /// Assets are emitted synchronously to ensure that any changes are thoroughly 50 /// Assets are emitted synchronously to ensure that any changes are thoroughly
51 /// propagated as soon as they occur. 51 /// propagated as soon as they occur.
52 Stream<AssetNode> get onAsset => _onAssetPool.stream; 52 Stream<AssetNode> get onAsset => _onAssetPool.stream;
53 final _onAssetPool = new StreamPool<AssetNode>(); 53 final _onAssetPool = new StreamPool<AssetNode>.broadcast();
54 54
55 /// Whether [this] is dirty and still has more processing to do. 55 /// Whether [this] is dirty and still has more processing to do.
56 bool get isDirty => _transforms.any((transform) => transform.isDirty); 56 bool get isDirty => _transforms.any((transform) => transform.isDirty);
57 57
58 /// A stream that emits an event whenever any transforms that use [input] as 58 /// A stream that emits an event whenever any transforms that use [input] as
59 /// their primary input log an entry. 59 /// their primary input log an entry.
60 Stream<LogEntry> get onLog => _onLogPool.stream; 60 Stream<LogEntry> get onLog => _onLogPool.stream;
61 final _onLogPool = new StreamPool<LogEntry>.broadcast(); 61 final _onLogPool = new StreamPool<LogEntry>.broadcast();
62 62
63 PhaseInput(this._phase, AssetNode input, this._location) 63 PhaseInput(this._phase, AssetNode input, this._location)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 /// Force all [LazyTransformer]s' transforms in this input to begin producing 102 /// Force all [LazyTransformer]s' transforms in this input to begin producing
103 /// concrete assets. 103 /// concrete assets.
104 void forceAllTransforms() { 104 void forceAllTransforms() {
105 for (var transform in _transforms) { 105 for (var transform in _transforms) {
106 transform.force(); 106 transform.force();
107 } 107 }
108 } 108 }
109 109
110 String toString() => "phase input in $_location for $input"; 110 String toString() => "phase input in $_location for $input";
111 } 111 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/phase.dart ('k') | pkg/barback/lib/src/phase_output.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698