diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-06-25 18:59:34 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-06-27 08:18:57 +0000 |
commit | 4c5fda5634649aec25d42ac1a9c95936d99b48ba (patch) | |
tree | 208500a21cc482486c427b07243202b2e86d517b /src/main.cpp | |
parent | 847dde9621cef9b9a44eda95c63c0fe3f528468d (diff) |
Refactor: Integrate rework handles by application
Integrate rework handles information by application.
Window Manager handles request by "task" and block other requests
until the task finishes.
This is necessary because window mangaer task consists of 2 asyncronous parts,
which are checking policy and redraw sync, and ensures the 2 parts should be
managed consecutively.
Bug-AGL: SPEC-1510
Change-Id: I9a1d5daad5b47dd5e68a437173b3d5f1b3923865
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/src/main.cpp b/src/main.cpp index 014c72e..5de7e75 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -213,6 +213,7 @@ static void cbRemoveClientCtxt(void *data) g_afb_instance->app.controller->surfaces.erase(sid); HMI_DEBUG("wm", "delete surfaceID %d", sid); } + g_afb_instance->app.removeClient(ctxt->name); delete ctxt; } @@ -245,13 +246,14 @@ void windowmanager_requestsurface(afb_req req) noexcept HMI_DEBUG("wm", "You're %s.", ctxt->name.c_str()); if (ctxt->name != std::string(a_drawing_name)) { - afb_req_fail_f(req, "failed", "Don't request with other name: %s for now", a_drawing_name); + afb_req_fail_f(req, "failed", "Dont request with other name: %s for now", a_drawing_name); HMI_DEBUG("wm", "Don't request with other name: %s for now", a_drawing_name); return; } } - auto ret = g_afb_instance->app.api_request_surface(a_drawing_name); + auto ret = g_afb_instance->app.api_request_surface( + afb_req_get_application_id(req), a_drawing_name); if (isFirstReq) { @@ -312,7 +314,8 @@ void windowmanager_requestsurfacexdg(afb_req req) noexcept } char const *a_ivi_id = json_object_get_string(j_ivi_id); - auto ret = g_afb_instance->app.api_request_surface(a_drawing_name, a_ivi_id); + auto ret = g_afb_instance->app.api_request_surface( + afb_req_get_application_id(req), a_drawing_name, a_ivi_id); if (ret != nullptr) { afb_req_fail(req, "failed", ret); @@ -356,20 +359,23 @@ void windowmanager_activatesurface(afb_req req) noexcept return; } - g_afb_instance->app.api_activate_surface(a_drawing_name, a_drawing_area, - [&req](const char *errmsg) { - if (errmsg != nullptr) - { - HMI_ERROR("wm", errmsg); - afb_req_fail(req, "failed", errmsg); - return; - } - afb_req_success(req, NULL, "success"); - }); + g_afb_instance->app.api_activate_surface( + afb_req_get_application_id(req), + a_drawing_name, a_drawing_area, + [&req](const char *errmsg) { + if (errmsg != nullptr) + { + HMI_ERROR("wm", errmsg); + afb_req_fail(req, "failed", errmsg); + return; + } + afb_req_success(req, NULL, "success"); + }); } catch (std::exception &e) { - HMI_WARNING("wm", "failed", "Uncaught exception while calling activatesurface: %s", e.what()); + HMI_WARNING("wm", "failed: Uncaught exception while calling activatesurface: %s", e.what()); + g_afb_instance->app.exceptionProcessForTransition(); return; } } @@ -395,20 +401,22 @@ void windowmanager_deactivatesurface(afb_req req) noexcept return; } - g_afb_instance->app.api_deactivate_surface(a_drawing_name, - [&req](const char *errmsg) { - if (errmsg != nullptr) - { - HMI_ERROR("wm", errmsg); - afb_req_fail(req, "failed", errmsg); - return; - } - afb_req_success(req, NULL, "success"); - }); + g_afb_instance->app.api_deactivate_surface( + afb_req_get_application_id(req), a_drawing_name, + [&req](const char *errmsg) { + if (errmsg != nullptr) + { + HMI_ERROR("wm", errmsg); + afb_req_fail(req, "failed", errmsg); + return; + } + afb_req_success(req, NULL, "success"); + }); } catch (std::exception &e) { - HMI_WARNING("wm", "Uncaught exception while calling deactivatesurface: %s", e.what()); + HMI_WARNING("wm", "failed: Uncaught exception while calling deactivatesurface: %s", e.what()); + g_afb_instance->app.exceptionProcessForTransition(); return; } } @@ -435,11 +443,13 @@ void windowmanager_enddraw(afb_req req) noexcept } afb_req_success(req, NULL, "success"); - g_afb_instance->app.api_enddraw(a_drawing_name); + g_afb_instance->app.api_enddraw( + afb_req_get_application_id(req), a_drawing_name); } catch (std::exception &e) { - HMI_WARNING("wm", "failed", "Uncaught exception while calling enddraw: %s", e.what()); + HMI_WARNING("wm", "failed: Uncaught exception while calling enddraw: %s", e.what()); + g_afb_instance->app.exceptionProcessForTransition(); return; } } |