edge->pool()->RetrieveReadyEdges(&ready_);
}
-void Plan::EdgeFinished(Edge* edge) {
+void Plan::EdgeFinished(Edge* edge, bool directly_wanted) {
map<Edge*, bool>::iterator e = want_.find(edge);
assert(e != want_.end());
if (e->second)
edge->outputs_ready_ = true;
// See if this job frees up any delayed jobs
- ResumeDelayedJobs(edge);
+ if (directly_wanted)
+ ResumeDelayedJobs(edge);
+ else
+ edge->pool()->RetrieveReadyEdges(&ready_);
// Check off any nodes we were waiting for with this edge.
for (vector<Node*>::iterator o = edge->outputs_.begin();
ScheduleWork(*oe);
} else {
// We do not need to build this edge, but we might need to build one of
- // its dependents. Make sure the pool schedules it before it's finished
- // otherwise the pool use count may be invalid.
- (*oe)->pool()->EdgeScheduled(**oe);
- EdgeFinished(*oe);
+ // its dependents.
+ EdgeFinished(*oe, want_e->second);
}
}
}
/// Mark an edge as done building. Used internally and by
/// tests.
- void EdgeFinished(Edge* edge);
+ void EdgeFinished(Edge* edge, bool directly_wanted = true);
/// Clean the given node during the build.
/// Return false on error.
/// |current_use_| is the total of the weights of the edges which are
/// currently scheduled in the Plan (i.e. the edges in Plan::ready_).
- /// This is generally <= to depth_. It can exceed it very briefly when the
- /// pool is notified about an edge that's about to be finished that will
- /// not actually be started. See Plan::NodeFinished().
int current_use_;
int depth_;