From d31270592190870d13c98460d351697350c67cc2 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Mon, 14 May 2018 10:07:58 +0900 Subject: [PATCH] [Local]:1st step for blocking sequence * add new class to allocate window resource * add new class for list to hold clients information * change API of request surface Change-Id: Ic39fa8908163d49b429125639189dd89812f94e9 Signed-off-by: Kazumasa Mitsunari --- src/CMakeLists.txt | 4 +++- src/allocate_queue.cpp | 26 ++++++++++++++++++++++++ src/allocate_queue.hpp | 45 ++++++++++++++++++++++++++++++++++++++++++ src/app.cpp | 9 ++++++++- src/app.hpp | 2 +- src/main.cpp | 2 +- src/windowmanager-client.cpp | 31 +++++++++++++++++++++++++++++ src/windowmanager-client.hpp | 47 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 src/allocate_queue.cpp create mode 100644 src/allocate_queue.hpp create mode 100644 src/windowmanager-client.cpp create mode 100644 src/windowmanager-client.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc3efc3..248a058 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,9 @@ add_library(${TARGETS_WM} MODULE controller_hooks.hpp config.cpp config.hpp - policy.hpp) + policy.hpp + windowmanager-client.cpp + allocate_queue.cpp) target_include_directories(${TARGETS_WM} PRIVATE diff --git a/src/allocate_queue.cpp b/src/allocate_queue.cpp new file mode 100644 index 0000000..029c516 --- /dev/null +++ b/src/allocate_queue.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "allocate_queue.hpp" + +namespace wm { + +AllocateRequestList::AllocateRequestList(){} +AllocateRequestList::~AllocateRequestList(){} +void AllocateRequestList::addClient(WMClient* client){ + +} +} \ No newline at end of file diff --git a/src/allocate_queue.hpp b/src/allocate_queue.hpp new file mode 100644 index 0000000..2a977b1 --- /dev/null +++ b/src/allocate_queue.hpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALLOCATE_LIST_HPP +#define ALLOCATE_LIST_HPP +#include +#include "windowmanager-client.hpp" + +namespace wm { + +class AllocateRequestList { +public: + AllocateRequestList(); + ~AllocateRequestList(); + AllocateRequestList(const AllocateRequestList &obj) = delete; + + void addClient(WMClient* client); + + /* bool queue(int request_num); + bool pushTop(int request_num); + bool dequeue(); + void deleteAllElement(); + void removeElement(int request_num); + bool hasElement(int request_num); */ + +private: + std::vector requestQueue; + +}; + +} +#endif // ALLOCATE_LIST_HPP \ No newline at end of file diff --git a/src/app.cpp b/src/app.cpp index 937da6a..53a645e 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -35,6 +35,8 @@ #include #include +#include "windowmanager-client.hpp" +#include "allocate_queue.hpp" namespace wm { @@ -58,6 +60,7 @@ const char kKeyHeightPixel[] = "height_pixel"; const char kKeyWidthMm[] = "width_mm"; const char kKeyHeightMm[] = "height_mm"; +static AllocateRequestList allocate_list; namespace { @@ -705,7 +708,7 @@ void App::emit_invisible(char const *label) { void App::emit_visible(char const *label) { return emit_visible(label, true); } -result App::api_request_surface(char const *drawing_name) { +result App::api_request_surface(char const *drawing_name, char const * appid, int flag) { auto lid = this->layers.get_layer_id(std::string(drawing_name)); if (!lid) { /** @@ -731,6 +734,10 @@ result App::api_request_surface(char const *drawing_name) { HMI_DEBUG("wm", "Set main_surface id to %u", id); } + // add client into the db + WMClient* client = new WMClient(appid, *lid, id, drawing_name); // role is drawing_name for now + allocate_list.addClient(client); + return Ok(id); } diff --git a/src/app.hpp b/src/app.hpp index d1393c0..5cfd78f 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -201,7 +201,7 @@ struct App { void set_pending_events(); - result api_request_surface(char const *drawing_name); + result api_request_surface(char const *drawing_name, char const *appid, int flag); char const *api_request_surface(char const *drawing_name, char const *ivi_id); void api_activate_surface(char const *drawing_name, char const *drawing_area, const reply_func &reply); void api_deactivate_surface(char const *drawing_name, const reply_func &reply); diff --git a/src/main.cpp b/src/main.cpp index 3828afd..bd591a4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -209,7 +209,7 @@ void windowmanager_requestsurface(afb_req req) noexcept { } } - auto ret = g_afb_instance->app.api_request_surface(a_drawing_name); + auto ret = g_afb_instance->app.api_request_surface(a_drawing_name, afb_req_get_application_id(req), 0); if(isFirstReq){ wmClientCtxt* ctxt = new wmClientCtxt(a_drawing_name); diff --git a/src/windowmanager-client.cpp b/src/windowmanager-client.cpp new file mode 100644 index 0000000..ee6164a --- /dev/null +++ b/src/windowmanager-client.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "windowmanager-client.hpp" + +namespace wm { + +WMClient::WMClient(){ + +} + +WMClient::WMClient(const char* appid, unsigned layerID, unsigned surfaceID, const char* role) + : request_number(0) +{ + +} + +} \ No newline at end of file diff --git a/src/windowmanager-client.hpp b/src/windowmanager-client.hpp new file mode 100644 index 0000000..6aec0f3 --- /dev/null +++ b/src/windowmanager-client.hpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef WINDOWMANAGER_CLIENT_HPP +#define WINDOWMANAGER_CLIENT_HPP + +#include +#include +#include + +extern "C" { +#include +} + +namespace wm { + +class WMClient { +public: + WMClient(); + WMClient(const char* appid, unsigned layerID, unsigned surfaceID, const char* role); + virtual ~WMClient(); + //WMClient::WMClient(const WMClient &obj); + +private: + unsigned layer; + std::vector surfaces; + std::string appid; + std::vector roles; + std::unordered_map event_list; + unsigned request_number; +}; +} + +#endif \ No newline at end of file -- 2.16.6