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

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

Issue 22914031: Support actually removing phases in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/asset_cascade.dart ('k') | no next file » | 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; 5 library barback.phase;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'asset_cascade.dart'; 10 import 'asset_cascade.dart';
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 output.removeListeners(); 146 output.removeListeners();
147 147
148 // Removing [output]'s listeners will cause it to be removed from 148 // Removing [output]'s listeners will cause it to be removed from
149 // [_outputs], so we have to put it back. 149 // [_outputs], so we have to put it back.
150 _outputs[output.output.id] = output; 150 _outputs[output.output.id] = output;
151 _next.addInput(output.output); 151 _next.addInput(output.output);
152 } 152 }
153 return _next; 153 return _next;
154 } 154 }
155 155
156 /// Mark this phase as removed.
157 ///
158 /// This will remove all the phase's outputs and all following phases.
159 void remove() {
160 removeFollowing();
161 for (var input in _inputs.values.toList()) {
162 input.remove();
163 }
164 _onDirtyPool.close();
165 }
166
167 /// Remove all phases after this one.
168 Phase removeFollowing() {
169 if (_next == null) return;
170 _next.remove();
171 _next = null;
172 }
173
156 /// Processes this phase. 174 /// Processes this phase.
157 /// 175 ///
158 /// Returns a future that completes when processing is done. If there is 176 /// Returns a future that completes when processing is done. If there is
159 /// nothing to process, returns `null`. 177 /// nothing to process, returns `null`.
160 Future process() { 178 Future process() {
161 if (!_inputs.values.any((input) => input.isDirty)) return null; 179 if (!_inputs.values.any((input) => input.isDirty)) return null;
162 180
163 var outputIds = new Set<AssetId>(); 181 var outputIds = new Set<AssetId>();
164 return Future.wait(_inputs.values.map((input) { 182 return Future.wait(_inputs.values.map((input) {
165 if (!input.isDirty) return new Future.value(new Set()); 183 if (!input.isDirty) return new Future.value(new Set());
(...skipping 17 matching lines...) Expand all
183 for (var id in outputIds) { 201 for (var id in outputIds) {
184 // It's possible the output was removed before other transforms in this 202 // It's possible the output was removed before other transforms in this
185 // phase finished. 203 // phase finished.
186 if (!_outputs.containsKey(id)) continue; 204 if (!_outputs.containsKey(id)) continue;
187 var exception = _outputs[id].collisionException; 205 var exception = _outputs[id].collisionException;
188 if (exception != null) cascade.reportError(exception); 206 if (exception != null) cascade.reportError(exception);
189 } 207 }
190 }); 208 });
191 } 209 }
192 } 210 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/asset_cascade.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698