Small constifications (#1647)

* build: constify EdgeWanted()
* build: constify a bit of CommandRunner
* graph: constify functions of struct Edge

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
diff --git a/src/build.cc b/src/build.cc
index 8ef88b5..931fb95 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -47,7 +47,7 @@
   virtual ~DryRunCommandRunner() {}
 
   // Overridden from CommandRunner:
-  virtual bool CanRunMore();
+  virtual bool CanRunMore() const;
   virtual bool StartCommand(Edge* edge);
   virtual bool WaitForCommand(Result* result);
 
@@ -55,7 +55,7 @@
   queue<Edge*> finished_;
 };
 
-bool DryRunCommandRunner::CanRunMore() {
+bool DryRunCommandRunner::CanRunMore() const {
   return true;
 }
 
@@ -373,7 +373,7 @@
   return true;
 }
 
-void Plan::EdgeWanted(Edge* edge) {
+void Plan::EdgeWanted(const Edge* edge) {
   ++wanted_edges_;
   if (!edge->is_phony())
     ++command_edges_;
@@ -668,7 +668,7 @@
 struct RealCommandRunner : public CommandRunner {
   explicit RealCommandRunner(const BuildConfig& config) : config_(config) {}
   virtual ~RealCommandRunner() {}
-  virtual bool CanRunMore();
+  virtual bool CanRunMore() const;
   virtual bool StartCommand(Edge* edge);
   virtual bool WaitForCommand(Result* result);
   virtual vector<Edge*> GetActiveEdges();
@@ -691,7 +691,7 @@
   subprocs_.Clear();
 }
 
-bool RealCommandRunner::CanRunMore() {
+bool RealCommandRunner::CanRunMore() const {
   size_t subproc_number =
       subprocs_.running_.size() + subprocs_.finished_.size();
   return (int)subproc_number < config_.parallelism
diff --git a/src/build.h b/src/build.h
index ab59f0c..410d4a5 100644
--- a/src/build.h
+++ b/src/build.h
@@ -108,7 +108,7 @@
     kWantToFinish
   };
 
-  void EdgeWanted(Edge* edge);
+  void EdgeWanted(const Edge* edge);
   bool EdgeMaybeReady(map<Edge*, Want>::iterator want_e, string* err);
 
   /// Submits a ready edge as a candidate for execution.
@@ -138,7 +138,7 @@
 /// RealCommandRunner is an implementation that actually runs commands.
 struct CommandRunner {
   virtual ~CommandRunner() {}
-  virtual bool CanRunMore() = 0;
+  virtual bool CanRunMore() const = 0;
   virtual bool StartCommand(Edge* edge) = 0;
 
   /// The result of waiting for a command.
diff --git a/src/build_test.cc b/src/build_test.cc
index b5dbc6c..ddf8574 100644
--- a/src/build_test.cc
+++ b/src/build_test.cc
@@ -470,7 +470,7 @@
       max_active_edges_(1), fs_(fs) {}
 
   // CommandRunner impl
-  virtual bool CanRunMore();
+  virtual bool CanRunMore() const;
   virtual bool StartCommand(Edge* edge);
   virtual bool WaitForCommand(Result* result);
   virtual vector<Edge*> GetActiveEdges();
@@ -569,7 +569,7 @@
   builder.command_runner_.release();
 }
 
-bool FakeCommandRunner::CanRunMore() {
+bool FakeCommandRunner::CanRunMore() const {
   return active_edges_.size() < max_active_edges_;
 }
 
diff --git a/src/graph.cc b/src/graph.cc
index 376b911..b8b870b 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -406,16 +406,16 @@
   return env.LookupVariable(key);
 }
 
-bool Edge::GetBindingBool(const string& key) {
+bool Edge::GetBindingBool(const string& key) const {
   return !GetBinding(key).empty();
 }
 
-string Edge::GetUnescapedDepfile() {
+string Edge::GetUnescapedDepfile() const {
   EdgeEnv env(this, EdgeEnv::kDoNotEscape);
   return env.LookupVariable("depfile");
 }
 
-string Edge::GetUnescapedDyndep() {
+string Edge::GetUnescapedDyndep() const {
   EdgeEnv env(this, EdgeEnv::kDoNotEscape);
   return env.LookupVariable("dyndep");
 }
diff --git a/src/graph.h b/src/graph.h
index 6122837..19b25c4 100644
--- a/src/graph.h
+++ b/src/graph.h
@@ -159,12 +159,12 @@
 
   /// Returns the shell-escaped value of |key|.
   std::string GetBinding(const string& key) const;
-  bool GetBindingBool(const string& key);
+  bool GetBindingBool(const string& key) const;
 
   /// Like GetBinding("depfile"), but without shell escaping.
-  string GetUnescapedDepfile();
+  string GetUnescapedDepfile() const;
   /// Like GetBinding("dyndep"), but without shell escaping.
-  string GetUnescapedDyndep();
+  string GetUnescapedDyndep() const;
   /// Like GetBinding("rspfile"), but without shell escaping.
   std::string GetUnescapedRspfile() const;