Remove dead entries in .ninja_log and .ninja_deps while recompacting.

For .ninja_deps, remove objects that have no in-edges or whose in-edges
do not have a "deps" attribute. (This matches the behaviour of `-t
deps`).

BuildLog doesn't know about state, so let its recompact method take
delegate that decides is a path is life or not, and implement it in
NinjaMain.
Make tests compile (one fails atm).
Fix DepsLogTest.Recompact by making sure outputs aren't garbag-collected.
Add a test for collection of dead deps entries.
Add a test for collection of dead log entries.
Move duplicated code into a helper function.
Rename "IsDead" to "BuildLogUser".
Add a comment.
Make BuildLogUser reference constant.
Merge pull request #697 from nico/gclogs

Remove old outputs from build log and deps log during recompaction.