diff options
author | Evan Martin <martine@danga.com> | 2013-04-05 16:05:03 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2013-04-05 16:05:03 (GMT) |
commit | 66d33f4c08b7570309440b09e0d06b204c02d6ef (patch) | |
tree | 8425e4e598cb3a5721aa3531653276cc21b3b666 /src/state.h | |
parent | c09bb1ae8b23d945b00fffb90ad94cf29f340735 (diff) | |
parent | f01d7f09fbdc2d7eca053d18f424d41729ca95c1 (diff) | |
download | Ninja-66d33f4c08b7570309440b09e0d06b204c02d6ef.zip Ninja-66d33f4c08b7570309440b09e0d06b204c02d6ef.tar.gz Ninja-66d33f4c08b7570309440b09e0d06b204c02d6ef.tar.bz2 |
version 1.2.0
Diffstat (limited to 'src/state.h')
-rw-r--r-- | src/state.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/state.h b/src/state.h index 918fe09..7e3aead 100644 --- a/src/state.h +++ b/src/state.h @@ -39,7 +39,7 @@ struct Rule; /// completes). struct Pool { explicit Pool(const string& name, int depth) - : name_(name), current_use_(0), depth_(depth) { } + : name_(name), current_use_(0), depth_(depth), delayed_(&WeightedEdgeCmp) { } // A depth of 0 is infinite bool is_valid() const { return depth_ >= 0; } @@ -66,9 +66,7 @@ struct Pool { /// Dump the Pool and its edges (useful for debugging). void Dump() const; -private: - int UnitsWaiting() { return delayed_.size(); } - + private: string name_; /// |current_use_| is the total of the weights of the edges which are @@ -76,7 +74,10 @@ private: int current_use_; int depth_; - deque<Edge*> delayed_; + static bool WeightedEdgeCmp(const Edge* a, const Edge* b); + + typedef set<Edge*,bool(*)(const Edge*, const Edge*)> DelayedEdges; + DelayedEdges delayed_; }; /// Global state (file status, loaded rules) for a single run. @@ -92,7 +93,7 @@ struct State { void AddPool(Pool* pool); Pool* LookupPool(const string& pool_name); - Edge* AddEdge(const Rule* rule, Pool* pool); + Edge* AddEdge(const Rule* rule); Node* GetNode(StringPiece path); Node* LookupNode(StringPiece path); |