The type registry creation order is dependent on library load order, so it's possible for dali toolkit singletons to be created before adaptor singletons.
Have changed all adaptor singletons to register with the singleton
service in the Get() method, and removed unnecessary type registry
entries for them. Thus, they will be created when first required,
rather than when the type registry tries to create them.
Change-Id: I36281d86f5c769a05feb6c074b55375ddea9359b
Signed-off-by: David Steele <david.steele@samsung.com>
namespace Adaptor
{
-namespace
-{
-BaseHandle Create()
-{
- BaseHandle handle( ClipboardEventNotifier::Get() );
-
- if ( !handle )
- {
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- Dali::ClipboardEventNotifier notifier( ClipboardEventNotifier::New() );
- service.Register( typeid( notifier ), notifier );
- handle = notifier;
- }
- }
-
- return handle;
-}
-TypeRegistration CLIPBOARD_EVENT_NOTIFIER_TYPE( typeid(Dali::ClipboardEventNotifier), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
Dali::ClipboardEventNotifier ClipboardEventNotifier::New()
{
Dali::ClipboardEventNotifier notifier = Dali::ClipboardEventNotifier(new ClipboardEventNotifier());
// If so, downcast the handle
notifier = Dali::ClipboardEventNotifier( dynamic_cast< ClipboardEventNotifier* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ notifier = Dali::ClipboardEventNotifier( ClipboardEventNotifier::New() );
+ service.Register( typeid( notifier ), notifier );
+ }
}
return notifier;
namespace Adaptor
{
-namespace
-{
-
-BaseHandle Create()
-{
- BaseHandle handle( LifecycleController::Get() );
-
- if ( !handle && Adaptor::IsAvailable() )
- {
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- Dali::LifecycleController lifecycleController = Dali::LifecycleController( new LifecycleController() );
- service.Register( typeid( lifecycleController ), lifecycleController );
- handle = lifecycleController;
- }
- }
-
- return handle;
-}
-TypeRegistration LIFECYCLE_CONTROLLER_TYPE( typeid(Dali::LifecycleController), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
Dali::LifecycleController LifecycleController::Get()
{
Dali::LifecycleController lifecycleController;
Dali::Integration::Log::Filter* gLogFilter = Dali::Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_STYLE_MONITOR");
#endif
-BaseHandle Create()
-{
- BaseHandle handle( StyleMonitor::Get() );
-
- if ( !handle && Adaptor::IsAvailable() )
- {
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
- Dali::StyleMonitor styleMonitor = Dali::StyleMonitor( new StyleMonitor( adaptorImpl.GetPlatformAbstraction() ) );
- service.Register( typeid( styleMonitor ), styleMonitor );
- handle = styleMonitor;
- }
- }
-
- return handle;
-}
-TypeRegistration STYLE_MONITOR_TYPE( typeid(Dali::StyleMonitor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
/**
* Use font client to get the system default font family
* @param[in] fontClient handle to font client
Dali::StyleMonitor styleMonitor;
Dali::SingletonService service( SingletonService::Get() );
- if ( service )
+ if( service )
{
// Check whether the singleton is already created
Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::StyleMonitor ) );
- if(handle)
+ if( handle )
{
// If so, downcast the handle
styleMonitor = Dali::StyleMonitor( dynamic_cast< StyleMonitor* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+ styleMonitor = Dali::StyleMonitor( new StyleMonitor( adaptorImpl.GetPlatformAbstraction() ) );
+ service.Register( typeid( styleMonitor ), styleMonitor );
+ }
}
return styleMonitor;
namespace Adaptor
{
-namespace
+struct Clipboard::Impl
{
-BaseHandle Create()
-{
- BaseHandle handle( Clipboard::Get() );
+ // Put implementation here.
+};
- return handle;
+Clipboard::Clipboard(Impl* impl)
+: mImpl(impl)
+{
}
-TypeRegistration CLIPBOARD_TYPE( typeid(Dali::Clipboard), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
Clipboard::~Clipboard()
{
// If so, downcast the handle
clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ Clipboard::Impl* impl( new Clipboard::Impl() );
+ clipboard = Dali::Clipboard( new Clipboard(impl) );
+ service.Register( typeid(Dali::Clipboard), clipboard );
+ }
}
return clipboard;
}
+
bool Clipboard::SetItem(const std::string &itemData )
{
return true;
namespace Adaptor
{
-namespace
-{
-
-BaseHandle Create()
-{
- return ImfManager::Get();
-}
-
-TypeRegistration IMF_MANAGER_TYPE( typeid(Dali::ImfManager), typeid(Dali::BaseHandle), Create );
-
-} // unnamed namespace
-
bool ImfManager::IsAvailable()
{
return false;
}
}
-BaseHandle Create()
+} // unnamed namespace
+
+Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
{
- BaseHandle handle( AccessibilityAdaptor::Get() );
+ Dali::AccessibilityAdaptor adaptor;
- if ( !handle )
+ Dali::SingletonService service( SingletonService::Get() );
+ if ( service )
{
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
+ // Check whether the singleton is already created
+ Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityAdaptor ) );
+ if(handle)
{
- Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
+ // If so, downcast the handle
+ adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
AccessibilityAdaptorMobile& adaptorImpl = AccessibilityAdaptorMobile::GetImplementation( adaptor );
bool isEnabled = GetEnabledVConf();
vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
service.Register( typeid( adaptor ), adaptor );
- handle = adaptor;
- }
- }
-
- return handle;
-}
-
-TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
-Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
-{
- Dali::AccessibilityAdaptor adaptor;
-
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- // Check whether the singleton is already created
- Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityAdaptor ) );
- if(handle)
- {
- // If so, downcast the handle
- adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) );
}
}
namespace Adaptor
{
-namespace
-{
-
-BaseHandle Create()
-{
- return ColorController::Get();
-}
-Dali::TypeRegistration COLOR_CONTROLLER_TYPE( typeid(Dali::ColorController), typeid(Dali::BaseHandle), Create );
-
-}
-
Dali::ColorController ColorController::Get()
{
Dali::ColorController colorController;
}
}
-BaseHandle Create()
+} // unnamed namespace
+
+Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
{
- BaseHandle handle( AccessibilityAdaptor::Get() );
+ Dali::AccessibilityAdaptor adaptor;
- if ( !handle )
+ Dali::SingletonService service( SingletonService::Get() );
+ if ( service )
{
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
+ // Check whether the singleton is already created
+ Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityAdaptor ) );
+ if(handle)
{
- Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
+ // If so, downcast the handle
+ adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
AccessibilityAdaptor& adaptorImpl = AccessibilityAdaptor::GetImplementation( adaptor );
bool isEnabled = GetEnabledVConf();
vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
service.Register( typeid( adaptor ), adaptor );
- handle = adaptor;
- }
- }
-
- return handle;
-}
-
-TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
-Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
-{
- Dali::AccessibilityAdaptor adaptor;
-
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- // Check whether the singleton is already created
- Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityAdaptor ) );
- if(handle)
- {
- // If so, downcast the handle
- adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) );
}
}
namespace // unnamed namespace
{
-// Type Registration
-Dali::BaseHandle Create()
-{
- return Dali::TtsPlayer::Get() ;
-}
-
-Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create );
/**
* Helper function to convert Tizen-specific TTS state to external state.
namespace Adaptor
{
-namespace // unnamed namespace
-{
-
-BaseHandle Create()
-{
- BaseHandle handle( AccessibilityAdaptor::Get() );
-
- if ( !handle )
- {
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
- service.Register( typeid( adaptor ), adaptor );
- handle = adaptor;
- }
- }
-
- return handle;
-}
-
-TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
{
Dali::AccessibilityAdaptor adaptor;
// If so, downcast the handle
adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
+ service.Register( typeid( adaptor ), adaptor );
+ }
}
return adaptor;
namespace Adaptor
{
-namespace // unnamed namespace
-{
-// Type Registration
-Dali::BaseHandle Create()
-{
- return Dali::TtsPlayer::Get() ;
-}
-
-Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create ) ;
-} // unnamed namespace
-
#if defined(DEBUG_ENABLED)
Debug::Filter* TtsPlayer::gLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_TTS_PLAYER");
#endif
} // namespace Internal
} // namespace Dali
-
namespace Adaptor
{
-namespace
+struct Clipboard::Impl
{
-BaseHandle Create()
-{
- BaseHandle handle( Clipboard::Get() );
+ Impl()
+ {
+ }
- return handle;
-}
-TypeRegistration CLIPBOARD_TYPE( typeid(Dali::Clipboard), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
+ // Put implementation here.
+};
-} // unnamed namespace
+Clipboard::Clipboard(Impl* impl)
+: mImpl(impl)
+{
+}
Clipboard::~Clipboard()
{
// If so, downcast the handle
clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ Clipboard::Impl* impl( new Clipboard::Impl() );
+ clipboard = Dali::Clipboard( new Clipboard(impl) );
+ service.Register( typeid(Dali::Clipboard), clipboard );
+ }
}
return clipboard;
namespace Adaptor
{
-namespace
-{
-
-BaseHandle Create()
-{
- return ImfManager::Get();
-}
-
-TypeRegistration IMF_MANAGER_TYPE( typeid(Dali::ImfManager), typeid(Dali::BaseHandle), Create );
-
-} // unnamed namespace
-
bool ImfManager::IsAvailable()
{
return false;
Ecore_X_Window mApplicationWindow;
};
-namespace // unnamed namespace
-{
-
-BaseHandle Create()
-{
- BaseHandle handle( Clipboard::Get() );
-
- if ( !handle && Adaptor::IsAvailable() )
- {
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
- Any nativewindow = adaptorImpl.GetNativeWindowHandle();
-
- // The Ecore_X_Window needs to use the Clipboard.
- // Only when the render surface is window, we can get the Ecore_X_Window.
- Ecore_X_Window ecoreXwin( AnyCast<Ecore_X_Window>(nativewindow) );
- if (ecoreXwin)
- {
- // If we fail to get Ecore_X_Window, we can't use the Clipboard correctly.
- // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
- // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
- Clipboard::Impl* impl( new Clipboard::Impl( ecoreXwin ) );
- Dali::Clipboard clipboard = Dali::Clipboard( new Clipboard( impl ) );
- service.Register( typeid( clipboard ), clipboard );
- handle = clipboard;
- }
- else
- {
- DALI_LOG_ERROR("Failed to get native window handle");
- }
- }
- }
-
- return handle;
-}
-
-TypeRegistration CLIPBOARD_TYPE( typeid(Dali::Clipboard), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
Clipboard::Clipboard(Impl* impl)
: mImpl( impl )
{
// If so, downcast the handle
clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+ Any nativewindow = adaptorImpl.GetNativeWindowHandle();
+
+ // The Ecore_X_Window needs to use the Clipboard.
+ // Only when the render surface is window, we can get the Ecore_X_Window.
+ Ecore_X_Window ecoreXwin( AnyCast<Ecore_X_Window>(nativewindow) );
+ if (ecoreXwin)
+ {
+ // If we fail to get Ecore_X_Window, we can't use the Clipboard correctly.
+ // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
+ // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
+ Clipboard::Impl* impl( new Clipboard::Impl( ecoreXwin ) );
+ clipboard = Dali::Clipboard( new Clipboard( impl ) );
+ service.Register( typeid( clipboard ), clipboard );
+ }
+ }
}
return clipboard;
}
}
-BaseHandle Create()
-{
- return ImfManager::Get();
-}
-
-TypeRegistration IMF_MANAGER_TYPE( typeid(Dali::ImfManager), typeid(Dali::BaseHandle), Create );
-
} // unnamed namespace
bool ImfManager::IsAvailable()