// EXTERNAL INCLUDES
#include <dali/devel-api/common/stage-devel.h>
#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+namespace
+{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+}
ProcessorController::ProcessorController()
: mHandler(nullptr),
mPostHandler(nullptr),
+ mProcessRegistered(false),
mKeepRenderingApplied(false),
mProcessingEvents(false),
mProcessEventsIdleRequested(false)
{
- {
- try
- {
- Dali::Adaptor::Get().RegisterProcessor(*this);
- Dali::Adaptor::Get().RegisterProcessor(*this, true);
- }
- CALL_CATCH_EXCEPTION();
- }
}
ProcessorController::~ProcessorController()
{
try
{
- Dali::Adaptor::Get().UnregisterProcessor(*this);
- Dali::Adaptor::Get().UnregisterProcessor(*this, true);
+ if(mProcessRegistered)
+ {
+ Dali::Adaptor::Get().UnregisterProcessor(*this);
+ Dali::Adaptor::Get().UnregisterProcessor(*this, true);
+
+ mProcessRegistered = false;
+ }
}
CALL_CATCH_EXCEPTION();
}
if(DALI_LIKELY(mHandler != nullptr))
{
+ DALI_TRACE_SCOPE(gTraceFilter, "NUI_PROCESS");
mHandler();
}
}
else
{
- if(DALI_LIKELY(mPostHandler != nullptr))
+ if(mPostHandler != nullptr)
{
+ DALI_TRACE_SCOPE(gTraceFilter, "NUI_POST_PROCESS");
mPostHandler();
}
// Make awake events can be applied after PostProcess done.
void ProcessorController::Awake()
{
+ DALI_ASSERT_ALWAYS(mProcessRegistered && "ProcessorController should be initialized before call Awake");
+
if(!mProcessingEvents && !mKeepRenderingApplied)
{
if(DALI_LIKELY(Dali::Stage::IsInstalled())) ///< Avoid worker thread calling.
}
}
+void ProcessorController::RegisterProcess()
+{
+ if(!mProcessRegistered)
+ {
+ try
+ {
+ Dali::Adaptor::Get().RegisterProcessor(*this);
+ Dali::Adaptor::Get().RegisterProcessor(*this, true);
+
+ mProcessRegistered = true;
+ }
+ CALL_CATCH_EXCEPTION();
+ }
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// ProcessorController Bindings
SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_ProcessorController() {
}
}
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ProcessorController_Initialize(void* jarg1)
+{
+ ProcessorController* processorController = (ProcessorController *) jarg1;
+
+ if( processorController )
+ {
+ processorController->RegisterProcess();
+ }
+}
+
SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ProcessorController_SetCallback( void* jarg1, ProcessorController::ProcessorControllerProcessCallback callback )
{
ProcessorController* processorController = (ProcessorController *) jarg1;
public:
/**
- * @brief Constructor - creates a ProcessorController and registers it with dali-core.
+ * @brief Constructor - creates a ProcessorController.
*
*/
ProcessorController();
~ProcessorController();
/**
+ * @brief Register this processor into dali-core.
+ */
+ void RegisterProcess();
+
+ /**
* @copydoc Dali::Integration::Processor::Process()
*/
void Process(bool postProcessor) override;
ProcessorControllerProcessCallback mHandler; ///< PreProcessHandler before Relayout
ProcessorControllerProcessCallback mPostHandler; ///< PostProcessHandler after Relayout
+ bool mProcessRegistered : 1; ///< True if we call RegisterProcess. False otherwise.
bool mKeepRenderingApplied : 1; ///< True if we call Stage::KeepRendering(0.0f). It need to avoid duplicated keep rendering call
bool mProcessingEvents : 1; ///< True if we are running Process now.
bool mProcessEventsIdleRequested : 1; ///< True if we call Adaptor::RequestProcessEventsOnIdle(). It need to avoid duplicated request call.