[Zucchini] Add command line processing framework with stubs

Desktop / Chromium - huangs [google.com] - 14 July 2017 11:17 EDT

This CL adds main_utils.*, which has the framework to dispatch Zucchini commands and print help messages. This is used by the Zucchini main program, and is not part of Zucchini library.- Add ::Command: A struct containing command name (e.g., "-gen", "-apply"), help message, and a base::Callback containing code for the main command. This allows Zucchini command dispatch without bulky bulky class hierarchy and superfluous instantialization.- Add ::CommandRegistry: A class to manage ::Command instances and dispatch commands, or print help messages.- Add ::ResourceUsageTracker: A class instantiated in main() to track resource usage for valid command invocations, and and print them at end. Specifically:- Zucchini.PeakPagefileUsage (KiB)- Zucchini.PeakWorkingSetSize (KiB)- Zucchini.TotalTime (s) Also add "-quiet" switch to disable this.
- Add stubs for Zucchini-gen and Zucchini-apply, to be populated later.- Starting to use LOG(INFO) to display output. This requires updating PRESUBMIT.py to add Zucchini as an exception.

Bug: 729154 Change-Id: Id5263435100dc73b2d8917ca2bcd04245ed41934 Reviewed-on: https://chromium-review.googlesource.com/567492 Commit-Queue: Samuel Huang

a13b5a0 [Zucchini] Add command line processing framework with stubs.
PRESUBMIT.py | 1 +
chrome/installer/zucchini/BUILD.gn | 4 +
chrome/installer/zucchini/main_utils.cc | 131 +++++++++++++++++++++++++++++
chrome/installer/zucchini/main_utils.h | 86 +++++++++++++++++++
chrome/installer/zucchini/zucchini_main.cc | 31 +++++++
5 files changed, 253 insertions(+)

Upstream: git.chromium.org


  • Share