aboutsummaryrefslogtreecommitdiffstats
path: root/src/applist.hpp
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-05-20 23:08:13 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-05-21 12:21:42 +0900
commit973a7123c0bced7c7e7d9dc6dc5e990a0e2838ac (patch)
tree1f45c6b73578f839aef7f7ec7e66b3f06eb46eed /src/applist.hpp
parent807c2bc45bf19059021eb3d94e2c1693a9c940b6 (diff)
[Local]: Lock Sequence from activateSurface to flushDraw
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src/applist.hpp')
-rw-r--r--src/applist.hpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/applist.hpp b/src/applist.hpp
new file mode 100644
index 0000000..55355ef
--- /dev/null
+++ b/src/applist.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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 <vector>
+#include <string>
+#include <map>
+#include <memory>
+//#include <experimental/optional>
+#include "windowmanager-client.hpp"
+
+namespace wm {
+
+/* using std::experimental::nullopt;
+using std::experimental::optional; */
+
+typedef enum Task{
+ TASK_ALLOCATE,
+ TASK_RELEASE
+}ResourceTask;
+
+struct WMRequest{
+ explicit WMRequest(std::string appid, std::string role,
+ std::string area, ResourceTask task);
+ virtual ~WMRequest();
+ WMRequest(const WMRequest &obj);
+
+ std::string appid;
+ std::string role;
+ std::string area;
+ Task task;
+ unsigned seq_num;
+ bool allocating;
+ bool end_draw_finished;
+};
+
+class AppList {
+public:
+ AppList();
+ virtual ~AppList();
+ AppList(const AppList &obj) = delete;
+
+ // Client Database Interface
+ void addClient(const std::string &appid, const std::string &role);
+ void removeClient(const std::string &appid);
+ bool contains(const std::string &appid);
+ std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
+
+ // Request Interface
+ unsigned currentSequenceNumber();
+ unsigned getSequenceNumber(const std::string &appid);
+ unsigned addAllocateRequest(WMRequest req);
+ /* TODO: consider, which is better WMClient or std::string appid?
+ if appid is key to manage resources, it is better to select std::string
+ otherwise WMClient is better, IMO */
+ bool requestFinished();
+ unsigned lookUpAllocatingApp(const std::string &appid);
+ void setEndDrawFinished(unsigned request_seq, const std::string &role);
+ bool endDrawFullfilled(unsigned request_seq);
+ void removeRequest(unsigned request_seq);
+ void setCurrentSequence(unsigned request_seq);
+ bool haveRequest();
+ /* void revertRequestingState();
+ void removeAllRequesting(); */
+
+ //void revertRequestingState();//???
+
+ /* 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<WMRequest> req_list;
+ std::unordered_map<std::string, std::shared_ptr<WMClient>> client_list;
+ unsigned current_seq;
+};
+
+}
+#endif // ALLOCATE_LIST_HPP \ No newline at end of file