diff options
author | Thiago Farina <tfarina@chromium.org> | 2012-10-02 01:13:39 (GMT) |
---|---|---|
committer | Thiago Farina <tfarina@chromium.org> | 2012-10-02 01:17:22 (GMT) |
commit | 5cd579de4e0aff88f23b580610214ae17ebda330 (patch) | |
tree | ef383d1181d4620c6d0e830e465312263882ccf8 /src/build.cc | |
parent | 246f017d7b261e456c9268817a6f6dc2dc3d20bf (diff) | |
download | Ninja-5cd579de4e0aff88f23b580610214ae17ebda330.zip Ninja-5cd579de4e0aff88f23b580610214ae17ebda330.tar.gz Ninja-5cd579de4e0aff88f23b580610214ae17ebda330.tar.bz2 |
Move DryRunCommandRunner into a unnamed namespace.
No functional change.
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/src/build.cc b/src/build.cc index a2f2720..9877db8 100644 --- a/src/build.cc +++ b/src/build.cc @@ -38,6 +38,45 @@ #include "subprocess.h" #include "util.h" +namespace { + +/// A CommandRunner that doesn't actually run the commands. +class DryRunCommandRunner : public CommandRunner { + public: + virtual ~DryRunCommandRunner() {} + + // Overridden from CommandRunner: + virtual bool CanRunMore(); + virtual bool StartCommand(Edge* edge); + virtual Edge* WaitForCommand(ExitStatus* status, string* /* output */); + + private: + queue<Edge*> finished_; +}; + +bool DryRunCommandRunner::CanRunMore() { + return true; +} + +bool DryRunCommandRunner::StartCommand(Edge* edge) { + finished_.push(edge); + return true; +} + +Edge* DryRunCommandRunner::WaitForCommand(ExitStatus* status, + string* /*output*/) { + if (finished_.empty()) { + *status = ExitFailure; + return NULL; + } + *status = ExitSuccess; + Edge* edge = finished_.front(); + finished_.pop(); + return edge; +} + +} // namespace + BuildStatus::BuildStatus(const BuildConfig& config) : config_(config), start_time_millis_(GetTimeMillis()), @@ -528,30 +567,6 @@ Edge* RealCommandRunner::WaitForCommand(ExitStatus* status, string* output) { return edge; } -/// A CommandRunner that doesn't actually run the commands. -struct DryRunCommandRunner : public CommandRunner { - virtual ~DryRunCommandRunner() {} - virtual bool CanRunMore() { - return true; - } - virtual bool StartCommand(Edge* edge) { - finished_.push(edge); - return true; - } - virtual Edge* WaitForCommand(ExitStatus* status, string* /* output */) { - if (finished_.empty()) { - *status = ExitFailure; - return NULL; - } - *status = ExitSuccess; - Edge* edge = finished_.front(); - finished_.pop(); - return edge; - } - - queue<Edge*> finished_; -}; - Builder::Builder(State* state, const BuildConfig& config, BuildLog* log, DiskInterface* disk_interface) : state_(state), config_(config), disk_interface_(disk_interface), |