diff options
author | Tom Cherry <tomcherry@google.com> | 2019-09-18 13:47:19 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-09-18 14:02:14 -0700 |
commit | 14c2472734ce9f92978b7193a6877c5c2ceba200 (patch) | |
tree | 4390ac8fa516766511a10c6742ca0bb17ada90ab /init/service_parser.cpp | |
parent | b0321c1de178ac2dfd05fb6537e0e63f7eecf87e (diff) |
init: degeneralize subcontext init into only vendor_init
This code is more generic than it needs to be and one of the side
effects is that an extra init process is forked for odm_init, despite
it having the same context as vendor_init. I don't think anything is
going to change regarding that soon, so this change stops forking that
extra process to save its memory and simplifies the code overall.
Bug: 141164879
Test: init still uses vendor_init for vendor_scripts
Test: init unit tests
Test: init only has one subcontext process
Change-Id: I0d224455604a681711e32f89fb20132378f69060
Diffstat (limited to 'init/service_parser.cpp')
-rw-r--r-- | init/service_parser.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 4322dc70a..45d185265 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -537,13 +537,8 @@ Result<void> ServiceParser::ParseSection(std::vector<std::string>&& args, filename_ = filename; Subcontext* restart_action_subcontext = nullptr; - if (subcontexts_) { - for (auto& subcontext : *subcontexts_) { - if (StartsWith(filename, subcontext.path_prefix())) { - restart_action_subcontext = &subcontext; - break; - } - } + if (subcontext_ && subcontext_->PathMatchesSubcontext(filename)) { + restart_action_subcontext = subcontext_; } std::vector<std::string> str_args(args.begin() + 2, args.end()); |