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

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

Issue 1947773002: Fix all strong-mode warnings. (Closed) Base URL: git@github.com:dart-lang/barback@master
Patch Set: Code review changes Created 4 years, 7 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 | « lib/src/graph/static_asset_cascade.dart ('k') | lib/src/graph/transformer_classifier.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.graph.transform_node; 5 library barback.graph.transform_node;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:async/async.dart';
10
9 import '../asset/asset.dart'; 11 import '../asset/asset.dart';
10 import '../asset/asset_id.dart'; 12 import '../asset/asset_id.dart';
11 import '../asset/asset_node.dart'; 13 import '../asset/asset_node.dart';
12 import '../asset/asset_node_set.dart'; 14 import '../asset/asset_node_set.dart';
13 import '../errors.dart'; 15 import '../errors.dart';
14 import '../log.dart'; 16 import '../log.dart';
15 import '../transformer/aggregate_transform.dart'; 17 import '../transformer/aggregate_transform.dart';
16 import '../transformer/aggregate_transformer.dart'; 18 import '../transformer/aggregate_transformer.dart';
17 import '../transformer/declaring_aggregate_transform.dart'; 19 import '../transformer/declaring_aggregate_transform.dart';
18 import '../transformer/declaring_aggregate_transformer.dart'; 20 import '../transformer/declaring_aggregate_transformer.dart';
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 432
431 _state = _State.DECLARING; 433 _state = _State.DECLARING;
432 var controller = new DeclaringAggregateTransformController(this); 434 var controller = new DeclaringAggregateTransformController(this);
433 _declareController = controller; 435 _declareController = controller;
434 _streams.onLogPool.add(controller.onLog); 436 _streams.onLogPool.add(controller.onLog);
435 for (var primary in _primaries) { 437 for (var primary in _primaries) {
436 controller.addId(primary.id); 438 controller.addId(primary.id);
437 } 439 }
438 _maybeFinishDeclareController(); 440 _maybeFinishDeclareController();
439 441
440 syncFuture(() { 442 new Future.sync(() {
441 return (transformer as DeclaringAggregateTransformer) 443 return (transformer as DeclaringAggregateTransformer)
442 .declareOutputs(controller.transform); 444 .declareOutputs(controller.transform);
443 }).whenComplete(() { 445 }).whenComplete(() {
444 // Cancel the controller here even if `declareOutputs` wasn't interrupted. 446 // Cancel the controller here even if `declareOutputs` wasn't interrupted.
445 // Since the declaration is finished, we want to close out the 447 // Since the declaration is finished, we want to close out the
446 // controller's streams. 448 // controller's streams.
447 controller.cancel(); 449 controller.cancel();
448 _declareController = null; 450 _declareController = null;
449 }).then((_) { 451 }).then((_) {
450 if (_isRemoved) return; 452 if (_isRemoved) return;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 Future<bool> _runApply() { 623 Future<bool> _runApply() {
622 var controller = new AggregateTransformController(this); 624 var controller = new AggregateTransformController(this);
623 _applyController = controller; 625 _applyController = controller;
624 _streams.onLogPool.add(controller.onLog); 626 _streams.onLogPool.add(controller.onLog);
625 for (var primary in _primaries) { 627 for (var primary in _primaries) {
626 if (!primary.state.isAvailable) continue; 628 if (!primary.state.isAvailable) continue;
627 controller.addInput(primary.asset); 629 controller.addInput(primary.asset);
628 } 630 }
629 _maybeFinishApplyController(); 631 _maybeFinishApplyController();
630 632
631 return syncFuture(() { 633 return DelegatingFuture.typed(new Future.sync(() {
632 _timeInTransformer.reset(); 634 _timeInTransformer.reset();
633 _timeAwaitingInputs.reset(); 635 _timeAwaitingInputs.reset();
634 _timeInTransformer.start(); 636 _timeInTransformer.start();
635 return transformer.apply(controller.transform); 637 return transformer.apply(controller.transform);
636 }).whenComplete(() { 638 }).whenComplete(() {
637 _timeInTransformer.stop(); 639 _timeInTransformer.stop();
638 _timeAwaitingInputs.stop(); 640 _timeAwaitingInputs.stop();
639 641
640 // Cancel the controller here even if `apply` wasn't interrupted. Since 642 // Cancel the controller here even if `apply` wasn't interrupted. Since
641 // the apply is finished, we want to close out the controller's streams. 643 // the apply is finished, we want to close out the controller's streams.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return false; 683 return false;
682 }).catchError((error, stackTrace) { 684 }).catchError((error, stackTrace) {
683 // If the transform became dirty while processing, ignore any errors from 685 // If the transform became dirty while processing, ignore any errors from
684 // it. 686 // it.
685 if (_state == _State.NEEDS_APPLY || _isRemoved) return false; 687 if (_state == _State.NEEDS_APPLY || _isRemoved) return false;
686 688
687 // Catch all transformer errors and pipe them to the results stream. This 689 // Catch all transformer errors and pipe them to the results stream. This
688 // is so a broken transformer doesn't take down the whole graph. 690 // is so a broken transformer doesn't take down the whole graph.
689 phase.cascade.reportError(_wrapException(error, stackTrace)); 691 phase.cascade.reportError(_wrapException(error, stackTrace));
690 return true; 692 return true;
691 }); 693 }));
692 } 694 }
693 695
694 /// Handle the results of running [Transformer.apply]. 696 /// Handle the results of running [Transformer.apply].
695 /// 697 ///
696 /// [controller] should be the controller for the [AggegateTransform] passed 698 /// [controller] should be the controller for the [AggegateTransform] passed
697 /// to [AggregateTransformer.apply]. 699 /// to [AggregateTransformer.apply].
698 void _handleApplyResults(AggregateTransformController controller) { 700 void _handleApplyResults(AggregateTransformController controller) {
699 _consumedPrimaries = controller.consumedPrimaries; 701 _consumedPrimaries = controller.consumedPrimaries;
700 702
701 var newOutputs = controller.outputs; 703 var newOutputs = controller.outputs;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 /// declaring and [APPLYING] otherwise. If a primary input is added or 879 /// declaring and [APPLYING] otherwise. If a primary input is added or
878 /// removed, this will transition to [DECLARING]. 880 /// removed, this will transition to [DECLARING].
879 static const APPLIED = const _State._("applied"); 881 static const APPLIED = const _State._("applied");
880 882
881 final String name; 883 final String name;
882 884
883 const _State._(this.name); 885 const _State._(this.name);
884 886
885 String toString() => name; 887 String toString() => name;
886 } 888 }
OLDNEW
« no previous file with comments | « lib/src/graph/static_asset_cascade.dart ('k') | lib/src/graph/transformer_classifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698