diff options
| author | Tom Cherry <tomcherry@google.com> | 2017-08-01 20:25:57 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-08-01 20:25:57 +0000 |
| commit | b1c18af2475100c2926356917c5acf5ffcea0257 (patch) | |
| tree | 56a20ab8450e706e16f987adfbdb312d017f77ce /init/init.cpp | |
| parent | 25422816d4acad3c4e4d7cae5eb44c1525ed896d (diff) | |
| parent | 2a2a8d9ec04676974a2c1edfc0715e8b1a66f903 (diff) | |
| download | system_core-b1c18af2475100c2926356917c5acf5ffcea0257.tar.gz system_core-b1c18af2475100c2926356917c5acf5ffcea0257.tar.bz2 system_core-b1c18af2475100c2926356917c5acf5ffcea0257.zip | |
Merge changes Ibd57c103,I81f1e8ac,Ia6e546fe
am: 2a2a8d9ec0
Change-Id: Id39de0d3d62c1e0f3585ae7817940dbbebfa6ae3
Diffstat (limited to 'init/init.cpp')
| -rw-r--r-- | init/init.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/init/init.cpp b/init/init.cpp index 58410982e..24b50f2b3 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -98,22 +98,22 @@ static bool shutting_down; std::vector<std::string> late_import_paths; void DumpState() { - ServiceManager::GetInstance().DumpState(); + ServiceList::GetInstance().DumpState(); ActionManager::GetInstance().DumpState(); } -Parser CreateParser(ActionManager& action_manager, ServiceManager& service_manager) { +Parser CreateParser(ActionManager& action_manager, ServiceList& service_list) { Parser parser; - parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_manager)); + parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list)); parser.AddSectionParser("on", std::make_unique<ActionParser>(&action_manager)); parser.AddSectionParser("import", std::make_unique<ImportParser>(&parser)); return parser; } -static void LoadBootScripts(ActionManager& action_manager, ServiceManager& service_manager) { - Parser parser = CreateParser(action_manager, service_manager); +static void LoadBootScripts(ActionManager& action_manager, ServiceList& service_list) { + Parser parser = CreateParser(action_manager, service_list); std::string bootscript = GetProperty("ro.boot.init_rc", ""); if (bootscript.empty()) { @@ -221,8 +221,8 @@ void property_changed(const std::string& name, const std::string& value) { static std::optional<boot_clock::time_point> RestartProcesses() { std::optional<boot_clock::time_point> next_process_restart_time; - ServiceManager::GetInstance().ForEachService([&next_process_restart_time](Service* s) { - if (!(s->flags() & SVC_RESTARTING)) return; + for (const auto& s : ServiceList::GetInstance()) { + if (!(s->flags() & SVC_RESTARTING)) continue; auto restart_time = s->time_started() + 5s; if (boot_clock::now() > restart_time) { @@ -232,12 +232,12 @@ static std::optional<boot_clock::time_point> RestartProcesses() { next_process_restart_time = restart_time; } } - }); + } return next_process_restart_time; } void handle_control_message(const std::string& msg, const std::string& name) { - Service* svc = ServiceManager::GetInstance().FindServiceByName(name); + Service* svc = ServiceList::GetInstance().FindService(name); if (svc == nullptr) { LOG(ERROR) << "no such service '" << name << "'"; return; @@ -1170,7 +1170,7 @@ int main(int argc, char** argv) { Action::set_function_map(&function_map); ActionManager& am = ActionManager::GetInstance(); - ServiceManager& sm = ServiceManager::GetInstance(); + ServiceList& sm = ServiceList::GetInstance(); LoadBootScripts(am, sm); @@ -1211,10 +1211,10 @@ int main(int argc, char** argv) { // By default, sleep until something happens. int epoll_timeout_ms = -1; - if (!(waiting_for_prop || sm.IsWaitingForExec())) { + if (!(waiting_for_prop || Service::is_exec_service_running())) { am.ExecuteOneCommand(); } - if (!(waiting_for_prop || sm.IsWaitingForExec())) { + if (!(waiting_for_prop || Service::is_exec_service_running())) { if (!shutting_down) { auto next_process_restart_time = RestartProcesses(); |
