Merge "Upload resource only without rendering while aplication is paused" into devel...
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor-impl.cpp
index d42eff5..50d63ec 100755 (executable)
@@ -41,6 +41,7 @@
 #include <dali/internal/system/common/thread-controller.h>
 #include <dali/internal/system/common/performance-interface-factory.h>
 #include <dali/internal/adaptor/common/lifecycle-observer.h>
+#include <dali/internal/adaptor/common/thread-controller-interface.h>
 
 #include <dali/internal/graphics/gles/egl-graphics-factory.h>
 #include <dali/internal/graphics/gles/egl-graphics.h> // Temporary until Core is abstracted
@@ -188,11 +189,9 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   defaultWindow->SetAdaptor( Get() );
 
-  Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( defaultWindow ) );
-  if ( window )
-  {
-    mWindowCreatedSignal.Emit( window );
-  }
+  Dali::Integration::SceneHolder defaultSceneHolder( defaultWindow );
+
+  mWindowCreatedSignal.Emit( defaultSceneHolder );
 
   const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
   if( 0u < timeInterval )
@@ -291,7 +290,7 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
   }
 
   std::string systemCachePath = GetSystemCachePath();
-  if ( systemCachePath.c_str() != NULL )
+  if ( ! systemCachePath.empty() )
   {
     Dali::FileStream fileStream( systemCachePath + "gpu-environment.conf", Dali::FileStream::READ | Dali::FileStream::TEXT );
     std::fstream& stream = dynamic_cast<std::fstream&>( fileStream.GetStream() );
@@ -399,7 +398,7 @@ void Adaptor::Start()
     Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mGLES.GetMaxTextureSize() );
 
     std::string systemCachePath = GetSystemCachePath();
-    if( systemCachePath.c_str() != NULL )
+    if( ! systemCachePath.empty() )
     {
       const int dir_err = system( std::string( "mkdir " + systemCachePath ).c_str() );
       if (-1 == dir_err)
@@ -645,11 +644,7 @@ bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::
   // Add the new Window to the container - the order is not important
   mWindows.push_back( &windowImpl );
 
-  Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( &windowImpl ) );
-  if ( window )
-  {
-    mWindowCreatedSignal.Emit( window );
-  }
+  mWindowCreatedSignal.Emit( childWindow );
 
   return true;
 }
@@ -799,6 +794,24 @@ Any Adaptor::GetNativeWindowHandle()
   return mWindows.front()->GetNativeHandle();
 }
 
+Any Adaptor::GetNativeWindowHandle( Dali::Actor actor )
+{
+  Any nativeWindowHandle;
+
+  Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+
+  for( auto sceneHolder : mWindows )
+  {
+    if ( scene == sceneHolder->GetScene() )
+    {
+      nativeWindowHandle = sceneHolder->GetNativeHandle();
+      break;
+    }
+  }
+
+  return nativeWindowHandle;
+}
+
 Any Adaptor::GetGraphicsDisplay()
 {
   Any display;
@@ -877,11 +890,10 @@ void Adaptor::RequestUpdate( bool forceUpdate )
     case PAUSED:
     case PAUSED_WHILE_HIDDEN:
     {
-      // When Dali applications are partially visible behind the lock-screen,
-      // the indicator must be updated (therefore allow updates in the PAUSED state)
       if( forceUpdate )
       {
-        mThreadController->RequestUpdateOnce();
+        // Update (and resource upload) without rendering
+        mThreadController->RequestUpdateOnce( UpdateMode::SKIP_RENDER );
       }
       break;
     }
@@ -1052,7 +1064,7 @@ void Adaptor::RequestUpdateOnce()
 {
   if( mThreadController )
   {
-    mThreadController->RequestUpdateOnce();
+    mThreadController->RequestUpdateOnce( UpdateMode::NORMAL );
   }
 }
 
@@ -1098,6 +1110,18 @@ Dali::WindowContainer Adaptor::GetWindows() const
   return windows;
 }
 
+Dali::SceneHolderList Adaptor::GetSceneHolders() const
+{
+  Dali::SceneHolderList sceneHolderList;
+
+  for( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  {
+    sceneHolderList.push_back( Dali::Integration::SceneHolder( *iter ) );
+  }
+
+  return sceneHolderList;
+}
+
 Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
 : mResizedSignal(),
   mLanguageChangedSignal(),