• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_FRAME_REPORT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_FRAME_REPORT_H
18 
19 #include <string>
20 
21 #include "base/utils/macros.h"
22 #include "base/utils/noncopyable.h"
23 
24 namespace OHOS::Ace {
25 using FrameInitFunc = void (*)();
26 using FrameGetEnableFunc = int (*)();
27 using BeginFlushAnimationFunc = void (*)();
28 using EndFlushAnimationFunc = void (*)();
29 using BeginFlushBuildFunc = void (*)();
30 using EndFlushBuildFunc = void (*)();
31 using BeginFlushLayoutFunc = void (*)();
32 using EndFlushLayoutFunc = void (*)();
33 using BeginFlushRenderFunc = void (*)();
34 using EndFlushRenderFunc = void (*)();
35 using BeginFlushRenderFinishFunc = void (*)();
36 using EndFlushRenderFinishFunc = void (*)();
37 using BeginProcessPostFlushFunc = void (*)();
38 using BeginListFlingFunc = void (*)();
39 using EndListFlingFunc = void (*)();
40 using FlushBeginFunc = void (*)();
41 using FlushEndFunc = void (*)();
42 
43 class ACE_EXPORT FrameReport final {
44 public:
45     static FrameReport& GetInstance();
46     void Init();
47     int GetEnable();
48     void BeginFlushAnimation();
49     void EndFlushAnimation();
50 
51     void BeginFlushBuild();
52     void EndFlushBuild();
53     void BeginFlushLayout();
54     void EndFlushLayout();
55     void BeginFlushRender();
56     void EndFlushRender();
57     void BeginFlushRenderFinish();
58     void EndFlushRenderFinish();
59     void BeginProcessPostFlush();
60     void BeginListFling();
61     void EndListFling();
62     void FlushBegin();
63     void FlushEnd();
64 
65 private:
66     FrameReport();
67     ~FrameReport();
68     bool LoadLibrary();
69     void CloseLibrary();
70     void* LoadSymbol(const char* symName);
71     int GetFrameReportEnable();
72     void* frameSchedHandle_ = nullptr;
73     bool frameSchedSoLoaded_ = false;
74     bool enable_ = false;
75 
76     ACE_EXPORT FrameInitFunc frameInitFunc_ = nullptr;
77     ACE_EXPORT FrameGetEnableFunc frameGetEnableFunc_ = nullptr;
78     ACE_EXPORT BeginFlushAnimationFunc beginFlushAnimationFunc_ = nullptr;
79     ACE_EXPORT EndFlushAnimationFunc endFlushAnimationFunc_ = nullptr;
80     ACE_EXPORT BeginFlushBuildFunc beginFlushBuildFunc_ = nullptr;
81     ACE_EXPORT EndFlushBuildFunc endFlushBuildFunc_ = nullptr;
82     ACE_EXPORT BeginFlushLayoutFunc beginFlushLayoutFunc_ = nullptr;
83     ACE_EXPORT EndFlushLayoutFunc endFlushLayoutFunc_ = nullptr;
84     ACE_EXPORT BeginFlushRenderFunc beginFlushRenderFunc_ = nullptr;
85     ACE_EXPORT EndFlushRenderFunc endFlushRenderFunc_ = nullptr;
86     ACE_EXPORT BeginFlushRenderFinishFunc beginFlushRenderFinishFunc_ = nullptr;
87     ACE_EXPORT EndFlushRenderFinishFunc endFlushRenderFinishFunc_ = nullptr;
88     ACE_EXPORT BeginProcessPostFlushFunc beginProcessPostFunc_ = nullptr;
89     ACE_EXPORT BeginListFlingFunc beginListFlingFunc_ = nullptr;
90     ACE_EXPORT EndListFlingFunc endListFlingFunc_ = nullptr;
91     ACE_EXPORT FlushBeginFunc flushBeginFunc_ = nullptr;
92     ACE_EXPORT FlushEndFunc flushEndFunc_ = nullptr;
93 };
94 } // namespace OHOS::Ace
95 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_FRAME_REPORT_H
96