diff options
author | Tom Cherry <tomcherry@google.com> | 2017-07-27 12:54:48 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2017-07-27 13:23:32 -0700 |
commit | 67dee626e0185096bbaf73042f1a891ce436f714 (patch) | |
tree | 7d8dac0fe94f641494ea33e97ca00e0fb444795b /init/builtins.cpp | |
parent | 29b94116855b96e24beeb993396b251a1f85127a (diff) |
init: remove Parser singleton and related cleanup
* Remove the Parser singleton (Hooray!)
* Rename parser.* to tokenizer.* as this is actually a tokenizer
* Rename init_parser.* to parser.* as this is a generic parser
* Move contents of init_parser_test.cpp to service_test.cpp as this
actually is a test of the parsing in MakeExecOneshotService() and
nothing related to (init_)parser.cpp
Test: boot bullhead
Test: bool sailfish
Test: init unit tests
Change-Id: I4fe39e6483f58ebd3ce5ee715a45dbba0acf5d91
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index dfd7b73d2..dec6f40e6 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -57,7 +57,7 @@ #include "action.h" #include "bootchart.h" #include "init.h" -#include "init_parser.h" +#include "parser.h" #include "property_service.h" #include "reboot.h" #include "service.h" @@ -388,21 +388,15 @@ exit_success: * start_index: index of the first path in the args list */ static void import_late(const std::vector<std::string>& args, size_t start_index, size_t end_index) { - Parser& parser = Parser::GetInstance(); + auto& action_manager = ActionManager::GetInstance(); + auto& service_manager = ServiceManager::GetInstance(); + Parser parser = CreateParser(action_manager, service_manager); if (end_index <= start_index) { // Fallbacks for partitions on which early mount isn't enabled. - if (!parser.is_system_etc_init_loaded()) { - parser.ParseConfig("/system/etc/init"); - parser.set_is_system_etc_init_loaded(true); - } - if (!parser.is_vendor_etc_init_loaded()) { - parser.ParseConfig("/vendor/etc/init"); - parser.set_is_vendor_etc_init_loaded(true); - } - if (!parser.is_odm_etc_init_loaded()) { - parser.ParseConfig("/odm/etc/init"); - parser.set_is_odm_etc_init_loaded(true); + for (const auto& path : late_import_paths) { + parser.ParseConfig(path); } + late_import_paths.clear(); } else { for (size_t i = start_index; i < end_index; ++i) { parser.ParseConfig(args[i]); |