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 RENDER_SERVICE_BASE_COMMON_RS_PROPERTY_TRACE_H 17 #define RENDER_SERVICE_BASE_COMMON_RS_PROPERTY_TRACE_H 18 19 #include <set> 20 #include <unordered_map> 21 #include <sys/stat.h> 22 23 #include "common/rs_common_def.h" 24 #include "common/rs_macros.h" 25 #include "common/rs_obj_abs_geometry.h" 26 #include "property/rs_properties.h" 27 28 namespace OHOS { 29 namespace Rosen { 30 class RSB_EXPORT RSPropertyTrace { 31 public: GetInstance()32 static RSPropertyTrace &GetInstance() 33 { 34 return instance_; 35 }; 36 37 void PropertiesDisplayByTrace(const NodeId& id, const std::shared_ptr<RSObjAbsGeometry>& boundsGeometry); 38 void TracePropertiesByNodeName(const NodeId& id, const std::string& nodeName, const RSProperties& properties); 39 void RefreshNodeTraceInfo(); 40 private: 41 RSPropertyTrace() = default; 42 ~RSPropertyTrace() = default; 43 44 void InitNodeAndPropertyInfo(); 45 46 void ClearNodeAndPropertyInfo(); 47 48 bool IsNeedPropertyTrace(const NodeId& id); 49 bool IsNeedPropertyTrace(const std::string& nodeName); 50 51 void DealConfigInputInfo(const std::string& info); 52 bool DealNodeNameConfig(const std::string& info); 53 54 bool IsNeedRefreshConfig(); 55 56 void AddTraceFlag(const std::string& str); 57 58 bool needWriteAllNode_ {false}; 59 bool needTraceAllNode_ {false}; 60 static RSPropertyTrace instance_; 61 std::set<NodeId> nodeIdSet_; 62 std::set<std::string> nodeNameSet_; 63 std::string propertyFileLastModifyTime; 64 }; 65 66 } // namespace Rosen 67 } // namespace OHOS 68 69 #endif // RENDER_SERVICE_BASE_COMMON_RS_PROPERTY_TRACE_H 70