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

Unified Diff: mojo/public/dart/third_party/barback/lib/src/graph/node_status.dart

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/dart/third_party/barback/lib/src/graph/node_status.dart
diff --git a/mojo/public/dart/third_party/barback/lib/src/graph/node_status.dart b/mojo/public/dart/third_party/barback/lib/src/graph/node_status.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a42e523f4ffa0cdf073c9a86c16f736173adb4fd
--- /dev/null
+++ b/mojo/public/dart/third_party/barback/lib/src/graph/node_status.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library barback.graph.node_status;
+
+/// The status of a node in barback's package graph.
+///
+/// A node has three possible statuses: [IDLE], [MATERIALIZING], and [RUNNING].
+/// These are ordered from least dirty to most dirty; the [dirtier] and
+/// [dirtiest] functions make use of this ordering.
+class NodeStatus {
+ /// The node has finished its work and won't do anything else until external
+ /// input causes it to.
+ ///
+ /// For deferred nodes, this may indicate that they're finished declaring
+ /// their outputs and waiting to be forced.
+ static const IDLE = const NodeStatus("idle");
+
+ /// The node has declared its outputs but their concrete values are still
+ /// being generated.
+ ///
+ /// This is only meaningful for nodes that are or contain declaring
+ /// transformers. Note that a lazy transformer that's declared its outputs but
+ /// isn't actively working to generate them is considered [IDLE], not
+ /// [MATERIALIZING].
+ static const MATERIALIZING = const NodeStatus("materializing");
+
+ /// The node is actively working on declaring or generating its outputs.
+ ///
+ /// Declaring transformers are only considered dirty until they're finished
+ /// declaring their outputs; past that point, they're always either
+ /// [MATERIALIZING] or [IDLE]. Non-declaring transformers, by contrast, are
+ /// always either [RUNNING] or [IDLE].
+ static const RUNNING = const NodeStatus("running");
+
+ final String _name;
+
+ /// Returns the dirtiest status in [statuses].
+ static NodeStatus dirtiest(Iterable<NodeStatus> statuses) =>
+ statuses.fold(NodeStatus.IDLE,
+ (status1, status2) => status1.dirtier(status2));
+
+ const NodeStatus(this._name);
+
+ String toString() => _name;
+
+ /// Returns [this] or [other], whichever is dirtier.
+ NodeStatus dirtier(NodeStatus other) {
+ if (this == RUNNING || other == RUNNING) return RUNNING;
+ if (this == MATERIALIZING || other == MATERIALIZING) return MATERIALIZING;
+ return IDLE;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698