From bb95ecef40566f0ab54d6d3b2af4784324b826c0 Mon Sep 17 00:00:00 2001 From: Paul Wisbey Date: Wed, 11 Mar 2020 09:51:54 +0000 Subject: [PATCH] Removed Adaptor::Get() dependency from TriggerEventFactory Change-Id: I2aedef73ef819098a6e95ad08afe01b419ee9aef --- .../adaptor-framework/event-thread-callback.cpp | 15 +--- .../trigger-event-factory-interface.h | 83 ---------------------- .../adaptor-framework/trigger-event-factory.h | 27 ++----- dali/integration-api/file.list | 1 - dali/internal/adaptor/common/adaptor-impl.cpp | 8 +-- dali/internal/adaptor/common/adaptor-impl.h | 6 -- .../adaptor/common/adaptor-internal-services.h | 6 -- .../common/combined-update-render-controller.cpp | 3 +- .../network/common/network-performance-client.cpp | 6 +- .../network/common/network-performance-client.h | 5 +- .../network/common/network-performance-server.cpp | 4 +- .../network/common/network-performance-server.h | 2 - .../window-system/common/window-render-surface.cpp | 5 +- 13 files changed, 18 insertions(+), 153 deletions(-) delete mode 100644 dali/integration-api/adaptor-framework/trigger-event-factory-interface.h diff --git a/dali/devel-api/adaptor-framework/event-thread-callback.cpp b/dali/devel-api/adaptor-framework/event-thread-callback.cpp index 6a5d199..366d03f 100644 --- a/dali/devel-api/adaptor-framework/event-thread-callback.cpp +++ b/dali/devel-api/adaptor-framework/event-thread-callback.cpp @@ -18,7 +18,7 @@ #include // INTERNAL INCLUDES -#include +#include namespace Dali { @@ -31,21 +31,12 @@ struct EventThreadCallback::Impl EventThreadCallback::EventThreadCallback( CallbackBase* callback ) : mImpl( new Impl() ) { - mImpl->eventTrigger = NULL; - if ( Adaptor::IsAvailable() ) - { - Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation( Adaptor::Get() ); - mImpl->eventTrigger = adaptorImpl.GetTriggerEventFactoryInterface().CreateTriggerEvent( callback, TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); - } + mImpl->eventTrigger = TriggerEventFactory::CreateTriggerEvent( callback, TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); } EventThreadCallback::~EventThreadCallback() { - if ( Adaptor::IsAvailable() ) - { - Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation( Adaptor::Get() ); - adaptorImpl.GetTriggerEventFactoryInterface().DestroyTriggerEvent( mImpl->eventTrigger ); - } + TriggerEventFactory::DestroyTriggerEvent( mImpl->eventTrigger ); delete mImpl; } diff --git a/dali/integration-api/adaptor-framework/trigger-event-factory-interface.h b/dali/integration-api/adaptor-framework/trigger-event-factory-interface.h deleted file mode 100644 index 3f67ebb..0000000 --- a/dali/integration-api/adaptor-framework/trigger-event-factory-interface.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_INTERFACE_H -#define DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_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. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -/** - * @brief Trigger interface factory class for creating a TriggerEvents - * - */ -class TriggerEventFactoryInterface -{ -public: - - - /** - * @brief Create a new concrete implementation of the event trigger interface. - * @param callback called when interface->Trigger() is called - * @param options TriggerEventInterface option - * @return pointer to a new trigger event - * @note Ownership of callback should be taken over by deriving classes - */ - virtual TriggerEventInterface* CreateTriggerEvent( CallbackBase* callback, - TriggerEventInterface::Options options ) = 0; - /** - * @brief destroy a trigger event - * @param triggerEventInterface event to destroy - */ - virtual void DestroyTriggerEvent( TriggerEventInterface* triggerEventInterface ) = 0; - -protected: - - /** - * @brief Constructor - */ - TriggerEventFactoryInterface() - { - } - - /** - * @brief Virtual Destructor - */ - virtual ~TriggerEventFactoryInterface() - { - } - -private: - - - // Undefined copy constructor. - TriggerEventFactoryInterface( const TriggerEventFactoryInterface& ); - - // Undefined assignment operator. - TriggerEventFactoryInterface& operator=( const TriggerEventFactoryInterface& ); - -}; - -} // namespace Dali - -#endif // DALI_INTEGRATION_TRIGGER_EVENT_FACTORY_INTERFACE_H diff --git a/dali/integration-api/adaptor-framework/trigger-event-factory.h b/dali/integration-api/adaptor-framework/trigger-event-factory.h index 5e889a9..0127de5 100644 --- a/dali/integration-api/adaptor-framework/trigger-event-factory.h +++ b/dali/integration-api/adaptor-framework/trigger-event-factory.h @@ -18,9 +18,12 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include -#include +#include namespace Dali { @@ -29,35 +32,19 @@ namespace Dali * @brief Trigger interface factory class * */ -class DALI_ADAPTOR_API TriggerEventFactory : public TriggerEventFactoryInterface +class DALI_ADAPTOR_API TriggerEventFactory { - public: /** - * @brief Constructor - */ - TriggerEventFactory() - { - } - - /** - * @brief Destructor - */ - virtual ~TriggerEventFactory() - { - } - - /** * @copydoc TriggerEventFactoryInterface::CreateTriggerEvent */ - virtual TriggerEventInterface* CreateTriggerEvent( CallbackBase* callback, TriggerEventInterface::Options options ); - + static TriggerEventInterface* CreateTriggerEvent( CallbackBase* callback, TriggerEventInterface::Options options ); /** * @copydoc TriggerEventFactoryInterface::DestroyTriggerEvent */ - virtual void DestroyTriggerEvent( TriggerEventInterface* triggerEventInterface ); + static void DestroyTriggerEvent( TriggerEventInterface* triggerEventInterface ); }; diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 5b84571..0a5b4df 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -17,7 +17,6 @@ SET( adaptor_integration_api_header_files ${adaptor_integration_api_dir}/adaptor-framework/scene-holder-impl.h ${adaptor_integration_api_dir}/adaptor-framework/thread-synchronization-interface.h ${adaptor_integration_api_dir}/adaptor-framework/trigger-event-interface.h - ${adaptor_integration_api_dir}/adaptor-framework/trigger-event-factory-interface.h ${adaptor_integration_api_dir}/adaptor-framework/trigger-event-factory.h ) diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 4d1782f..fa01ca3 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -192,7 +192,7 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: mObjectProfiler = new ObjectProfiler( timeInterval ); } - mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER); + mNotificationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER); mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow->GetSurface()->GetSurfaceType() ); @@ -717,11 +717,6 @@ TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger() return *mNotificationTrigger; } -TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface() -{ - return mTriggerEventFactory; -} - SocketFactoryInterface& Adaptor::GetSocketFactoryInterface() { return mSocketFactory; @@ -1128,7 +1123,6 @@ Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, mPerformanceInterface( nullptr ), mKernelTracer(), mSystemTracer(), - mTriggerEventFactory(), mObjectProfiler( nullptr ), mSocketFactory(), mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ), diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 49e9601..e413529 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -467,11 +467,6 @@ public: //AdaptorInternalServices virtual TriggerEventInterface& GetProcessCoreEventsTrigger(); /** - * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetTriggerEventFactoryInterface() - */ - virtual TriggerEventFactoryInterface& GetTriggerEventFactoryInterface(); - - /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetSocketFactoryInterface() */ virtual SocketFactoryInterface& GetSocketFactoryInterface(); @@ -678,7 +673,6 @@ private: // Data PerformanceInterface* mPerformanceInterface; ///< Performance interface KernelTrace mKernelTracer; ///< Kernel tracer SystemTrace mSystemTracer; ///< System tracer - TriggerEventFactory mTriggerEventFactory; ///< Trigger event factory ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling SocketFactory mSocketFactory; ///< Socket factory const bool mEnvironmentOptionsOwned:1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it) diff --git a/dali/internal/adaptor/common/adaptor-internal-services.h b/dali/internal/adaptor/common/adaptor-internal-services.h index 5648dca..4769f4b 100644 --- a/dali/internal/adaptor/common/adaptor-internal-services.h +++ b/dali/internal/adaptor/common/adaptor-internal-services.h @@ -25,7 +25,6 @@ // INTERNAL INCLUDES #include #include -#include #include #include #include @@ -84,11 +83,6 @@ public: virtual TriggerEventInterface& GetProcessCoreEventsTrigger() = 0; /** - * @return trigger event factory interface - */ - virtual TriggerEventFactoryInterface& GetTriggerEventFactoryInterface() = 0; - - /** * @return socket factory interface */ virtual SocketFactoryInterface& GetSocketFactoryInterface() = 0; diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index a41a613..ecd5b8a 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -132,8 +132,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController( AdaptorInternalS currentSurface->SetThreadSynchronization( *this ); } - TriggerEventFactoryInterface& triggerFactory = mAdaptorInterfaces.GetTriggerEventFactoryInterface(); - mSleepTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &CombinedUpdateRenderController::ProcessSleepRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); + mSleepTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &CombinedUpdateRenderController::ProcessSleepRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); // Initialize to 0 so that it just waits if sem_post has not been called sem_init( &mEventThreadSemaphore, 0, 0 ); diff --git a/dali/internal/network/common/network-performance-client.cpp b/dali/internal/network/common/network-performance-client.cpp index 2a1c301..1185c95 100644 --- a/dali/internal/network/common/network-performance-client.cpp +++ b/dali/internal/network/common/network-performance-client.cpp @@ -120,13 +120,11 @@ private: NetworkPerformanceClient::NetworkPerformanceClient( pthread_t* thread, SocketInterface *socket, unsigned int clientId, - TriggerEventFactoryInterface& triggerEventFactory, ClientSendDataInterface& sendDataInterface, SocketFactoryInterface& socketFactory ) : mThread( thread ), mSocket( socket ), mMarkerBitmask( PerformanceMarker::FILTERING_DISABLED ), - mTriggerEventFactory( triggerEventFactory ), mSendDataInterface( sendDataInterface ), mSocketFactoryInterface( socketFactory ), mClientId( clientId ), @@ -235,7 +233,7 @@ void NetworkPerformanceClient::ProcessCommand( char* buffer, unsigned int buffer callback->AssignDumpSceneCommand(); // create a trigger event that automatically deletes itself after the callback has run in the main thread - TriggerEventInterface *interface = mTriggerEventFactory.CreateTriggerEvent( callback, TriggerEventInterface::DELETE_AFTER_TRIGGER ); + TriggerEventInterface *interface = TriggerEventFactory::CreateTriggerEvent( callback, TriggerEventInterface::DELETE_AFTER_TRIGGER ); // asynchronous call, the call back will be run sometime later on the main thread interface->Trigger(); @@ -249,7 +247,7 @@ void NetworkPerformanceClient::ProcessCommand( char* buffer, unsigned int buffer callback->AssignSetPropertyCommand( stringParam ); // create a trigger event that automatically deletes itself after the callback has run in the main thread - TriggerEventInterface *interface = mTriggerEventFactory.CreateTriggerEvent( callback, TriggerEventInterface::DELETE_AFTER_TRIGGER ); + TriggerEventInterface *interface = TriggerEventFactory::CreateTriggerEvent( callback, TriggerEventInterface::DELETE_AFTER_TRIGGER ); // asynchronous call, the call back will be run sometime later on the main thread interface->Trigger(); diff --git a/dali/internal/network/common/network-performance-client.h b/dali/internal/network/common/network-performance-client.h index 3ea566a..c196b86 100644 --- a/dali/internal/network/common/network-performance-client.h +++ b/dali/internal/network/common/network-performance-client.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace Dali @@ -64,14 +64,12 @@ public: * @param thread thread pointer * @param socket socket interface * @param clientId unique client id - * @param triggerEventFactory used to create trigger events * @param sendDataInterface used to send data to the socket from main thread * @param SocketFactoryInterface used to delete the socket when the client is destroyed */ NetworkPerformanceClient( pthread_t* thread, SocketInterface *socket, unsigned int clientId, - TriggerEventFactoryInterface& triggerEventFactory, ClientSendDataInterface& sendDataInterface, SocketFactoryInterface& socketFactory ); @@ -126,7 +124,6 @@ private: pthread_t* mThread; ///< thread for the client SocketInterface* mSocket; ///< socket interface PerformanceMarker::MarkerFilter mMarkerBitmask; ///< What markers are currently filtered - TriggerEventFactoryInterface& mTriggerEventFactory; ///< Trigger event factory ClientSendDataInterface& mSendDataInterface; ///< used to send data to a client from the main event thread SocketFactoryInterface& mSocketFactoryInterface; ///< used to delete the socket unsigned int mClientId; ///< unique client id diff --git a/dali/internal/network/common/network-performance-server.cpp b/dali/internal/network/common/network-performance-server.cpp index fcd11bf..1f048d0 100644 --- a/dali/internal/network/common/network-performance-server.cpp +++ b/dali/internal/network/common/network-performance-server.cpp @@ -51,8 +51,7 @@ struct ClientThreadInfo NetworkPerformanceServer::NetworkPerformanceServer( AdaptorInternalServices& adaptorServices, const EnvironmentOptions& logOptions ) -: mTriggerEventFactory( adaptorServices.GetTriggerEventFactoryInterface() ), - mSocketFactory( adaptorServices.GetSocketFactoryInterface() ), +: mSocketFactory( adaptorServices.GetSocketFactoryInterface() ), mLogOptions( logOptions ), mServerThread( 0 ), mListeningSocket( NULL ), @@ -243,7 +242,6 @@ NetworkPerformanceClient* NetworkPerformanceServer::AddClient( SocketInterface* NetworkPerformanceClient* client= new NetworkPerformanceClient( clientThread, clientSocket, mClientUniqueId++, - mTriggerEventFactory, *this, mSocketFactory); diff --git a/dali/internal/network/common/network-performance-server.h b/dali/internal/network/common/network-performance-server.h index b5be9ed..0e0d45c 100644 --- a/dali/internal/network/common/network-performance-server.h +++ b/dali/internal/network/common/network-performance-server.h @@ -160,8 +160,6 @@ private: NetworkPerformanceServer( const NetworkPerformanceServer& ); ///< undefined copy constructor NetworkPerformanceServer& operator=( const NetworkPerformanceServer& ); ///< undefined assignment operator - - TriggerEventFactoryInterface& mTriggerEventFactory; ///< used to create trigger events SocketFactoryInterface& mSocketFactory; ///< used to create sockets const EnvironmentOptions& mLogOptions; ///< log options Dali::Vector< NetworkPerformanceClient* > mClients; ///< list of connected clients diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index a5402f5..6d4ba4f 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -24,7 +24,7 @@ // INTERNAL INCLUDES #include -#include +#include #include #include #include @@ -153,8 +153,7 @@ void WindowRenderSurface::RequestRotation( int angle, int width, int height ) if( !mRotationTrigger ) { - TriggerEventFactoryInterface& triggerFactory = Internal::Adaptor::Adaptor::GetImplementation( Adaptor::Get() ).GetTriggerEventFactoryInterface(); - mRotationTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); + mRotationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); } mPositionSize.width = width; -- 2.7.4