Change-Id: Id7449b8ccbad67a958efd3dccf7c5d4a0dd41d97
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
void AppList::addClient(const string &appid, const string &role)
{
void AppList::addClient(const string &appid, const string &role)
{
+ std::lock_guard<std::mutex> lock(mtx);
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, role);
this->app2client[appid] = client;
this->clientDump();
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, role);
this->app2client[appid] = client;
this->clientDump();
void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role)
{
void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role)
{
+ std::lock_guard<std::mutex> lock(mtx);
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role);
this->app2client[appid] = client;
this->clientDump();
shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role);
this->app2client[appid] = client;
this->clientDump();
void AppList::removeClient(const string &appid)
{
void AppList::removeClient(const string &appid)
{
+ std::lock_guard<std::mutex> lock(mtx);
this->app2client.erase(appid);
this->app2client.erase(appid);
+ HMI_INFO("wm", "Remove client %s", appid.c_str());
}
bool AppList::contains(const string &appid) const
}
bool AppList::contains(const string &appid) const
void AppList::removeSurface(unsigned surface_id){
// This function may be very slow
void AppList::removeSurface(unsigned surface_id){
// This function may be very slow
+ std::lock_guard<std::mutex> lock(mtx);
bool ret = false;
for (auto &x : this->app2client)
{
bool ret = false;
for (auto &x : this->app2client)
{
return this->current_req;
}
return this->current_req;
}
-// Is this function necessary ?
unsigned AppList::getRequestNumber(const string &appid) const
{
for (const auto &x : this->req_list)
unsigned AppList::getRequestNumber(const string &appid) const
{
for (const auto &x : this->req_list)
unsigned AppList::addAllocateRequest(WMRequest req)
{
unsigned AppList::addAllocateRequest(WMRequest req)
{
+ std::lock_guard<std::mutex> lock(mtx);
if (this->req_list.size() == 0)
{
req.req_num = current_req;
}
else
{
if (this->req_list.size() == 0)
{
req.req_num = current_req;
}
else
{
- HMI_SEQ_DEBUG(this->current_req, "add: %d", this->req_list.back().req_num + 1);
+ HMI_SEQ_INFO(this->current_req, "add: %d", this->req_list.back().req_num + 1);
req.req_num = this->req_list.back().req_num + 1;
}
this->req_list.push_back(req);
req.req_num = this->req_list.back().req_num + 1;
}
this->req_list.push_back(req);
- return req.req_num; // return 1; if you test time_expire
}
struct WMTrigger AppList::getRequest(unsigned req_num, bool *found)
}
struct WMTrigger AppList::getRequest(unsigned req_num, bool *found)
+ HMI_SEQ_ERROR(req_num, "Couldn't get request : %d", req_num);
return WMTrigger{"", "", "", Task::TASK_INVALID};
}
return WMTrigger{"", "", "", Task::TASK_INVALID};
}
return x.sync_draw_req;
}
}
return x.sync_draw_req;
}
}
+ HMI_SEQ_ERROR(req_num, "Couldn't get action with the request : %d", req_num);
}
WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
{
}
WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
{
+ std::lock_guard<std::mutex> lock(mtx);
WMError result = WMError::FAIL;
for (auto &x : this->req_list)
{
WMError result = WMError::FAIL;
for (auto &x : this->req_list)
{
result = WMError::SUCCESS;
break;
}
result = WMError::SUCCESS;
break;
}
*/
WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible)
{
*/
WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible)
{
+ std::lock_guard<std::mutex> lock(mtx);
WMError result = WMError::NOT_REGISTERED;
for (auto &x : req_list)
{
WMError result = WMError::NOT_REGISTERED;
for (auto &x : req_list)
{
*/
bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const string &role)
{
*/
bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const string &role)
{
+ std::lock_guard<std::mutex> lock(mtx);
bool result = false;
for (auto &x : req_list)
{
bool result = false;
for (auto &x : req_list)
{
void AppList::removeRequest(unsigned req_num)
{
void AppList::removeRequest(unsigned req_num)
{
+ std::lock_guard<std::mutex> lock(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;
this->req_list.erase(remove_if(this->req_list.begin(), this->req_list.end(),
[req_num](WMRequest x) {
return x.req_num == req_num;
+ std::lock_guard<std::mutex> lock(mtx);
++this->current_req;
if (0 == this->current_req)
{
++this->current_req;
if (0 == this->current_req)
{
#include <string>
#include <map>
#include <memory>
#include <string>
#include <map>
#include <memory>
#include "wm_client.hpp"
#include "request.hpp"
#include "wm_error.hpp"
#include "wm_client.hpp"
#include "request.hpp"
#include "wm_error.hpp"
std::vector<WMRequest> req_list;
std::unordered_map<std::string, std::shared_ptr<WMClient>> app2client;
unsigned current_req;
std::vector<WMRequest> req_list;
std::unordered_map<std::string, std::shared_ptr<WMClient>> app2client;
unsigned current_req;