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( NULL ),
48 mRenderMessageDispatcher( NULL )
52 RenderTaskList::~RenderTaskList()
56 void RenderTaskList::operator delete( void* ptr )
58 gRenderTaskListMemoryPool.FreeThreadSafe( static_cast<RenderTaskList*>( ptr ) );
61 void RenderTaskList::SetRenderMessageDispatcher( RenderMessageDispatcher* renderMessageDispatcher )
63 mRenderMessageDispatcher = renderMessageDispatcher;
66 void RenderTaskList::AddTask( OwnerPointer< RenderTask >& newTask )
68 DALI_ASSERT_DEBUG( newTask != NULL && "SceneGraph RenderTask is null");
69 DALI_ASSERT_DEBUG( mRenderMessageDispatcher != NULL && "RenderMessageDispatcher is null");
71 newTask->Initialize( *mRenderMessageDispatcher );
72 // mRenderTasks container takes ownership
73 mRenderTasks.PushBack( newTask.Release() );
76 void RenderTaskList::RemoveTask( RenderTask* task )
78 RenderTaskContainer::ConstIterator end = mRenderTasks.End();
79 for ( RenderTaskContainer::Iterator iter = mRenderTasks.Begin(); iter != end; ++iter )
84 mRenderTasks.Erase( iter );
86 break; // we're finished
91 uint32_t RenderTaskList::GetTaskCount()
93 return static_cast<uint32_t>( mRenderTasks.Count() );
96 RenderTaskList::RenderTaskContainer& RenderTaskList::GetTasks()
101 const RenderTaskList::RenderTaskContainer& RenderTaskList::GetTasks() const
106 void RenderTaskList::SetCompleteNotificationInterface( CompleteNotificationInterface* object )
109 mNotificationObject = object;
112 CompleteNotificationInterface* RenderTaskList::GetCompleteNotificationInterface()
115 return mNotificationObject;
118 } // namespace SceneGraph
120 } // namespace Internal