• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_RESSCHED_RESSCHED_REPORT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_RESSCHED_RESSCHED_REPORT_H
18 
19 #include <string>
20 #include <unordered_map>
21 
22 #include "base/utils/macros.h"
23 #include "base/utils/noncopyable.h"
24 #include "core/event/touch_event.h"
25 
26 namespace OHOS::Ace {
27 using ReportDataFunc = void (*)(uint32_t resType, int64_t value,
28     const std::unordered_map<std::string, std::string>& payload);
29 
30 ReportDataFunc ACE_EXPORT LoadReportDataFunc();
31 
32 class ACE_EXPORT ResSchedReport final {
33 public:
34     static ResSchedReport& GetInstance();
35     void ResSchedDataReport(const char* name, const std::unordered_map<std::string, std::string>& param = {});
36     void ResSchedDataReport(uint32_t resType, int32_t value = 0,
37         const std::unordered_map<std::string, std::string>& payload = {});
38     void OnTouchEvent(const TouchType& touchType);
39 
40 private:
ResSchedReport()41     ResSchedReport() {}
~ResSchedReport()42     ~ResSchedReport() {}
43     ReportDataFunc reportDataFunc_ = nullptr;
44 };
45 
46 class ACE_EXPORT ResSchedReportScope final {
47 public:
48     ACE_DISALLOW_COPY_AND_MOVE(ResSchedReportScope);
49 
50     explicit ResSchedReportScope(const std::string& name,
51         const std::unordered_map<std::string, std::string>& param = {});
52     ~ResSchedReportScope();
53 
54 private:
55     std::string name_;
56     std::unordered_map<std::string, std::string> payload_;
57 };
58 } // namespace OHOS::Ace
59 
60 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_RESSCHED_RESSCHED_REPORT_H
61