From: Eunki, Hong Date: Tue, 19 Sep 2023 02:03:05 +0000 (+0900) Subject: ProcessEvents on idle when we call Awake during processing X-Git-Tag: dali_2.2.46~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e92b19cbcae4ef27a8248653aa152fcca109dc88;p=platform%2Fcore%2Fuifw%2Fdali-csharp-binder.git ProcessEvents on idle when we call Awake during processing Change-Id: Ic2b9de8e1c8a6d4fc3d694b4704a3dd5cd1b133d Signed-off-by: Eunki, Hong --- diff --git a/dali-csharp-binder/common/processor-controller.cpp b/dali-csharp-binder/common/processor-controller.cpp index d8d699b..fa2222e 100644 --- a/dali-csharp-binder/common/processor-controller.cpp +++ b/dali-csharp-binder/common/processor-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "processor-controller.h" +#include // EXTERNAL INCLUDES #include @@ -29,7 +29,9 @@ extern "C" { ProcessorController::ProcessorController() : mHandler(nullptr), mPostHandler(nullptr), - mKeepRenderingApplied(false) + mKeepRenderingApplied(false), + mProcessingEvents(false), + mProcessEventsIdleRequested(false) { { try @@ -59,6 +61,10 @@ void ProcessorController::Process(bool postProcessor) { // We will ignore Awake events during Process running mKeepRenderingApplied = true; + + // Mark as we are processing now. + mProcessingEvents = true; + if(DALI_LIKELY(mHandler != nullptr)) { mHandler(); @@ -72,6 +78,10 @@ void ProcessorController::Process(bool postProcessor) } // Make awake events can be applied after PostProcess done. mKeepRenderingApplied = false; + + // Clean up processing and events idle request flag. + mProcessingEvents = false; + mProcessEventsIdleRequested = false; } } @@ -96,15 +106,24 @@ void ProcessorController::RemovePostCallback( ProcessorControllerProcessCallbac void ProcessorController::Awake() { - if(DALI_UNLIKELY(!mKeepRenderingApplied)) + if(!mProcessingEvents && !mKeepRenderingApplied) { - if(DALI_LIKELY(Dali::Stage::IsInstalled())) + if(DALI_LIKELY(Dali::Stage::IsInstalled())) ///< Avoid worker thread calling. { auto stage = Dali::Stage::GetCurrent(); stage.KeepRendering(0.0f); mKeepRenderingApplied = true; } } + else if(mProcessingEvents && !mProcessEventsIdleRequested) + { + if(DALI_LIKELY(Dali::Stage::IsInstalled())) ///< Avoid worker thread calling. + { + // Request ProcessEvents on idle when we are processing now. + Dali::Adaptor::Get().RequestProcessEventsOnIdle(); + mProcessEventsIdleRequested = true; + } + } } // ProcessorController Bindings diff --git a/dali-csharp-binder/common/processor-controller.h b/dali-csharp-binder/common/processor-controller.h index 25ab994..e6569fc 100644 --- a/dali-csharp-binder/common/processor-controller.h +++ b/dali-csharp-binder/common/processor-controller.h @@ -2,7 +2,7 @@ #define CSHARP_PROCESSOR_CONTROLLER_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -80,7 +80,7 @@ public: void RemovePostCallback( ProcessorControllerProcessCallback postCallback ); /** - * @brief Awake update thread so dali-core calls the overriden Process() api. + * @brief Layout and awake update thread, or re-run registered processor. */ void Awake(); @@ -88,7 +88,10 @@ private: ProcessorControllerProcessCallback mHandler; ///< PreProcessHandler before Relayout ProcessorControllerProcessCallback mPostHandler; ///< PostProcessHandler after Relayout - bool mKeepRenderingApplied; ///< True if we call Stage::KeepRendering(0.0f). It need to avoid duplicated keep rendering call + + 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. }; #endif // CSHARP_PROCESSOR_CONTROLLER_H \ No newline at end of file