diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-05-31 19:14:48 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-05-31 19:14:48 +0900 |
commit | 2e78bcd71f27bc18033b24d45bc3a67b5207862b (patch) | |
tree | 68bd3a599efbaf4b5f01d409b03fbfd134517293 | |
parent | 497463754856362822c9d7e3c6b082f0467478a0 (diff) |
Add new function to applist
Change-Id: Ife3642fc60f7c25aeae83b1f2aad0d362cdbe6cd
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | src/applist.cpp | 22 | ||||
-rw-r--r-- | src/applist.hpp | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/applist.cpp b/src/applist.cpp index 7c554e9..8c13f5f 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -42,6 +42,13 @@ void AppList::addClient(const string &appid, const string &role) client_dump(); } +void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role) +{ + shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role); + client_list[appid] = client; + client_dump(); +} + void AppList::removeClient(const string &appid) { client_list.erase(appid); @@ -53,6 +60,19 @@ bool AppList::contains(const string &appid) return (client_list.end() != result) ? true : false; } +void AppList::removeSurface(unsigned surface_id){ + // This function may be very slow + bool ret = false; + for (auto &x : client_list) + { + ret = x.second->removeSurfaceIfExist(surface_id); + if(ret){ + HMI_DEBUG("wm", "remove surface %d from Client %s finish", surface_id, x.second->appID().c_str()); + break; + } + } +} + /** * @brief get WMClient object. Before call this function, must call "contains" * to check the key is contained, otherwise, you have to take care of std::out_of_range. @@ -248,7 +268,7 @@ void AppList::client_dump() for (const auto &x : client_list) { const auto &y = x.second; - DUMP("APPID : %s", y->appID().c_str()); + y->dumpInfo(); } DUMP("======= client dump end====="); } diff --git a/src/applist.hpp b/src/applist.hpp index cab3595..d2a5971 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -39,10 +39,12 @@ class AppList // Client Database Interface void addClient(const std::string &appid, const std::string &role); + void addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role); void removeClient(const std::string &appid); bool contains(const std::string &appid); - int countClient(); + int countClient(); std::shared_ptr<WMClient> lookUpClient(const std::string &appid); + void removeSurface(unsigned surface); // Request Interface unsigned currentSequenceNumber(); |