/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
// CLASS HEADER
-#include "relayout-controller-impl.h"
+#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
// EXTERNAL INCLUDES
#if defined(DEBUG_ENABLED)
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
#include <dali/integration-api/render-controller.h>
+#include <dali/integration-api/trace.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
{
namespace
{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
#if defined(DEBUG_ENABLED)
Integration::Log::Filter* gLogFilter(Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_CONTROLLER"));
{
// Make space for 32 controls to avoid having to copy construct a lot in the beginning
mRelayoutStack->Reserve(32);
+ mPotentialRedundantSubRoots.reserve(32);
+ mTopOfSubTreeStack.reserve(32);
}
-RelayoutController::~RelayoutController()
-{
- delete mRelayoutStack;
-}
+RelayoutController::~RelayoutController() = default;
RelayoutController* RelayoutController::Get()
{
return;
}
- std::vector<Dali::Actor> potentialRedundantSubRoots;
- std::vector<Dali::Actor> topOfSubTreeStack;
+ std::vector<Dali::Actor>& potentialRedundantSubRoots = mPotentialRedundantSubRoots;
+ std::vector<Dali::Actor>& topOfSubTreeStack = mTopOfSubTreeStack;
+
+ DALI_ASSERT_ALWAYS(potentialRedundantSubRoots.empty() && "potentialRedundantSubRoots must be empty before RequestRelayout!");
+ DALI_ASSERT_ALWAYS(topOfSubTreeStack.empty() && "topOfSubTreeStack must be empty before RequestRelayout!");
topOfSubTreeStack.push_back(actor);
RemoveRequest(subRoot);
}
+ potentialRedundantSubRoots.clear();
+
if(!mProcessingCoreEvents)
{
mRenderController.RequestProcessEventsOnIdle(false);
Internal::Actor* actorPtr = &GetImplementation(actor);
// Only add the rootActor if it is not already recorded
- auto itr = std::find(mDirtyLayoutSubTrees.begin(), mDirtyLayoutSubTrees.end(), actorPtr);
+ auto iter = mDirtyLayoutSubTrees.Find(actorPtr);
- if(itr == mDirtyLayoutSubTrees.end())
+ if(iter == mDirtyLayoutSubTrees.End())
{
mDirtyLayoutSubTrees.PushBack(actorPtr);
}
void RelayoutController::RemoveRequest(Dali::Actor& actor)
{
Internal::Actor* actorPtr = &GetImplementation(actor);
-
- mDirtyLayoutSubTrees.Erase(std::remove(mDirtyLayoutSubTrees.begin(),
- mDirtyLayoutSubTrees.end(),
- actorPtr),
- mDirtyLayoutSubTrees.end());
+ mDirtyLayoutSubTrees.EraseObject(actorPtr);
}
void RelayoutController::Request()
void RelayoutController::OnObjectDestroyed(const Dali::RefObject* object)
{
- // Search for and null the object if found in the following lists
- FindAndZero(mDirtyLayoutSubTrees, object);
+ mDirtyLayoutSubTrees.EraseObject(static_cast<const Dali::Internal::Actor*>(object));
}
void RelayoutController::Relayout()
// 2. Iterate through the stack until it's empty.
if(mRelayoutStack->Size() > 0)
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_RELAYOUT");
PRINT_HIERARCHY;
while(mRelayoutStack->Size() > 0)
{
Dali::Actor actor;
Vector2 size;
- mRelayoutStack->Get(mRelayoutStack->Size() - 1, actor, size);
+
+ mRelayoutStack->GetBack(actor, size);
Actor& actorImpl = GetImplementation(actor);
mRelayoutStack->PopBack();
mProcessingCoreEvents = processingEvents;
}
-void RelayoutController::FindAndZero(const RawActorList& list, const Dali::RefObject* object)
+uint32_t RelayoutController::GetMemoryPoolCapacity()
{
- // Object has been destroyed so clear it from this list
- for(auto& actor : list)
- {
- if(actor && (actor == object))
- {
- actor = nullptr; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list.
- }
- }
+ return mRelayoutInfoAllocator.GetCapacity();
}
} // namespace Internal