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

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

Issue 189623006: Avoid O(n^2) behavior in Barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 Stream<BarbackException> get errors => _errorsController.stream; 57 Stream<BarbackException> get errors => _errorsController.stream;
58 final _errorsController = 58 final _errorsController =
59 new StreamController<BarbackException>.broadcast(sync: true); 59 new StreamController<BarbackException>.broadcast(sync: true);
60 60
61 /// A stream that emits an event whenever any transforms in this cascade logs 61 /// A stream that emits an event whenever any transforms in this cascade logs
62 /// an entry. 62 /// an entry.
63 Stream<LogEntry> get onLog => _onLogPool.stream; 63 Stream<LogEntry> get onLog => _onLogPool.stream;
64 final _onLogPool = new StreamPool<LogEntry>.broadcast(); 64 final _onLogPool = new StreamPool<LogEntry>.broadcast();
65 65
66 /// Whether [this] is dirty and still has more processing to do. 66 /// Whether [this] is dirty and still has more processing to do.
67 bool get isDirty => _phases.any((phase) => phase.isDirty); 67 bool get isDirty {
68 // Just check the last phase, since it will check all the previous phases
69 // itself.
70 return _phases.last.isDirty;
71 }
68 72
69 /// A stream that emits an event whenever [this] is no longer dirty. 73 /// A stream that emits an event whenever [this] is no longer dirty.
70 /// 74 ///
71 /// This is synchronous in order to guarantee that it will emit an event as 75 /// This is synchronous in order to guarantee that it will emit an event as
72 /// soon as [isDirty] flips from `true` to `false`. 76 /// soon as [isDirty] flips from `true` to `false`.
73 Stream get onDone => _onDoneController.stream; 77 Stream get onDone => _onDoneController.stream;
74 final _onDoneController = new StreamController.broadcast(sync: true); 78 final _onDoneController = new StreamController.broadcast(sync: true);
75 79
76 /// Returns all currently-available output assets from this cascade. 80 /// Returns all currently-available output assets from this cascade.
77 AssetSet get availableOutputs => 81 AssetSet get availableOutputs =>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 _onLogPool.add(phase.onLog); 205 _onLogPool.add(phase.onLog);
202 phase.onDone.listen((_) { 206 phase.onDone.listen((_) {
203 if (!isDirty) _onDoneController.add(null); 207 if (!isDirty) _onDoneController.add(null);
204 }); 208 });
205 209
206 _phases.add(phase); 210 _phases.add(phase);
207 } 211 }
208 212
209 String toString() => "cascade for $package"; 213 String toString() => "cascade for $package";
210 } 214 }
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