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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/internal/common/event-to-update.h>
23 #include <dali/internal/common/message.h>
24 #include <dali/internal/common/owner-container.h>
31 class CompleteStatusManager;
39 * An ordered list of render-tasks.
45 typedef OwnerContainer< RenderTask* > RenderTaskContainer;
50 RenderTaskList( CompleteStatusManager& completeStatusManager );
58 * Add a new RenderTask to the list.
59 * @param[in] newTask The RenderTaskList takes ownership of this task.
61 void AddTask( RenderTask* newTask );
64 * Remove a RenderTask from the list.
65 * @param[in] task The RenderTaskList will destroy this task.
67 void RemoveTask( RenderTask* task );
70 * Retrieve the container of RenderTasks.
71 * @return The container.
73 RenderTaskContainer& GetTasks();
76 * Retrieve the container of RenderTasks.
77 * @return The container.
79 const RenderTaskContainer& GetTasks() const;
84 RenderTaskList(const RenderTaskList&);
87 RenderTaskList& operator=(const RenderTaskList&);
90 RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
91 CompleteStatusManager& mCompleteStatusManager; ///< The complete status tracker (render tasks need this)
94 // Messages for RenderTaskList
96 inline void AddTaskMessage( EventToUpdate& eventToUpdate, RenderTaskList& list, RenderTask& task )
98 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
100 // Reserve some memory inside the message queue
101 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
103 // Construct message in the message queue memory; note that delete should not be called on the return value
104 new (slot) LocalType( &list, &RenderTaskList::AddTask, &task );
107 inline void RemoveTaskMessage( EventToUpdate& eventToUpdate, RenderTaskList& list, const RenderTask& constTask )
109 // Scene graph thread can destroy this object.
110 RenderTask& task = const_cast< RenderTask& >( constTask );
112 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
114 // Reserve some memory inside the message queue
115 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
117 // Construct message in the message queue memory; note that delete should not be called on the return value
118 new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
121 } // namespace SceneGraph
123 } // namespace Internal
127 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__