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

Side by Side Diff: pkg/barback/lib/src/asset_cascade.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 | « no previous file | pkg/barback/lib/src/group_runner.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.asset_cascade; 5 library barback.asset_cascade;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'asset.dart'; 9 import 'asset.dart';
10 import 'asset_id.dart'; 10 import 'asset_id.dart';
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 continue; 175 continue;
176 } 176 }
177 177
178 var phase = _phases.last.addPhase(); 178 var phase = _phases.last.addPhase();
179 _addPhase(phase); 179 _addPhase(phase);
180 phase.updateTransformers(transformers[i]); 180 phase.updateTransformers(transformers[i]);
181 } 181 }
182 182
183 if (transformers.length == 0) { 183 if (transformers.length == 0) {
184 _phases.last.updateTransformers([]); 184 _phases.last.updateTransformers([]);
185 } else if (transformers.length < _phases.length) { 185 } else {
186 _phases[transformers.length - 1].removeFollowing(); 186 for (var i = transformers.length; i < _phases.length; i++) {
187 _phases[i].remove();
188 }
187 _phases.removeRange(transformers.length, _phases.length); 189 _phases.removeRange(transformers.length, _phases.length);
188 } 190 }
189 } 191 }
190 192
191 /// Force all [LazyTransformer]s' transforms in this cascade to begin 193 /// Force all [LazyTransformer]s' transforms in this cascade to begin
192 /// producing concrete assets. 194 /// producing concrete assets.
193 void forceAllTransforms() { 195 void forceAllTransforms() {
194 for (var phase in _phases) { 196 for (var phase in _phases) {
195 phase.forceAllTransforms(); 197 phase.forceAllTransforms();
196 } 198 }
197 } 199 }
198 200
199 void reportError(BarbackException error) { 201 void reportError(BarbackException error) {
200 _errorsController.add(error); 202 _errorsController.add(error);
201 } 203 }
202 204
203 /// Add [phase] to the end of [_phases] and watch its streams. 205 /// Add [phase] to the end of [_phases] and watch its streams.
204 void _addPhase(Phase phase) { 206 void _addPhase(Phase phase) {
205 _onLogPool.add(phase.onLog); 207 _onLogPool.add(phase.onLog);
206 phase.onDone.listen((_) { 208 phase.onDone.listen((_) {
207 if (!isDirty) _onDoneController.add(null); 209 if (!isDirty) _onDoneController.add(null);
208 }); 210 });
209 211
210 _phases.add(phase); 212 _phases.add(phase);
211 } 213 }
212 214
213 String toString() => "cascade for $package"; 215 String toString() => "cascade for $package";
214 } 216 }
OLDNEW
« no previous file with comments | « no previous file | pkg/barback/lib/src/group_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698