From f288b1da59c85b88ae9aba82b5659c04e9d594ba Mon Sep 17 00:00:00 2001 From: Jon Spivack Date: Thu, 19 Dec 2019 17:15:51 -0800 Subject: ServiceManager: Internal renames Renamed CallbackMap as ServiceCallbackMap to better distinguish it from the newly added ClientCallbackMap. Bug: N/A Test: aidl_lazy_test Change-Id: I890ddbed5734dfeb9f7265fd424098f2bac2ffca --- cmds/servicemanager/ServiceManager.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'cmds/servicemanager/ServiceManager.cpp') diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp index 4a92ed862d..ae74ac3847 100644 --- a/cmds/servicemanager/ServiceManager.cpp +++ b/cmds/servicemanager/ServiceManager.cpp @@ -83,7 +83,7 @@ ServiceManager::ServiceManager(std::unique_ptr&& access) : mAccess(std:: ServiceManager::~ServiceManager() { // this should only happen in tests - for (const auto& [name, callbacks] : mNameToCallback) { + for (const auto& [name, callbacks] : mNameToRegistrationCallback) { CHECK(!callbacks.empty()) << name; for (const auto& callback : callbacks) { CHECK(callback != nullptr) << name; @@ -199,8 +199,8 @@ Status ServiceManager::addService(const std::string& name, const sp& bi .debugPid = ctx.debugPid, }); - auto it = mNameToCallback.find(name); - if (it != mNameToCallback.end()) { + auto it = mNameToRegistrationCallback.find(name); + if (it != mNameToRegistrationCallback.end()) { for (const sp& cb : it->second) { entry.first->second.guaranteeClient = true; // permission checked in registerForNotifications @@ -259,7 +259,7 @@ Status ServiceManager::registerForNotifications( return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE); } - mNameToCallback[name].push_back(callback); + mNameToRegistrationCallback[name].push_back(callback); if (auto it = mNameToService.find(name); it != mNameToService.end()) { const sp& binder = it->second.binder; @@ -281,9 +281,9 @@ Status ServiceManager::unregisterForNotifications( bool found = false; - auto it = mNameToCallback.find(name); - if (it != mNameToCallback.end()) { - removeCallback(IInterface::asBinder(callback), &it, &found); + auto it = mNameToRegistrationCallback.find(name); + if (it != mNameToRegistrationCallback.end()) { + removeRegistrationCallback(IInterface::asBinder(callback), &it, &found); } if (!found) { @@ -309,8 +309,8 @@ Status ServiceManager::isDeclared(const std::string& name, bool* outReturn) { return Status::ok(); } -void ServiceManager::removeCallback(const wp& who, - CallbackMap::iterator* it, +void ServiceManager::removeRegistrationCallback(const wp& who, + ServiceCallbackMap::iterator* it, bool* found) { std::vector>& listeners = (*it)->second; @@ -324,7 +324,7 @@ void ServiceManager::removeCallback(const wp& who, } if (listeners.empty()) { - *it = mNameToCallback.erase(*it); + *it = mNameToRegistrationCallback.erase(*it); } else { (*it)++; } @@ -339,8 +339,8 @@ void ServiceManager::binderDied(const wp& who) { } } - for (auto it = mNameToCallback.begin(); it != mNameToCallback.end();) { - removeCallback(who, &it, nullptr /*found*/); + for (auto it = mNameToRegistrationCallback.begin(); it != mNameToRegistrationCallback.end();) { + removeRegistrationCallback(who, &it, nullptr /*found*/); } for (auto it = mNameToClientCallback.begin(); it != mNameToClientCallback.end();) { -- cgit v1.2.3-59-g8ed1b