X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fadaptor-impl.h;h=d24b83039e63484e7ad5bac012167a4215cb1135;hb=815490375bbb42ef8454fa5f474268084e08b62f;hp=a62bede62aff82a201eb3bdda92297fc1ea8a1bc;hpb=1d0d7873858fd2010b71e5db8f03654fb307370f;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h old mode 100755 new mode 100644 index a62bede..d24b830 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ADAPTOR_IMPL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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,19 +19,20 @@ */ // EXTERNAL INCLUDES +#include +#include +#include #include #include -#include #include -#include +#include // INTERNAL INCLUDES -#include #include -#include #include #include #include +#include #include #include #include @@ -42,23 +43,29 @@ #include #include #include +#include + +#include namespace Dali { - class RenderSurfaceInterface; +namespace Accessibility +{ +class Bridge; +} + namespace Integration { class Core; class GlAbstraction; class Processor; class AddOnManager; -} +} // namespace Integration namespace Internal { - namespace Adaptor { class DisplayConnection; @@ -88,11 +95,10 @@ class Adaptor : public Integration::RenderController, public WindowVisibilityObserver { public: - - using AdaptorSignalType = Dali::Adaptor::AdaptorSignalType; + using AdaptorSignalType = Dali::Adaptor::AdaptorSignalType; using WindowCreatedSignalType = Dali::Adaptor::WindowCreatedSignalType; - using SurfaceSize = Uint16Pair; ///< Surface size type + using SurfaceSize = Uint16Pair; ///< Surface size type /** * Creates a New Adaptor @@ -101,18 +107,20 @@ public: * - Pixmap, adaptor will use existing Pixmap to draw on to * - Window, adaptor will use existing Window to draw on to * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. + * @param[in] threadMode The thread mode */ - static Dali::Adaptor* New( Dali::Integration::SceneHolder window, - Dali::RenderSurfaceInterface* surface, - EnvironmentOptions* environmentOptions ); + static Dali::Adaptor* New(Dali::Integration::SceneHolder window, + Dali::RenderSurfaceInterface* surface, + EnvironmentOptions* environmentOptions, + ThreadMode threadMode); /** * Creates a New Adaptor * @param[in] window The window handle * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. */ - static Dali::Adaptor* New( Dali::Integration::SceneHolder window, - EnvironmentOptions* environmentOptions ); + static Dali::Adaptor* New(Dali::Integration::SceneHolder window, + EnvironmentOptions* environmentOptions); /** * Creates a New Adaptor @@ -122,11 +130,13 @@ public: * - Pixmap, adaptor will use existing Pixmap to draw on to * - Window, adaptor will use existing Window to draw on to * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. + * @param[in] threadMode The thread mode */ - static Dali::Adaptor* New( GraphicsFactory& graphicsFactory, - Dali::Integration::SceneHolder window, - Dali::RenderSurfaceInterface* surface, - EnvironmentOptions* environmentOptions ); + static Dali::Adaptor* New(GraphicsFactory& graphicsFactory, + Dali::Integration::SceneHolder window, + Dali::RenderSurfaceInterface* surface, + EnvironmentOptions* environmentOptions, + ThreadMode threadMode); /** * Creates a New Adaptor @@ -134,15 +144,15 @@ public: * @param[in] window The window handle * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. */ - static Dali::Adaptor* New( GraphicsFactory& graphicsFactory, - Dali::Integration::SceneHolder window, - EnvironmentOptions* environmentOptions ); + static Dali::Adaptor* New(GraphicsFactory& graphicsFactory, + Dali::Integration::SceneHolder window, + EnvironmentOptions* environmentOptions); /** * 2-step initialisation, this should be called after creating an adaptor instance. * @param[in] graphicsFactory A factory that creates the graphics interface */ - void Initialize( GraphicsFactory& graphicsFactory ); + void Initialize(GraphicsFactory& graphicsFactory); /** * Virtual destructor. @@ -164,6 +174,8 @@ public: */ void SceneCreated(); + static std::string GetApplicationPackageName(); + public: // AdaptorInternalServices implementation /** * @copydoc Dali::Adaptor::Start() @@ -198,22 +210,22 @@ public: // AdaptorInternalServices implementation /** * @copydoc Dali::EventFeeder::FeedTouchPoint() */ - virtual void FeedTouchPoint( TouchPoint& point, int timeStamp ); + virtual void FeedTouchPoint(TouchPoint& point, int timeStamp); /** * @copydoc Dali::EventFeeder::FeedWheelEvent() */ - virtual void FeedWheelEvent( Dali::WheelEvent& wheelEvent ); + virtual void FeedWheelEvent(Dali::WheelEvent& wheelEvent); /** * @copydoc Dali::EventFeeder::FeedKeyEvent() */ - virtual void FeedKeyEvent( Dali::KeyEvent& keyEvent ); + virtual void FeedKeyEvent(Dali::KeyEvent& keyEvent); /** * @copydoc Dali::Adaptor::ReplaceSurface() */ - virtual void ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface ); + virtual void ReplaceSurface(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface); /** * @copydoc Dali::Adaptor::GetSurface() @@ -235,31 +247,31 @@ public: // AdaptorInternalServices implementation /** * @copydoc Dali::Adaptor::AddIdle() */ - virtual bool AddIdle( CallbackBase* callback, bool hasReturnValue, bool forceAdd ); + virtual bool AddIdle(CallbackBase* callback, bool hasReturnValue, bool forceAdd); /** * Adds a new Window instance to the Adaptor * @param[in] childWindow The child window instance */ - virtual bool AddWindow( Dali::Integration::SceneHolder childWindow ); + virtual bool AddWindow(Dali::Integration::SceneHolder childWindow); /** * Removes an existing Window instance from the Adaptor * @param[in] window The Window instance */ - virtual bool RemoveWindow( Dali::Integration::SceneHolder* childWindow ); + virtual bool RemoveWindow(Dali::Integration::SceneHolder* childWindow); /** * Removes an existing Window instance from the Adaptor * @param[in] windowName The Window name * @note If two Windows have the same name, the first one that matches will be removed */ - virtual bool RemoveWindow( std::string childWindowName ); + virtual bool RemoveWindow(std::string childWindowName); /** * @copydoc Dali::Adaptor::RemoveIdle() */ - virtual void RemoveIdle( CallbackBase* callback ); + virtual void RemoveIdle(CallbackBase* callback); /** * @copydoc Dali::Adaptor::ProcessIdle() @@ -269,19 +281,19 @@ public: // AdaptorInternalServices implementation /** * Sets a pre-render callback. */ - void SetPreRenderCallback( CallbackBase* callback ); + void SetPreRenderCallback(CallbackBase* callback); /** * Removes an existing Window instance from the Adaptor * @param[in] childWindow The Window instance */ - bool RemoveWindow( Dali::Internal::Adaptor::SceneHolder* childWindow ); + bool RemoveWindow(Dali::Internal::Adaptor::SceneHolder* childWindow); /** * @brief Deletes the rendering surface * @param[in] surface to delete */ - void DeleteSurface( Dali::RenderSurfaceInterface& surface ); + void DeleteSurface(Dali::RenderSurfaceInterface& surface); /** * @brief Retrieve the window that the given actor is added to. @@ -289,7 +301,7 @@ public: // AdaptorInternalServices implementation * @param[in] actor The actor * @return The window the actor is added to or a null pointer if the actor is not added to any widnow. */ - Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor ); + Dali::Internal::Adaptor::SceneHolder* GetWindow(Dali::Actor& actor); /** * @copydoc Dali::Adaptor::GetWindows() @@ -307,7 +319,6 @@ public: // AdaptorInternalServices implementation Dali::ObjectRegistry GetObjectRegistry() const; public: - /** * @return the Core instance */ @@ -316,7 +327,7 @@ public: /** * @copydoc Dali::Adaptor::SetRenderRefreshRate() */ - void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ); + void SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender); /** * Return the PlatformAbstraction. @@ -343,7 +354,7 @@ public: * @param[in] actor The actor * @return native window handle */ - Any GetNativeWindowHandle( Dali::Actor actor ); + Any GetNativeWindowHandle(Dali::Actor actor); /** * Get the native display associated with the graphics backend @@ -359,20 +370,19 @@ public: void SetUseRemoteSurface(bool useRemoteSurface); public: - /** * Adds an adaptor observer so that we can observe the adaptor's lifetime events. * @param[in] observer The observer. * @note Observers should remove themselves when they are destroyed. */ - void AddObserver( LifeCycleObserver& observer ); + void AddObserver(LifeCycleObserver& observer); /** * Removes the observer from the adaptor. * @param[in] observer The observer to remove. * @note Observers should remove themselves when they are destroyed. */ - void RemoveObserver( LifeCycleObserver& observer ); + void RemoveObserver(LifeCycleObserver& observer); /** * Emits the Notification event to the Dali core. @@ -397,23 +407,29 @@ public: /** * Gets AppId of current application */ - void GetAppId( std::string& appId ); + void GetAppId(std::string& appId); + + /** + * Gets path for resource storage. + * @param[out] path Path for resource storage + */ + void GetResourceStoragePath(std::string& path); /** * @copydoc Dali::Adaptor::SurfaceResizePrepare */ - void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ); + void SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize); /** * @copydoc Dali::Adaptor::SurfaceResizeComplete */ - void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize ); + void SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize); /** * Sets layout direction of root by system language * @param[in] locale System locale */ - void SetRootLayoutDirection( std::string locale ); + void SetRootLayoutDirection(std::string locale); /** * @copydoc Dali::Adaptor::RenderOnce @@ -428,20 +444,19 @@ public: /** * @copydoc Dali::Adaptor::RegisterProcessor */ - void RegisterProcessor( Integration::Processor& processor ); + void RegisterProcessor(Integration::Processor& processor, bool postProcessor); /** * @coydoc Dali::Adaptor::UnregisterProcessor */ - void UnregisterProcessor( Integration::Processor& processor ); + void UnregisterProcessor(Integration::Processor& processor, bool postProcessor); /** * Check MultipleWindow is supported */ bool IsMultipleWindowSupported() const; -public: //AdaptorInternalServices - +public: //AdaptorInternalServices /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetPlatformAbstractionInterface() */ @@ -490,10 +505,9 @@ public: //AdaptorInternalServices /** * copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetWindowContainerInterface() */ - void GetWindowContainerInterface( WindowContainer& windows ) override; + void GetWindowContainerInterface(WindowContainer& windows) override; public: // Signals - /** * @copydoc Dali::Adaptor::SignalResized */ @@ -519,33 +533,29 @@ public: // Signals } public: // From Dali::Internal::Adaptor::CoreEventInterface - /** * @copydoc Dali::Internal::Adaptor:CoreEventInterface:::ProcessCoreEvents() */ void ProcessCoreEvents() override; private: // From Dali::Internal::Adaptor::CoreEventInterface - /** * @copydoc Dali::Internal::Adaptor::CoreEventInterface::QueueCoreEvent() */ void QueueCoreEvent(const Dali::Integration::Event& event) override; private: // From Dali::Integration::RenderController - /** * @copydoc Dali::Integration::RenderController::RequestUpdate() */ - void RequestUpdate( bool forceUpdate ) override; + void RequestUpdate(bool forceUpdate) override; /** * @copydoc Dali::Integration::RenderController::RequestProcessEventsOnIdle() */ - void RequestProcessEventsOnIdle( bool forceProcess ) override; + void RequestProcessEventsOnIdle(bool forceProcess) override; public: // From Dali::Internal::Adaptor::WindowVisibilityObserver - /** * Called when the window becomes fully or partially visible. */ @@ -557,25 +567,22 @@ public: // From Dali::Internal::Adaptor::WindowVisibilityObserver void OnWindowHidden() override; private: // From Dali::Internal::Adaptor::DamageObserver - /** * @copydoc Dali::Internal::Adaptor::DamageObserver::OnDamaged() */ - void OnDamaged( const DamageArea& area ) override; + void OnDamaged(const DamageArea& area) override; private: - // Undefined Adaptor(const Adaptor&) = delete; Adaptor& operator=(Adaptor&) = delete; private: - /** * Assigns the render surface to the adaptor * */ - void SetSurface(Dali::RenderSurfaceInterface *surface); + void SetSurface(Dali::RenderSurfaceInterface* surface); /** * called after surface is created @@ -607,15 +614,19 @@ private: * @endcode * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback. */ - bool AddIdleEnterer( CallbackBase* callback, bool forceAdd ); + bool AddIdleEnterer(CallbackBase* callback, bool forceAdd); /** * Removes a previously added the idle enterer callback. */ - void RemoveIdleEnterer( CallbackBase* callback ); + void RemoveIdleEnterer(CallbackBase* callback); -private: + /** + * Trigger to log the memory pools from Core and Adaptor + */ + bool MemoryPoolTimeout(); +private: /** * Constructor * @param[in] window window handle @@ -624,11 +635,11 @@ private: * - Pixmap, adaptor will use existing Pixmap to draw on to * - Window, adaptor will use existing Window to draw on to * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created. + * @param[in] threadMode The ThreadMode of the Adaptor */ - Adaptor( Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions ); + Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode); private: // Types - enum State { READY, ///< Initial state before Adaptor::Start is called. @@ -641,56 +652,68 @@ private: // Types // There is no weak handle for BaseHandle in DALi, but we can't ref count the window here, // so we have to store the raw pointer. - using WindowContainer = std::vector; + using WindowContainer = std::vector; using ObserverContainer = std::vector; -private: // Data - - AdaptorSignalType mResizedSignal; ///< Resized signal. - AdaptorSignalType mLanguageChangedSignal; ///< Language changed signal. - WindowCreatedSignalType mWindowCreatedSignal; ///< Window created signal. - - Dali::Adaptor& mAdaptor; ///< Reference to public adaptor instance. - State mState; ///< Current state of the adaptor - Dali::Integration::Core* mCore; ///< Dali Core - ThreadController* mThreadController; ///< Controls the threads - - std::unique_ptr< GraphicsInterface > mGraphics; ///< Graphics interface - Dali::DisplayConnection* mDisplayConnection; ///< Display connection - WindowContainer mWindows; ///< A container of all the Windows that are currently created - - std::unique_ptr mConfigurationManager; ///< Configuration manager - - TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction - - CallbackManager* mCallbackManager; ///< Used to install callbacks - bool mNotificationOnIdleInstalled; ///< whether the idle handler is installed to send an notification event - TriggerEventInterface* mNotificationTrigger; ///< Notification event trigger - FeedbackPluginProxy* mDaliFeedbackPlugin; ///< Used to access feedback support - FeedbackController* mFeedbackController; ///< Plays feedback effects for Dali-Toolkit UI Controls. - Dali::TtsPlayer mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support - ObserverContainer mObservers; ///< A list of adaptor observer pointers - EnvironmentOptions* mEnvironmentOptions; ///< environment options - PerformanceInterface* mPerformanceInterface; ///< Performance interface - KernelTrace mKernelTracer; ///< Kernel tracer - SystemTrace mSystemTracer; ///< System tracer - ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling - SocketFactory mSocketFactory; ///< Socket factory - ThreadMode mThreadMode; ///< The thread mode - const bool mEnvironmentOptionsOwned:1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it) - bool mUseRemoteSurface:1; ///< whether the remoteSurface is used or not - Dali::LayoutDirection::Type mRootLayoutDirection; ///< LayoutDirection of window - - std::unique_ptr mAddOnManager; ///< Pointer to the addon manager +private: // Data + AdaptorSignalType mResizedSignal; ///< Resized signal. + AdaptorSignalType mLanguageChangedSignal; ///< Language changed signal. + WindowCreatedSignalType mWindowCreatedSignal; ///< Window created signal. + + Dali::Adaptor& mAdaptor; ///< Reference to public adaptor instance. + State mState; ///< Current state of the adaptor + Dali::Integration::Core* mCore; ///< Dali Core + ThreadController* mThreadController; ///< Controls the threads + + std::unique_ptr mGraphics; ///< Graphics interface + Dali::DisplayConnection* mDisplayConnection; ///< Display connection + WindowContainer mWindows; ///< A container of all the Windows that are currently created + + std::unique_ptr mConfigurationManager; ///< Configuration manager + + TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction + + CallbackManager* mCallbackManager; ///< Used to install callbacks + bool mNotificationOnIdleInstalled; ///< whether the idle handler is installed to send an notification event + TriggerEventInterface* mNotificationTrigger; ///< Notification event trigger + FeedbackPluginProxy* mDaliFeedbackPlugin; ///< Used to access feedback support + FeedbackController* mFeedbackController; ///< Plays feedback effects for Dali-Toolkit UI Controls. + Dali::TtsPlayer mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support + ObserverContainer mObservers; ///< A list of adaptor observer pointers + EnvironmentOptions* mEnvironmentOptions; ///< environment options + PerformanceInterface* mPerformanceInterface; ///< Performance interface + KernelTrace mKernelTracer; ///< Kernel tracer + SystemTrace mSystemTracer; ///< System tracer + ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling + Dali::Timer mMemoryPoolTimer; ///< Logs memory pool capacity + SlotDelegate mMemoryPoolTimerSlotDelegate; + SocketFactory mSocketFactory; ///< Socket factory + Mutex mMutex; ///< Mutex + ThreadMode mThreadMode; ///< The thread mode + const bool mEnvironmentOptionsOwned : 1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it) + bool mUseRemoteSurface : 1; ///< whether the remoteSurface is used or not + Dali::LayoutDirection::Type mRootLayoutDirection; ///< LayoutDirection of window + + std::unique_ptr mAddOnManager; ///< Pointer to the addon manager + + class AccessibilityObserver : public ConnectionTracker + { + public: + void OnAccessibleKeyEvent(const Dali::KeyEvent& event); + }; + AccessibilityObserver mAccessibilityObserver; public: - inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) { return *adaptor.mImpl; } + inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) + { + return *adaptor.mImpl; + } }; -} // namespace Internal - } // namespace Adaptor +} // namespace Internal + } // namespace Dali #endif // DALI_INTERNAL_ADAPTOR_IMPL_H