Revert "[Tizen] Call RequestUpdateOnce in OnWindowShown()"
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor-impl.cpp
index 0aa9feb..4dc5ffc 100755 (executable)
@@ -54,7 +54,6 @@
 #include <dali/internal/graphics/gles/egl-sync-implementation.h>
 #include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/clipboard/common/clipboard-impl.h>
-#include <dali/internal/graphics/common/vsync-monitor.h>
 #include <dali/internal/system/common/object-profiler.h>
 #include <dali/internal/window-system/common/display-connection.h>
 #include <dali/internal/window-system/common/window-impl.h>
@@ -156,7 +155,7 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   mCallbackManager = CallbackManager::New();
 
-  Dali::Internal::Adaptor::SceneHolder* defaultWindow = mWindows.front();
+  SceneHolderPtr defaultWindow = mWindows.front();
 
   DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" );
 
@@ -182,7 +181,7 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   defaultWindow->SetAdaptor( Get() );
 
-  Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( defaultWindow ) );
+  Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( ( &defaultWindow )->Get() ) );
   if ( window )
   {
     mWindowCreatedSignal.Emit( window );
@@ -196,8 +195,6 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
 
-  mVSyncMonitor = new VSyncMonitor;
-
   mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow->GetSurface()->GetSurfaceType() );
 
   mThreadController = new ThreadController( *this, *mEnvironmentOptions );
@@ -304,7 +301,6 @@ Adaptor::~Adaptor()
   mWindows.clear();
 
   delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
-  delete mVSyncMonitor;
   delete mObjectProfiler;
 
   delete mCore;
@@ -341,7 +337,7 @@ void Adaptor::Start()
   // Start the callback manager
   mCallbackManager->Start();
 
-  Dali::Internal::Adaptor::SceneHolder* defaultWindow = mWindows.front();
+  SceneHolderPtr defaultWindow = mWindows.front();
 
   unsigned int dpiHor, dpiVer;
   dpiHor = dpiVer = 0;
@@ -382,7 +378,7 @@ void Adaptor::Pause()
     }
 
     // Pause all windows event handlers when adaptor paused
-    for( auto window : mWindows )
+    for( SceneHolderPtr window : mWindows )
     {
       window->Pause();
     }
@@ -410,7 +406,7 @@ void Adaptor::Resume()
     mState = RUNNING;
 
     // Reset the event handlers when adaptor resumed
-    for( auto window : mWindows )
+    for( SceneHolderPtr window : mWindows )
     {
       window->Resume();
     }
@@ -505,9 +501,9 @@ void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
 void Adaptor::ReplaceSurface( Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& newSurface )
 {
   Internal::Adaptor::SceneHolder* windowImpl = &Dali::GetImplementation( window );
-  for( auto windowPtr : mWindows )
+  for( SceneHolderPtr windowPtr : mWindows )
   {
-    if( windowPtr == windowImpl ) // the window is not deleted
+    if( windowPtr.Get() == windowImpl ) // the window is not deleted
     {
       // Let the core know the surface size has changed
       mCore->SurfaceResized( &newSurface );
@@ -571,13 +567,13 @@ void Adaptor::SetPreRenderCallback( CallbackBase* callback )
   mThreadController->SetPreRenderCallback( callback );
 }
 
-bool Adaptor::AddWindow( Dali::Integration::SceneHolder* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode )
+bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
 {
-  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( *childWindow );
+  Internal::Adaptor::SceneHolder& windowImpl = Dali::GetImplementation( childWindow );
   windowImpl.SetAdaptor( Get() );
 
   // Add the new Window to the container - the order is not important
-  mWindows.push_back( &windowImpl );
+  mWindows.push_back( SceneHolderPtr( &windowImpl ) );
 
   Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( &windowImpl ) );
   if ( window )
@@ -657,11 +653,6 @@ void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
   mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
 }
 
-void Adaptor::SetUseHardwareVSync( bool useHardware )
-{
-  mVSyncMonitor->SetUseHardwareVSync( useHardware );
-}
-
 Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface()
 {
   DALI_ASSERT_DEBUG( mDisplayConnection && "Display connection not created" );
@@ -704,11 +695,6 @@ Dali::RenderSurfaceInterface* Adaptor::GetRenderSurfaceInterface()
   return nullptr;
 }
 
-VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
-{
-  return mVSyncMonitor;
-}
-
 TraceInterface& Adaptor::GetKernelTraceInterface()
 {
   return mKernelTracer;
@@ -871,7 +857,7 @@ void Adaptor::OnWindowHidden()
   {
     bool allWindowsHidden = true;
 
-    for( auto window : mWindows )
+    for( SceneHolderPtr window : mWindows )
     {
       if ( window->IsVisible() )
       {
@@ -1014,7 +1000,7 @@ Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor )
   {
     if ( scene == window->GetScene() )
     {
-      return window;
+      return window.Get();
     }
   }
 
@@ -1028,7 +1014,7 @@ Dali::WindowContainer Adaptor::GetWindows() const
   for ( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
   {
     // Downcast to Dali::Window
-    Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( *iter ) );
+    Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( iter->Get() ) );
     if ( window )
     {
       windows.push_back( window );
@@ -1046,7 +1032,6 @@ Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor,
   mState( READY ),
   mCore( nullptr ),
   mThreadController( nullptr ),
-  mVSyncMonitor( nullptr ),
   mGraphics( nullptr ),
   mDisplayConnection( nullptr ),
   mWindows(),
@@ -1069,7 +1054,7 @@ Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor,
   mUseRemoteSurface( false )
 {
   DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
-  mWindows.insert( mWindows.begin(), &Dali::GetImplementation( window ) );
+  mWindows.insert( mWindows.begin(), SceneHolderPtr( &Dali::GetImplementation( window ) ) );
 
   gThreadLocalAdaptor = this;
 }