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

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

Issue 19402003: Rename several classes in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 5 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/package_provider.dart ('k') | pkg/barback/lib/src/transform_node.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; 5 library barback.phase;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'asset.dart'; 9 import 'asset.dart';
10 import 'asset_graph.dart'; 10 import 'asset_cascade.dart';
11 import 'asset_id.dart'; 11 import 'asset_id.dart';
12 import 'asset_node.dart'; 12 import 'asset_node.dart';
13 import 'asset_set.dart'; 13 import 'asset_set.dart';
14 import 'errors.dart'; 14 import 'errors.dart';
15 import 'transform_node.dart'; 15 import 'transform_node.dart';
16 import 'transformer.dart'; 16 import 'transformer.dart';
17 17
18 /// One phase in the ordered series of transformations in an [AssetGraph]. 18 /// One phase in the ordered series of transformations in an [AssetCascade].
19 /// 19 ///
20 /// Each phase can access outputs from previous phases and can in turn pass 20 /// Each phase can access outputs from previous phases and can in turn pass
21 /// outputs to later phases. Phases are processed strictly serially. All 21 /// outputs to later phases. Phases are processed strictly serially. All
22 /// transforms in a phase will be complete before moving on to the next phase. 22 /// transforms in a phase will be complete before moving on to the next phase.
23 /// Within a single phase, all transforms will be run in parallel. 23 /// Within a single phase, all transforms will be run in parallel.
24 /// 24 ///
25 /// Building can be interrupted between phases. For example, a source is added 25 /// Building can be interrupted between phases. For example, a source is added
26 /// which starts the background process. Sometime during, say, phase 2 (which 26 /// which starts the background process. Sometime during, say, phase 2 (which
27 /// is running asynchronously) that source is modified. When the process queue 27 /// is running asynchronously) that source is modified. When the process queue
28 /// goes to advance to phase 3, it will see that modification and start the 28 /// goes to advance to phase 3, it will see that modification and start the
29 /// waterfall from the beginning again. 29 /// waterfall from the beginning again.
30 class Phase { 30 class Phase {
31 /// The graph that owns this phase. 31 /// The cascade that owns this phase.
32 final AssetGraph graph; 32 final AssetCascade cascade;
33 33
34 /// This phase's position relative to the other phases. Zero-based. 34 /// This phase's position relative to the other phases. Zero-based.
35 final int _index; 35 final int _index;
36 36
37 /// The transformers that can access [inputs]. 37 /// The transformers that can access [inputs].
38 /// 38 ///
39 /// Their outputs will be available to the next phase. 39 /// Their outputs will be available to the next phase.
40 final List<Transformer> _transformers; 40 final List<Transformer> _transformers;
41 41
42 /// The inputs that are available for transforms in this phase to consume. 42 /// The inputs that are available for transforms in this phase to consume.
(...skipping 14 matching lines...) Expand all
57 /// 57 ///
58 /// When we process, we'll check these to see if we can hang new transforms 58 /// When we process, we'll check these to see if we can hang new transforms
59 /// off them. 59 /// off them.
60 final _newInputs = new Set<AssetNode>(); 60 final _newInputs = new Set<AssetNode>();
61 61
62 /// The phase after this one. 62 /// The phase after this one.
63 /// 63 ///
64 /// Outputs from this phase will be passed to it. 64 /// Outputs from this phase will be passed to it.
65 final Phase _next; 65 final Phase _next;
66 66
67 Phase(this.graph, this._index, this._transformers, this._next); 67 Phase(this.cascade, this._index, this._transformers, this._next);
68 68
69 /// Updates the phase's inputs with [updated] and removes [removed]. 69 /// Updates the phase's inputs with [updated] and removes [removed].
70 /// 70 ///
71 /// This marks any affected [transforms] as dirty or discards them if their 71 /// This marks any affected [transforms] as dirty or discards them if their
72 /// inputs are removed. 72 /// inputs are removed.
73 void updateInputs(AssetSet updated, Set<AssetId> removed) { 73 void updateInputs(AssetSet updated, Set<AssetId> removed) {
74 // Remove any nodes that are no longer being output. Handle removals first 74 // Remove any nodes that are no longer being output. Handle removals first
75 // in case there are assets that were removed by one transform but updated 75 // in case there are assets that were removed by one transform but updated
76 // by another. In that case, the update should win. 76 // by another. In that case, the update should win.
77 for (var id in removed) { 77 for (var id in removed) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Track any assets no longer output by this transform. We don't 170 // Track any assets no longer output by this transform. We don't
171 // handle the case where *another* transform generates the asset 171 // handle the case where *another* transform generates the asset
172 // no longer generated by this one. updateInputs() handles that. 172 // no longer generated by this one. updateInputs() handles that.
173 removed.addAll(outputs.removed); 173 removed.addAll(outputs.removed);
174 } 174 }
175 175
176 // Report any collisions in deterministic order. 176 // Report any collisions in deterministic order.
177 collisions = collisions.toList(); 177 collisions = collisions.toList();
178 collisions.sort((a, b) => a.toString().compareTo(b.toString())); 178 collisions.sort((a, b) => a.toString().compareTo(b.toString()));
179 for (var collision in collisions) { 179 for (var collision in collisions) {
180 graph.reportError(new AssetCollisionException(collision)); 180 cascade.reportError(new AssetCollisionException(collision));
181 // TODO(rnystrom): Define what happens after a collision occurs. 181 // TODO(rnystrom): Define what happens after a collision occurs.
182 } 182 }
183 183
184 // Pass the outputs to the next phase. 184 // Pass the outputs to the next phase.
185 _next.updateInputs(updated, removed); 185 _next.updateInputs(updated, removed);
186 }); 186 });
187 } 187 }
188 } 188 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/package_provider.dart ('k') | pkg/barback/lib/src/transform_node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698