aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-14 09:40:31 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-14 09:40:46 +0900
commit7ab541f7601162956b30c6b597ca287f42ac2bbb (patch)
tree234496cf87f6ffd613aa02b7ac56aab3d99e188e
parent237be6f894c56cc32042c9dee16b6445bbae92f7 (diff)
Add description to the applist
Change-Id: I9742f87211128bba83fecc317b949df601ef0fc5 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/applist.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/applist.cpp b/src/applist.cpp
index 919c099..130eb61 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -41,8 +41,8 @@ AppList::AppList()
app2client(),
current_req(1)
{
- app2client.reserve(kReserveClientSize);
- req_list.reserve(kReserveReqSize);
+ this->app2client.reserve(kReserveClientSize);
+ this->req_list.reserve(kReserveReqSize);
}
AppList::~AppList() {}
@@ -67,7 +67,7 @@ AppList::~AppList() {}
*/
void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role);
this->app2client[appid] = client;
this->clientDump();
@@ -80,7 +80,7 @@ void AppList::addClient(const std::string &appid, unsigned layer, unsigned surfa
*/
void AppList::removeClient(const string &appid)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
this->app2client.erase(appid);
HMI_INFO("wm", "Remove client %s", appid.c_str());
}
@@ -97,15 +97,21 @@ bool AppList::contains(const string &appid) const
return (this->app2client.end() != result) ? true : false;
}
-void AppList::removeSurface(unsigned surface_id){
+/**
+ * Remove surface from client
+ *
+ * @param unsigned[in] surface id.
+ * @return None
+ */
+void AppList::removeSurface(unsigned surface){
// This function may be very slow
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
bool ret = false;
for (auto &x : this->app2client)
{
- ret = x.second->removeSurfaceIfExist(surface_id);
+ ret = x.second->removeSurfaceIfExist(surface);
if(ret){
- HMI_DEBUG("wm", "remove surface %d from Client %s finish", surface_id, x.second->appID().c_str());
+ HMI_DEBUG("wm", "remove surface %d from Client %s finish", surface, x.second->appID().c_str());
break;
}
}
@@ -221,7 +227,7 @@ unsigned AppList::getRequestNumber(const string &appid) const
*/
unsigned AppList::addAllocateRequest(WMRequest req)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
if (this->req_list.size() == 0)
{
req.req_num = current_req;
@@ -305,7 +311,7 @@ const vector<struct WMAction> &AppList::getActions(unsigned req_num, bool* found
*/
WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
WMError result = WMError::FAIL;
for (auto &x : this->req_list)
{
@@ -346,7 +352,7 @@ WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
*/
WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
WMError result = WMError::FAIL;
for (auto &x : req_list)
{
@@ -379,7 +385,7 @@ WMError AppList::setAction(unsigned req_num, const string &appid, const string &
*/
bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const string &role)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
bool result = false;
for (auto &x : req_list)
{
@@ -443,7 +449,7 @@ bool AppList::endDrawFullfilled(unsigned req_num)
*/
void AppList::removeRequest(unsigned req_num)
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
this->req_list.erase(remove_if(this->req_list.begin(), this->req_list.end(),
[req_num](WMRequest x) {
return x.req_num == req_num;
@@ -458,7 +464,7 @@ void AppList::removeRequest(unsigned req_num)
*/
void AppList::next()
{
- std::lock_guard<std::mutex> lock(mtx);
+ std::lock_guard<std::mutex> lock(this->mtx);
++this->current_req;
if (0 == this->current_req)
{