2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
22 #include <dali/internal/common/memory-pool-object-allocator.h>
24 namespace //Unnamed namespace
27 //Memory pool used to allocate new RenderTaskLists. Memory used by this pool will be released when shutting down DALi
28 Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::RenderTaskList> gRenderTaskListMemoryPool;
30 } // unnamed namespace
41 RenderTaskList* RenderTaskList::New()
43 return new ( gRenderTaskListMemoryPool.AllocateRawThreadSafe() ) RenderTaskList();
46 RenderTaskList::RenderTaskList()
47 : mNotificationObject( nullptr ),
48 mRenderMessageDispatcher( nullptr )
52 RenderTaskList::~RenderTaskList() = default;
54 void RenderTaskList::operator delete( void* ptr )
56 gRenderTaskListMemoryPool.FreeThreadSafe( static_cast<RenderTaskList*>( ptr ) );
59 void RenderTaskList::SetRenderMessageDispatcher( RenderMessageDispatcher* renderMessageDispatcher )
61 mRenderMessageDispatcher = renderMessageDispatcher;
64 void RenderTaskList::AddTask( OwnerPointer< RenderTask >& newTask )
66 DALI_ASSERT_DEBUG( newTask != NULL && "SceneGraph RenderTask is null");
67 DALI_ASSERT_DEBUG( mRenderMessageDispatcher != NULL && "RenderMessageDispatcher is null");
69 newTask->Initialize( *mRenderMessageDispatcher );
70 // mRenderTasks container takes ownership
71 mRenderTasks.PushBack( newTask.Release() );
74 void RenderTaskList::RemoveTask( RenderTask* task )
76 RenderTaskContainer::ConstIterator end = mRenderTasks.End();
77 for ( RenderTaskContainer::Iterator iter = mRenderTasks.Begin(); iter != end; ++iter )
82 mRenderTasks.Erase( iter );
84 break; // we're finished
89 uint32_t RenderTaskList::GetTaskCount()
91 return static_cast<uint32_t>( mRenderTasks.Count() );
94 RenderTaskList::RenderTaskContainer& RenderTaskList::GetTasks()
99 const RenderTaskList::RenderTaskContainer& RenderTaskList::GetTasks() const
104 void RenderTaskList::SetCompleteNotificationInterface( CompleteNotificationInterface* object )
107 mNotificationObject = object;
110 CompleteNotificationInterface* RenderTaskList::GetCompleteNotificationInterface()
113 return mNotificationObject;
116 } // namespace SceneGraph
118 } // namespace Internal