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

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

Issue 26413003: Make PhaseOutput emit a new AssetNode whenever it changes outputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change Created 7 years, 2 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/phase.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_node; 5 library barback.asset_node;
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 /// It's an error to mark an already-available node as available. It should be 185 /// It's an error to mark an already-available node as available. It should be
186 /// marked as dirty first. 186 /// marked as dirty first.
187 void setAvailable(Asset asset) { 187 void setAvailable(Asset asset) {
188 assert(asset.id == node.id); 188 assert(asset.id == node.id);
189 assert(node._state != AssetState.REMOVED); 189 assert(node._state != AssetState.REMOVED);
190 assert(node._state != AssetState.AVAILABLE); 190 assert(node._state != AssetState.AVAILABLE);
191 node._state = AssetState.AVAILABLE; 191 node._state = AssetState.AVAILABLE;
192 node._asset = asset; 192 node._asset = asset;
193 node._stateChangeController.add(AssetState.AVAILABLE); 193 node._stateChangeController.add(AssetState.AVAILABLE);
194 } 194 }
195
196 /// Sets the origin of [node] to [origin] and the transform to
197 /// `origin.transform`.
198 void setOrigin(AssetNode origin) {
199 node._origin = origin;
200 node._transform = origin.transform;
201 }
202 } 195 }
203 196
204 // TODO(nweiz): add an error state. 197 // TODO(nweiz): add an error state.
205 /// An enum of states that an [AssetNode] can be in. 198 /// An enum of states that an [AssetNode] can be in.
206 class AssetState { 199 class AssetState {
207 /// The node has a concrete asset loaded, available, and up-to-date. The asset 200 /// The node has a concrete asset loaded, available, and up-to-date. The asset
208 /// is accessible via [AssetNode.asset]. An asset can only be marked available 201 /// is accessible via [AssetNode.asset]. An asset can only be marked available
209 /// again from the [AssetState.DIRTY] state. 202 /// again from the [AssetState.DIRTY] state.
210 static final AVAILABLE = const AssetState._("available"); 203 static final AVAILABLE = const AssetState._("available");
211 204
(...skipping 13 matching lines...) Expand all
225 218
226 /// Whether this state is [AssetState.DIRTY]. 219 /// Whether this state is [AssetState.DIRTY].
227 bool get isDirty => this == AssetState.DIRTY; 220 bool get isDirty => this == AssetState.DIRTY;
228 221
229 final String name; 222 final String name;
230 223
231 const AssetState._(this.name); 224 const AssetState._(this.name);
232 225
233 String toString() => name; 226 String toString() => name;
234 } 227 }
OLDNEW
« no previous file with comments | « no previous file | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698