diff options
author | Robert Iannucci <robbie@rail.com> | 2012-10-04 00:25:23 (GMT) |
---|---|---|
committer | Robert A Iannucci Jr <iannucci@chromium.org> | 2012-11-09 04:25:39 (GMT) |
commit | 307f0bbd13d881cc2883c3e5f7f385b8f7914480 (patch) | |
tree | 2950aeabc8412b3662d4abcf4387bffae15eafa2 /src/state.cc | |
parent | aca4ec54656057e58ca7a9ae5de7f94c869b2ccb (diff) | |
download | Ninja-307f0bbd13d881cc2883c3e5f7f385b8f7914480.zip Ninja-307f0bbd13d881cc2883c3e5f7f385b8f7914480.tar.gz Ninja-307f0bbd13d881cc2883c3e5f7f385b8f7914480.tar.bz2 |
and some basic implementation
Diffstat (limited to 'src/state.cc')
-rw-r--r-- | src/state.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/state.cc b/src/state.cc index e8e6dc3..b34b938 100644 --- a/src/state.cc +++ b/src/state.cc @@ -22,6 +22,33 @@ #include "metrics.h" #include "util.h" + +void Pool::EdgeScheduled(const Edge& edge) { + if (depth_ != 0) + current_use_ += edge.weight(); +} + +void Pool::EdgeFinished(const Edge& edge) { + if (depth_ != 0) + current_use_ -= edge.weight(); +} + +void Pool::DelayEdge(Edge* edge) { + assert(depth_ != 0); + delayed_.push(edge); +} + +void Pool::RetrieveReadyEdges(set<Edge*>* ready_queue) { + while(!delayed_.empty()) { + Edge* edge = delayed_.front(); + if(current_use_ + edge->weight() > depth_) + break; + delayed_.pop(); + ready_queue->insert(edge); + EdgeScheduled(*edge); + } +} + Pool State::kDefaultPool("", 0); const Rule State::kPhonyRule("phony"); |