Stop using Stage to get ObjectRegistry 16/238516/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 14 Jul 2020 14:51:48 +0000 (15:51 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 15 Jul 2020 10:41:42 +0000 (10:41 +0000)
Change-Id: I6fce9c63df17f1b78ec5801c6db462513fb27740

automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h
dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/system/common/object-profiler.cpp
dali/internal/system/common/object-profiler.h

index b494a98..4a4ac81 100644 (file)
@@ -356,17 +356,16 @@ struct ObjectDestructionFunctor
   bool& refObjectDestroyedBoolean;
 };
 
-ObjectDestructionTracker::ObjectDestructionTracker()
-  :mRefObjectDestroyed( false)
+ObjectDestructionTracker::ObjectDestructionTracker( ObjectRegistry objectRegistry )
+: mObjectRegistry( objectRegistry ),
+  mRefObjectDestroyed( false)
 {
 }
 
 void ObjectDestructionTracker::Start( Actor actor )
 {
   ObjectDestructionFunctor destructionFunctor( actor.GetObjectPtr(), mRefObjectDestroyed );
-
-  ObjectRegistry objectRegistry = Stage::GetCurrent().GetObjectRegistry();
-  objectRegistry.ObjectDestroyedSignal().Connect( this, destructionFunctor );
+  mObjectRegistry.ObjectDestroyedSignal().Connect( this, destructionFunctor );
 }
 
 bool ObjectDestructionTracker::IsDestroyed()
index 1635ef8..0c5efa3 100644 (file)
@@ -411,8 +411,9 @@ public:
 
   /**
    * @brief Call in main part of code
+   * @param[in] objectRegistry The object Registry being used
    */
-  ObjectDestructionTracker();
+  ObjectDestructionTracker( ObjectRegistry objectRegistry );
 
   /**
    * @brief Call in sub bock of code where the Actor being checked is still alive.
@@ -429,6 +430,7 @@ public:
   bool IsDestroyed();
 
 private:
+  ObjectRegistry mObjectRegistry;
   bool mRefObjectDestroyed;
 };
 
index 08ee6b8..0ee9ba4 100644 (file)
@@ -29,6 +29,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-adaptor-common.h>
 #include <dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
 
 using namespace Dali::Accessibility;
 using namespace Dali;
@@ -759,7 +760,7 @@ Accessible* Accessible::Get( Dali::Actor actor, bool root )
   {
     if( nonControlAccessibles.empty() )
     {
-      auto registry = Dali::Stage::GetCurrent().GetObjectRegistry();
+      auto registry = Adaptor::Get().GetObjectRegistry();
       registry.ObjectDestroyedSignal().Connect( []( const Dali::RefObject* obj )
       {
         nonControlAccessibles.erase( obj );
index d1600e9..12008ab 100644 (file)
@@ -193,7 +193,7 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
   const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
   if( 0u < timeInterval )
   {
-    mObjectProfiler = new ObjectProfiler( timeInterval );
+    mObjectProfiler = new ObjectProfiler( mCore->GetObjectRegistry(), timeInterval );
   }
 
   mNotificationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
index 8b632ff..6651190 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdlib.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/profiling.h>
-#include <dali/public-api/common/stage.h>
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/object/type-registry.h>
@@ -37,11 +36,11 @@ namespace Internal
 namespace Adaptor
 {
 
-ObjectProfiler::ObjectProfiler( uint32_t timeInterval )
+ObjectProfiler::ObjectProfiler( Dali::ObjectRegistry objectRegistry, uint32_t timeInterval )
+: mObjectRegistry( objectRegistry )
 {
   // This class must be created after the Stage; this means it doesn't count the initial objects
   // that are created by the stage (base layer, default camera actor)
-  mObjectRegistry = Dali::Stage::GetCurrent().GetObjectRegistry();
 
   mTimer = Dali::Timer::New( timeInterval * 1000 );
   mTimer.TickSignal().Connect( this, &ObjectProfiler::OnTimeout );
index 14b92b0..670f2b0 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_ADAPTOR_OBJECT_PROFILER_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -45,9 +45,10 @@ public:
 
   /**
    * Constructor
+   * @param objectRegistry The objectRegistry
    * @param timeInterval to specify the frequency of reporting
    */
-  ObjectProfiler( uint32_t timeInterval );
+  ObjectProfiler( Dali::ObjectRegistry objectRegistry, uint32_t timeInterval );
 
   /**
    * Destructor