From 5be654ab36dddc7cfdca2c50b7f224e451b5472e Mon Sep 17 00:00:00 2001 From: Agnelo Vaz Date: Thu, 7 Feb 2019 11:02:54 +0000 Subject: [PATCH] Separating Processor Interface from core.h Change-Id: I3adac9125078542b76e791148af1a72b47281dd0 --- automated-tests/src/dali/utc-Dali-Processors.cpp | 54 +++++++++++++++++++++++- dali/integration-api/core.cpp | 3 +- dali/integration-api/core.h | 20 +-------- dali/integration-api/file.list | 1 + dali/integration-api/processor-interface.h | 54 ++++++++++++++++++++++++ dali/internal/common/core-impl.cpp | 3 +- 6 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 dali/integration-api/processor-interface.h diff --git a/automated-tests/src/dali/utc-Dali-Processors.cpp b/automated-tests/src/dali/utc-Dali-Processors.cpp index 0d45357..fb1d139 100644 --- a/automated-tests/src/dali/utc-Dali-Processors.cpp +++ b/automated-tests/src/dali/utc-Dali-Processors.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -19,6 +19,7 @@ #include #include #include +#include using namespace Dali; @@ -26,6 +27,7 @@ using namespace Dali; class TestProcessor : public Integration::Processor { public: + TestProcessor() : processRun(false) { @@ -66,3 +68,53 @@ int UtcDaliCoreProcessorP(void) END_TEST; } + +int UtcDaliCoreProcessorMultipleP(void) +{ + TestApplication application; + + TestProcessor testProcessor1; + TestProcessor testProcessor2; + TestProcessor testProcessor3; + + Integration::Core& core = application.GetCore(); + core.RegisterProcessor( testProcessor1 ); + + tet_infoline("Test that the processor has not been executed yet:"); + DALI_TEST_CHECK( testProcessor1.processRun == false ); + + application.SendNotification(); + + tet_infoline("Test that the processor has been executed:"); + DALI_TEST_CHECK( testProcessor1.processRun ); + + // Clear down for next part of test + testProcessor1.processRun = false; + + core.RegisterProcessor( testProcessor2 ); + core.RegisterProcessor( testProcessor3 ); + + tet_infoline("Test that the processors have not been executed yet:"); + DALI_TEST_CHECK( testProcessor1.processRun == false ); + DALI_TEST_CHECK( testProcessor2.processRun == false ); + DALI_TEST_CHECK( testProcessor3.processRun == false ); + + application.SendNotification(); + + tet_infoline("Test that the processors have been executed:"); + DALI_TEST_CHECK( testProcessor1.processRun ); + DALI_TEST_CHECK( testProcessor2.processRun ); + DALI_TEST_CHECK( testProcessor3.processRun ); + + // Clear down for next part of test + testProcessor2.processRun = false; + + core.UnregisterProcessor( testProcessor2 ); + application.SendNotification(); + tet_infoline("Test that the unregistered processor has not been executed again but others have"); + DALI_TEST_CHECK( testProcessor1.processRun ); + DALI_TEST_CHECK( testProcessor2.processRun == false ); + DALI_TEST_CHECK( testProcessor3.processRun ); + + END_TEST; +} \ No newline at end of file diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index cf6c17e..d8a8530 100644 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -22,6 +22,7 @@ #include #include #include +#include #include namespace Dali diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index d8ba428..87082ac 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_CORE_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -37,12 +37,12 @@ class Core; namespace Integration { - class Core; class GestureManager; class GlAbstraction; class GlSyncAbstraction; class PlatformAbstraction; +class Processor; class RenderController; class SystemOverlay; struct Event; @@ -177,22 +177,6 @@ private: bool needsPostRender :1; ///< True if post-render is required to be run. }; -/** - * Interface to enable classes to be processed after the event loop. Classes are processed - * in the order they are registered. - */ -class DALI_CORE_API Processor -{ -public: - /** - * @brief Run the processor - */ - virtual void Process() = 0; - -protected: - virtual ~Processor() { } -}; - /** * Integration::Core is used for integration with the native windowing system. diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 3534cab..47d654e 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -41,6 +41,7 @@ platform_abstraction_header_files = \ $(platform_abstraction_src_dir)/gesture-manager.h \ $(platform_abstraction_src_dir)/render-controller.h \ $(platform_abstraction_src_dir)/platform-abstraction.h \ + $(platform_abstraction_src_dir)/processor-interface.h \ $(platform_abstraction_src_dir)/system-overlay.h \ $(platform_abstraction_src_dir)/lockless-buffer.h \ $(platform_abstraction_src_dir)/render-task-list-integ.h diff --git a/dali/integration-api/processor-interface.h b/dali/integration-api/processor-interface.h new file mode 100644 index 0000000..1043ac3 --- /dev/null +++ b/dali/integration-api/processor-interface.h @@ -0,0 +1,54 @@ +#ifndef DALI_INTEGRATION_PROCESSOR_INTERFACE_H +#define DALI_INTEGRATION_PROCESSOR_INTERFACE_H + +/* + * Copyright (c) 2019 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Integration +{ + +/** + * Interface to enable classes to be processed after the event loop. Classes are processed + * in the order they are registered. + */ +class DALI_CORE_API Processor +{ +public: + /** + * @brief Run the processor + */ + virtual void Process() = 0; + +protected: + + /** + * Virtual protected destructor + */ + virtual ~Processor() { } +}; + +} // Dali + +} // Integration + +#endif // DALI_INTEGRATION_PROCESSOR_INTERFACE_H \ No newline at end of file diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 6b59def..d3d57f1 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -25,6 +25,7 @@ #include #include #include +#include #include #include -- 2.7.4