1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FRAME_MSG_MGR_H
17 #define FRAME_MSG_MGR_H
18 
19 #include <map>
20 #include "frame_info_const.h"
21 #include "single_instance.h"
22 #include "frame_scene_sched.h"
23 #include "rme_scene_sched.h"
24 
25 namespace OHOS {
26 namespace RME {
27 class FrameMsgMgr {
28     DECLARE_SINGLE_INSTANCE_BASE(FrameMsgMgr);
29 public:
30     FrameMsgMgr();
31     ~FrameMsgMgr();
32     bool Init();
33     void EventUpdate(FrameEvent eventType);
34 private:
35     bool HandleFrameMsgKey(FrameEvent event);
36     void FrameMapKeyToFunc();
37     void UpdateScene(SceneEvent scene);
38     void SetSchedParam();
39 
40     void HandleBeginScene();
41     void BeginFlushAnimation();
42     void EndFlushAnimation();
43     void BeginFlushBuild();
44     void EndFlushBuild();
45     void BeginFlushLayout();
46     void EndFlushLayout();
47     void BeginFlushRender();
48     void EndFlushRender();
49     void BeginFlushRenderFinish();
50     void EndFlushRenderFinish();
51 
52     void BeginProcessPostFlush();
53     void ProcessCommandsStart();
54     void AnimateStart();
55     void RenderStart();
56     void SendCommandsStart();
57     void HandleEndScene();
58 
59     FrameSceneSched *GetSceneHandler() const;
60     typedef void (FrameMsgMgr:: *PHandle)(void);
61     std::map<FrameEvent, PHandle> m_frameMsgKeyToFunc;
62 
63     SceneEvent sceneType;
64     RmeSceneSched *rmeScene;
65 };
66 } // namespace RME
67 } // namespace OHOS
68 #endif
69