1 /* 2 * Copyright (c) 2022-2023 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 RESSCHED_PLUGINS_SOCPERF_PLUGIN_INCLUDE_SOCPERF_PLUGIN_H 17 #define RESSCHED_PLUGINS_SOCPERF_PLUGIN_INCLUDE_SOCPERF_PLUGIN_H 18 #ifdef RESSCHED_RESOURCESCHEDULE_SOC_PERF_ENABLE 19 #include <set> 20 #include <unordered_map> 21 #include "plugin.h" 22 #include "single_instance.h" 23 #include "socperf_client.h" 24 25 namespace OHOS { 26 namespace ResourceSchedule { 27 class SocPerfPlugin : public Plugin { 28 DECLARE_SINGLE_INSTANCE(SocPerfPlugin) 29 30 public: 31 void Init() override; 32 33 void Disable() override; 34 35 void DispatchResource(const std::shared_ptr<ResData>& resData) override; 36 37 private: 38 std::set<uint32_t> resTypes; 39 std::unordered_map<uint32_t, std::function<void(const std::shared_ptr<ResData>& data)>> functionMap; 40 void InitFunctionMap(); 41 void InitResTypes(); 42 void HandleWindowFocus(const std::shared_ptr<ResData>& data); 43 void HandleEventClick(const std::shared_ptr<ResData>& data); 44 void HandleLoadPage(const std::shared_ptr<ResData>& data); 45 void HandlePopPage(const std::shared_ptr<ResData>& data); 46 void HandleEventSlide(const std::shared_ptr<ResData>& data); 47 void HandleEventWebGesture(const std::shared_ptr<ResData>& data); 48 void HandleAppAbilityStart(const std::shared_ptr<ResData>& data); 49 void HandleResizeWindow(const std::shared_ptr<ResData>& data); 50 void HandleMoveWindow(const std::shared_ptr<ResData>& data); 51 void HandleRemoteAnimation(const std::shared_ptr<ResData>& data); 52 bool InitFeatureSwitch(std::string featureName); 53 void HandleDragStatusBar(const std::shared_ptr<ResData>& data); 54 void HandleWebGestureMove(const std::shared_ptr<ResData>& data); 55 void HandleWebSlideNormal(const std::shared_ptr<ResData>& data); 56 void HandleLoadUrl(const std::shared_ptr<ResData>& data); 57 void HandleMousewheel(const std::shared_ptr<ResData>& data); 58 void HandleAppStateChange(const std::shared_ptr<ResData>& data); 59 }; 60 } // namespace ResourceSchedule 61 } // namespace OHOS 62 63 #endif //RESSCHED_RESOURCESCHEDULE_SOC_PERF_ENABLE 64 #endif // RESSCHED_PLUGINS_SOCPERF_PLUGIN_INCLUDE_SOCPERF_PLUGIN_H 65