/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
catch(Dali::DaliException& e)
{
DALI_TEST_PRINT_ASSERT(e);
- DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
+ DALI_TEST_ASSERT(e, "Dali::Stage::IsCoreThread()", TEST_LOCATION);
}
catch(...)
{
mCallbackManager->Stop();
- mState = STOPPED;
+ mCore->UnregisterProcessors();
RemoveSystemInformation();
+ // Note: Must change the state at end of function.
+ mState = STOPPED;
+
DALI_LOG_RELEASE_INFO("Adaptor::Stop\n");
}
}
Dali::Adaptor& Adaptor::Get()
{
- DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
+ DALI_ASSERT_ALWAYS((gThreadLocalAdaptor != NULL) && "Adaptor not instantiated");
return gThreadLocalAdaptor->mAdaptor;
}
bool Adaptor::IsAvailable()
{
- return gThreadLocalAdaptor != NULL;
+ return gThreadLocalAdaptor != NULL && (gThreadLocalAdaptor->mState != Adaptor::State::STOPPED);
}
void Adaptor::SceneCreated()
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
{
- DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
- return mImpl->AddIdle(callback, hasReturnValue);
+ if(IsAvailable())
+ {
+ return mImpl->AddIdle(callback, hasReturnValue);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Adaptor not instantiated");
+ return false;
+ }
}
bool Adaptor::AddWindow(Dali::Integration::SceneHolder childWindow)
{
- DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
- return mImpl->AddWindow(childWindow);
+ if(IsAvailable())
+ {
+ return mImpl->AddWindow(childWindow);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Adaptor not instantiated");
+ return false;
+ }
}
void Adaptor::RemoveIdle(CallbackBase* callback)
{
- DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
- mImpl->RemoveIdle(callback);
+ if(IsAvailable())
+ {
+ mImpl->RemoveIdle(callback);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Adaptor not instantiated");
+ }
}
void Adaptor::ProcessIdle()
{
- DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
- mImpl->ProcessIdle();
+ if(IsAvailable())
+ {
+ mImpl->ProcessIdle();
+ }
+ else
+ {
+ DALI_LOG_ERROR("Adaptor not instantiated");
+ }
}
void Adaptor::ReplaceSurface(Window window, Dali::RenderSurfaceInterface& surface)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
// EXTERNAL INCLUDES
#include <EGL/egl.h>
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
#include <include/EGL/eglext.h>
mEglImageExtensions(NULL),
mResourceDestructionCallback()
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface());
mEglGraphics = static_cast<EglGraphics*>(graphics);
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali/internal/imaging/macos/native-image-source-impl-mac.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
: mImage(MakeRef<CGImageRef>(nullptr)),
mResourceDestructionCallback()
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
DALI_ASSERT_ALWAYS(nativeImageSource.Empty());
CFStringRef colorSpaceName;
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali/internal/imaging/tizen/native-image-source-impl-tizen.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-defines.h>
#include <tbm_surface_internal.h>
mIsBufferAcquired(false),
mBackBufferEnabled(false)
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface());
mEglGraphics = static_cast<EglGraphics*>(graphics);
#include <dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-defines.h>
#include <tbm_surface_internal.h>
mIsResized(false),
mFreeRequest(false)
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface());
mEglGraphics = static_cast<EglGraphics*>(graphics);
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
// EXTERNAL INCLUDES
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/system/linux/dali-ecore-x.h>
mEglImageExtensions(NULL),
mResourceDestructionCallback()
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface());
mEglGraphics = static_cast<EglGraphics*>(graphics);
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali/internal/imaging/windows/native-image-source-impl-win.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
mEglImageExtensions(NULL),
mResourceDestructionCallback()
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface());
mEglGraphics = static_cast<EglGraphics*>(graphics);
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
// EXTERNAL INCLUDES
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
mEglImageExtensions(NULL),
mResourceDestructionCallback()
{
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
GraphicsInterface* graphics = &(Adaptor::GetImplementation(Adaptor::Get()).GetGraphicsInterface());
auto eglGraphics = static_cast<EglGraphics*>(graphics);
mTimerPairsWaiting.erase(timerIter, timerIter + 1);
- if(DALI_UNLIKELY(!Dali::Adaptor::Get().AddIdle(MakeCallback(this, &TizenPlatformAbstraction::CleanupTimers), false)))
+ if(DALI_UNLIKELY(!Dali::Adaptor::IsAvailable() || !Dali::Adaptor::Get().AddIdle(MakeCallback(this, &TizenPlatformAbstraction::CleanupTimers), false)))
{
DALI_LOG_ERROR("Fail to add idle callback for timer function. Call it synchronously.\n");
CleanupTimers();
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali/internal/system/android/timer-impl-android.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/adaptor-framework/android/android-framework.h>
// INTERNAL INCLUDES
void TimerAndroid::Start()
{
// Timer should be used in the event thread
- DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
+ DALI_ASSERT_DEBUG(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mRunning)
{
void TimerAndroid::Stop()
{
// Timer should be used in the event thread
- DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
+ DALI_ASSERT_DEBUG(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mId != 0)
{
void TimerAndroid::Pause()
{
// Timer should be used in the event thread
- DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
+ DALI_ASSERT_DEBUG(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mRunning)
{
void TimerAndroid::Resume()
{
// Timer should be used in the event thread
- DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
+ DALI_ASSERT_DEBUG(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mRunning && mImpl->mId == 0)
{
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali/internal/system/linux/timer-impl-ecore.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/trace.h>
// INTERNAL INCLUDES
void TimerEcore::Start()
{
// Timer should be used in the event thread
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mId != NULL)
{
void TimerEcore::Stop()
{
// Timer should be used in the event thread
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
ResetTimerData();
}
void TimerEcore::Pause()
{
// Timer should be used in the event thread
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mId != NULL)
{
void TimerEcore::Resume()
{
// Timer should be used in the event thread
- DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
+ DALI_ASSERT_ALWAYS(Dali::Stage::IsCoreThread() && "Core is not installed. Might call this API from worker thread?");
if(mImpl->mId != NULL)
{
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
DALI_LOG_RELEASE_INFO("GeometryHittest : %d \n", enable);
gGeometryHittest = enable;
- if(gGeometryHittest)
+ if(gGeometryHittest && Dali::Adaptor::IsAvailable())
{
Dali::SceneHolderList sceneHolders = Dali::Adaptor::Get().GetSceneHolders();
for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
DALI_LOG_RELEASE_INFO("GeometryHittest : %d \n", enable);
gGeometryHittest = enable;
- if(gGeometryHittest)
+ if(gGeometryHittest && Dali::Adaptor::IsAvailable())
{
Dali::SceneHolderList sceneHolders = Dali::Adaptor::Get().GetSceneHolders();
for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
DALI_LOG_RELEASE_INFO("GeometryHittest : %d \n", enable);
gGeometryHittest = enable;
- if(gGeometryHittest)
+ if(gGeometryHittest && Dali::Adaptor::IsAvailable())
{
Dali::SceneHolderList sceneHolders = Dali::Adaptor::Get().GetSceneHolders();
for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
DALI_LOG_RELEASE_INFO("GeometryHittest : %d \n", enable);
gGeometryHittest = enable;
- if(gGeometryHittest)
+ if(gGeometryHittest && Dali::Adaptor::IsAvailable())
{
Dali::SceneHolderList sceneHolders = Dali::Adaptor::Get().GetSceneHolders();
for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
DALI_LOG_RELEASE_INFO("GeometryHittest : %d \n", enable);
gGeometryHittest = enable;
- if(gGeometryHittest)
+ if(gGeometryHittest && Dali::Adaptor::IsAvailable())
{
Dali::SceneHolderList sceneHolders = Dali::Adaptor::Get().GetSceneHolders();
for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
DALI_LOG_RELEASE_INFO("GeometryHittest : %d \n", enable);
gGeometryHittest = enable;
- if(gGeometryHittest)
+ if(gGeometryHittest && Dali::Adaptor::IsAvailable())
{
Dali::SceneHolderList sceneHolders = Dali::Adaptor::Get().GetSceneHolders();
for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)