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

Side by Side Diff: lib/src/graph/transform_node.dart

Issue 1262483002: Fix a deadlock. (Closed) Base URL: git@github.com:dart-lang/barback@master
Patch Set: Created 5 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
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('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.graph.transform_node; 5 library barback.graph.transform_node;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import '../asset/asset.dart'; 9 import '../asset/asset.dart';
10 import '../asset/asset_id.dart'; 10 import '../asset/asset_id.dart';
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // node in the graph. It will be re-created by its 327 // node in the graph. It will be re-created by its
328 // [TransformerClassifier] if a new input with [key] is added. 328 // [TransformerClassifier] if a new input with [key] is added.
329 remove(); 329 remove();
330 return; 330 return;
331 } 331 }
332 332
333 // Any change to the number of primary inputs requires that we re-run the 333 // Any change to the number of primary inputs requires that we re-run the
334 // transformation. 334 // transformation.
335 _restartRun(); 335 _restartRun();
336 } else if (input.state.isAvailable) { 336 } else if (input.state.isAvailable) {
337 if (_state == _State.DECLARED) {
338 // If we're passing through this input and its contents don't matter,
339 // update the pass-through controller.
340 var controller = _passThroughControllers[input.id];
341 if (controller != null) controller.setAvailable(input.asset);
342 }
343
337 if (_state == _State.DECLARED && _canRunDeclaringEagerly) { 344 if (_state == _State.DECLARED && _canRunDeclaringEagerly) {
338 // If [this] is fully declared but hasn't started applying, this input 345 // If [this] is fully declared but hasn't started applying, this input
339 // becoming available may mean that all inputs are available, in which 346 // becoming available may mean that all inputs are available, in which
340 // case we can run apply eagerly. 347 // case we can run apply eagerly.
341 _apply(); 348 _apply();
342 return; 349 return;
343 } 350 }
344 351
345 // If we're not actively passing concrete assets to the transformer, the 352 // If we're not actively passing concrete assets to the transformer, the
346 // distinction between a dirty asset and an available one isn't relevant. 353 // distinction between a dirty asset and an available one isn't relevant.
347 if (_state != _State.APPLYING) return; 354 if (_state != _State.APPLYING) return;
348 355
349 if (_applyController.isDone) { 356 if (_applyController.isDone) {
350 // If we get a new asset after we've closed the asset stream, we need to 357 // If we get a new asset after we've closed the asset stream, we need to
351 // re-run declare and then apply. 358 // re-run declare and then apply.
352 _restartRun(); 359 _restartRun();
353 } else { 360 } else {
354 // If the new asset comes before the asset stream is done, we can just 361 // If the new asset comes before the asset stream is done, we can just
355 // pass it to the stream. 362 // pass it to the stream.
356 _applyController.addInput(input.asset); 363 _applyController.addInput(input.asset);
357 _maybeFinishApplyController(); 364 _maybeFinishApplyController();
358 } 365 }
359 } else { 366 } else {
360 if (_forced) input.force(); 367 if (_forced) input.force();
368
369 var controller = _passThroughControllers[input.id];
370 if (controller != null) controller.setDirty();
371
361 if (_state == _State.APPLYING && !_applyController.addedId(input.id) && 372 if (_state == _State.APPLYING && !_applyController.addedId(input.id) &&
362 (_forced || !input.isLazy)) { 373 (_forced || !input.isLazy)) {
363 // If the input hasn't yet been added to the transform's input stream, 374 // If the input hasn't yet been added to the transform's input stream,
364 // there's no need to consider the transformation dirty. However, if the 375 // there's no need to consider the transformation dirty. However, if the
365 // input is lazy and we're running eagerly, we need to restart the 376 // input is lazy and we're running eagerly, we need to restart the
366 // transformation. 377 // transformation.
367 return; 378 return;
368 } 379 }
369 _dirty(); 380 _dirty();
370 } 381 }
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 /// declaring and [APPLYING] otherwise. If a primary input is added or 877 /// declaring and [APPLYING] otherwise. If a primary input is added or
867 /// removed, this will transition to [DECLARING]. 878 /// removed, this will transition to [DECLARING].
868 static const APPLIED = const _State._("applied"); 879 static const APPLIED = const _State._("applied");
869 880
870 final String name; 881 final String name;
871 882
872 const _State._(this.name); 883 const _State._(this.name);
873 884
874 String toString() => name; 885 String toString() => name;
875 } 886 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698