From 4c773b86f987f400fe0a630aacb933d301bd93f0 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 27 Dec 2022 12:27:56 +0900 Subject: [PATCH 1/1] Remove object pointer from SceneGraph::PropertyNotification Change-Id: I4cc0912d36e7ff3c39e6b48fecc030432947137f --- .../event/common/property-notification-impl.cpp | 6 ++- .../common/scene-graph-property-notification.cpp | 49 +++++++++------------- .../common/scene-graph-property-notification.h | 43 ++++++++++--------- 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/dali/internal/event/common/property-notification-impl.cpp b/dali/internal/event/common/property-notification-impl.cpp index 648bf97..2d87787 100644 --- a/dali/internal/event/common/property-notification-impl.cpp +++ b/dali/internal/event/common/property-notification-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -207,8 +207,10 @@ void PropertyNotification::CreateSceneObject() // this method can be called from constructor and on stage connection if(!mPropertyNotification) { + const PropertyInputImpl* property = mObject->GetSceneObjectInputProperty(mObjectPropertyIndex); + // Create a new PropertyNotification, keep a const pointer to it - mPropertyNotification = SceneGraph::PropertyNotification::New(*mObject, + mPropertyNotification = SceneGraph::PropertyNotification::New(property, mObjectPropertyIndex, mPropertyType, mComponentIndex, diff --git a/dali/internal/update/common/scene-graph-property-notification.cpp b/dali/internal/update/common/scene-graph-property-notification.cpp index ff4ff43..6fecc5e 100644 --- a/dali/internal/update/common/scene-graph-property-notification.cpp +++ b/dali/internal/update/common/scene-graph-property-notification.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,30 +30,29 @@ namespace Internal { namespace SceneGraph { -PropertyNotification* PropertyNotification::New(Object& object, - Property::Index propertyIndex, - Property::Type propertyType, - int componentIndex, - ConditionType condition, - RawArgumentContainer& arguments, - NotifyMode notifyMode, - bool compare) +PropertyNotification* PropertyNotification::New(const PropertyInputImpl* property, + Property::Index propertyIndex, + Property::Type propertyType, + int componentIndex, + ConditionType condition, + RawArgumentContainer& arguments, + NotifyMode notifyMode, + bool compare) { - return new PropertyNotification(object, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode, compare); + return new PropertyNotification(property, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode, compare); } -PropertyNotification::PropertyNotification(Object& object, - Property::Index propertyIndex, - Property::Type propertyType, - int componentIndex, - ConditionType condition, - RawArgumentContainer& arguments, - NotifyMode notifyMode, - bool compare) -: mObject(&object), - mPropertyIndex(propertyIndex), +PropertyNotification::PropertyNotification(const PropertyInputImpl* property, + Property::Index propertyIndex, + Property::Type propertyType, + int componentIndex, + ConditionType condition, + RawArgumentContainer& arguments, + NotifyMode notifyMode, + bool compare) +: mPropertyIndex(propertyIndex), mPropertyType(propertyType), - mProperty(nullptr), + mProperty(property), mComponentIndex(componentIndex), mConditionType(condition), mArguments(arguments), @@ -108,14 +107,6 @@ PropertyNotification::PropertyNotification(Object& object, break; } } - - mProperty = mObject->GetSceneObjectInputProperty(mPropertyIndex); - int internalComponentIndex = mObject->GetPropertyComponentIndex(mPropertyIndex); - if(internalComponentIndex != Property::INVALID_COMPONENT_INDEX) - { - // override the one passed in - mComponentIndex = internalComponentIndex; - } } PropertyNotification::~PropertyNotification() = default; diff --git a/dali/internal/update/common/scene-graph-property-notification.h b/dali/internal/update/common/scene-graph-property-notification.h index b0a1bc4..90465be 100644 --- a/dali/internal/update/common/scene-graph-property-notification.h +++ b/dali/internal/update/common/scene-graph-property-notification.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_NOTIFICATION_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,8 +54,8 @@ public: /** * Construct a new PropertyNotification - * @param[in] object The event-object for a scene-graph object to inspect. - * @param[in] propertyIndex The index of a property provided by the object. + * @param[in] property The scene graph property to inspect. + * @param[in] propertyIndex The index of a property to insprect. * @param[in] propertyType The type of property we're inspecting. * @param[in] componentIndex Index to the component of a complex property such as a Vector * @param[in] condition The condition type (e.g. LessThan, GreaterThan...) @@ -64,14 +64,14 @@ public: * @param[in] compare The flag of comparing the previous and current data. * @return A new PropertyNotification object. */ - static PropertyNotification* New(Object& object, - Property::Index propertyIndex, - Property::Type propertyType, - int componentIndex, - ConditionType condition, - RawArgumentContainer& arguments, - NotifyMode notifyMode, - bool compare); + static PropertyNotification* New(const PropertyInputImpl* property, + Property::Index propertyIndex, + Property::Type propertyType, + int componentIndex, + ConditionType condition, + RawArgumentContainer& arguments, + NotifyMode notifyMode, + bool compare); /** * Virtual destructor @@ -104,22 +104,22 @@ public: protected: /** * Construct the PropertyNotification - * @param[in] object The event-object for a scene-graph object to inspect. - * @param[in] propertyIndex The index of a property provided by the object. + * @param[in] property The scene graph property to inspect. + * @param[in] propertyIndex The index of a property to inspect. * @param[in] propertyType The type of property we're inspecting. * @param[in] componentIndex Index to the component of a complex property such as a Vector * @param[in] condition The condition type (e.g. LessThan, GreaterThan...) * @param[in] arguments The arguments which accompany the condition. * @param[in] notifyMode The notification mode setting */ - PropertyNotification(Object& object, - Property::Index propertyIndex, - Property::Type propertyType, - int componentIndex, - ConditionType condition, - RawArgumentContainer& arguments, - NotifyMode notifyMode, - bool compare); + PropertyNotification(const PropertyInputImpl* property, + Property::Index propertyIndex, + Property::Type propertyType, + int componentIndex, + ConditionType condition, + RawArgumentContainer& arguments, + NotifyMode notifyMode, + bool compare); private: /** @@ -137,7 +137,6 @@ private: PropertyNotification& operator=(const PropertyNotification& rhs); protected: - Object* mObject; ///< Not owned by the property notification. Valid until ObjectDestroyed() is called. Property::Index mPropertyIndex; ///< The index of this property. Property::Type mPropertyType; ///< The type of property this is. const PropertyInputImpl* mProperty; ///< The scene graph property -- 2.7.4