diff options
author | 2021-05-19 17:03:55 -0700 | |
---|---|---|
committer | 2021-06-03 19:35:14 +0000 | |
commit | 09eacd9a5d982687b68031a884e4daaa11560f0c (patch) | |
tree | 79a7fdac9c3330e850d05028cf95b3de6cb108a3 /cmdline/cmdline_parser.h | |
parent | 341be9e71c8dbb1f6e29e860336e8e4944d54c63 (diff) |
Setup ART experiments infra
Add a flexible class for ART Flags that can take their
values from cmdline arguments, system properties or
device config settings.
(the flags concept is evolved from Eric's previous CL
3dba023d4fb47882fa215715c196cfa3be30c098)
Plumb the loading/re-loading of flags in the runtime
initialization and after forking from zygote (so that
we don't require restarts to refresh the flags).
If multiple values are given for the same flag the
evaluation order is:
1) device config (configurable from server side)
2) system properties
3) cmdline arguments
4) the default value
The existing cmdline arguments are not migrated to the
new infra and will be done only on a per need basis.
Test: gtest & manual
Bug: 181748174
Change-Id: If3940393493af1052367d725a3f2aa94eee927c2
Diffstat (limited to 'cmdline/cmdline_parser.h')
-rw-r--r-- | cmdline/cmdline_parser.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cmdline/cmdline_parser.h b/cmdline/cmdline_parser.h index 22eb44c211..7e343f8ef2 100644 --- a/cmdline/cmdline_parser.h +++ b/cmdline/cmdline_parser.h @@ -210,6 +210,24 @@ struct CmdlineParser { return parent_; } + // Write the results of this argument into a variable pointed to by destination. + // An optional is used to tell whether the command line argument was present. + CmdlineParser::Builder& IntoLocation(std::optional<TArg>* destination) { + save_value_ = [destination](TArg& value) { + *destination = value; + }; + + load_value_ = [destination]() -> TArg& { + return destination->value(); + }; + + save_value_specified_ = true; + load_value_specified_ = true; + + CompleteArgument(); + return parent_; + } + // Ensure we always move this when returning a new builder. ArgumentBuilder(ArgumentBuilder&&) = default; |