1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
21 #include <dali/internal/common/event-to-update.h>
22 #include <dali/internal/common/message.h>
23 #include <dali/internal/common/owner-container.h>
30 class CompleteStatusManager;
38 * An ordered list of render-tasks.
44 typedef OwnerContainer< RenderTask* > RenderTaskContainer;
49 RenderTaskList( CompleteStatusManager& completeStatusManager );
57 * Add a new RenderTask to the list.
58 * @param[in] newTask The RenderTaskList takes ownership of this task.
60 void AddTask( RenderTask* newTask );
63 * Remove a RenderTask from the list.
64 * @param[in] task The RenderTaskList will destroy this task.
66 void RemoveTask( RenderTask* task );
69 * Retrieve the container of RenderTasks.
70 * @return The container.
72 RenderTaskContainer& GetTasks();
75 * Retrieve the container of RenderTasks.
76 * @return The container.
78 const RenderTaskContainer& GetTasks() const;
83 RenderTaskList(const RenderTaskList&);
86 RenderTaskList& operator=(const RenderTaskList&);
89 RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
90 CompleteStatusManager& mCompleteStatusManager; ///< The complete status tracker (render tasks need this)
93 // Messages for RenderTaskList
95 inline void AddTaskMessage( EventToUpdate& eventToUpdate, RenderTaskList& list, RenderTask& task )
97 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
99 // Reserve some memory inside the message queue
100 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
102 // Construct message in the message queue memory; note that delete should not be called on the return value
103 new (slot) LocalType( &list, &RenderTaskList::AddTask, &task );
106 inline void RemoveTaskMessage( EventToUpdate& eventToUpdate, RenderTaskList& list, const RenderTask& constTask )
108 // Scene graph thread can destroy this object.
109 RenderTask& task = const_cast< RenderTask& >( constTask );
111 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
113 // Reserve some memory inside the message queue
114 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
116 // Construct message in the message queue memory; note that delete should not be called on the return value
117 new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
120 } // namespace SceneGraph
122 } // namespace Internal
126 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__