#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/core.h>
+#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/profiling.h>
#include <dali/integration-api/input-options.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <callback-manager.h>
#include <trigger-event.h>
+#include <window-render-surface.h>
#include <render-surface-impl.h>
#include <tts-player-impl.h>
#include <accessibility-manager-impl.h>
} // unnamed namespace
-Dali::Adaptor* Adaptor::New( RenderSurface *surface, const DeviceLayout& baseLayout )
+Dali::Adaptor* Adaptor::New( RenderSurface *surface, const DeviceLayout& baseLayout,
+ Dali::Configuration::ContextLoss configuration )
{
DALI_ASSERT_ALWAYS( surface->GetType() != Dali::RenderSurface::NO_SURFACE && "No surface for adaptor" );
Adaptor* impl = new Adaptor( *adaptor, surface, baseLayout );
adaptor->mImpl = impl;
- impl->Initialize();
+ impl->Initialize(configuration);
return adaptor;
}
mEnvironmentOptions.InstallLogFunction();
}
-void Adaptor::Initialize()
+void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration)
{
ParseEnvironmentOptions();
mPlatformAbstraction = new SlpPlatform::SlpPlatformAbstraction;
+ ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
+ if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
+ {
+ dataRetentionPolicy = ResourcePolicy::DALI_RETAINS_MESH_DATA;
+ }
+ // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
+ // files automatically.
+
if( mEnvironmentOptions.GetPerformanceLoggingLevel() > 0 )
{
mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, mEnvironmentOptions );
EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
- mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager );
+ mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy );
mObjectProfiler = new ObjectProfiler();
RenderSurface* internalSurface = dynamic_cast<Internal::Adaptor::RenderSurface*>( &surface );
DALI_ASSERT_ALWAYS( internalSurface && "Incorrect surface" );
+ ECore::WindowRenderSurface* windowSurface = dynamic_cast<Internal::Adaptor::ECore::WindowRenderSurface*>( &surface);
+ if( windowSurface != NULL )
+ {
+ windowSurface->Map();
+ // @todo Restart event handler with new surface
+ }
+
mSurface = internalSurface;
SurfaceSizeChanged( internalSurface->GetPositionSize() );
// to start processing messages for new camera setup etc as soon as possible
ProcessCoreEvents();
- // this method is synchronous
+ mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
+
+ // this method blocks until the render thread has completed the replace.
mUpdateRenderController->ReplaceSurface(internalSurface);
+
+ // Inform core, so that texture resources can be reloaded
+ mCore->RecoverFromContextLoss();
+
+ mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
}
Dali::RenderSurface& Adaptor::GetSurface() const
}
}
+
void Adaptor::AddObserver( LifeCycleObserver& observer )
{
ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
void Adaptor::RequestProcessEventsOnIdle()
{
// Only request a notification if the Adaptor is actually running
- if ( RUNNING == mState )
+ // and we haven't installed the idle notification
+ if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState ) )
{
- boost::unique_lock<boost::mutex> lock( mIdleInstaller );
-
- // check if the idle handle is already installed
- if( mNotificationOnIdleInstalled )
- {
- return;
- }
mNotificationOnIdleInstalled = AddIdle( boost::bind( &Adaptor::ProcessCoreEventsFromIdle, this ) );
}
}
}
Adaptor::Adaptor(Dali::Adaptor& adaptor, RenderSurface* surface, const DeviceLayout& baseLayout)
-: mAdaptor(adaptor),
+: mResizedSignalV2(),
+ mLanguageChangedSignalV2(),
+ mAdaptor(adaptor),
mState(READY),
mCore(NULL),
mUpdateRenderController(NULL),