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;
32 class CompleteNotificationInterface;
40 * An ordered list of render-tasks.
46 typedef OwnerContainer< RenderTask* > RenderTaskContainer;
51 RenderTaskList( CompleteStatusManager& completeStatusManager );
59 * Add a new RenderTask to the list.
60 * @param[in] newTask The RenderTaskList takes ownership of this task.
62 void AddTask( RenderTask* newTask );
65 * Remove a RenderTask from the list.
66 * @param[in] task The RenderTaskList will destroy this task.
68 void RemoveTask( RenderTask* task );
71 * Retrieve the container of RenderTasks.
72 * @return The container.
74 RenderTaskContainer& GetTasks();
77 * Retrieve the container of RenderTasks.
78 * @return The container.
80 const RenderTaskContainer& GetTasks() const;
83 * Set the notification method to package in the NotifyFinishedMessage
84 * @param object to store in notification managers queue
86 void SetCompleteNotificationInterface( CompleteNotificationInterface* object );
89 * Get the Notification interface for when 1+ render tasks have finished
91 CompleteNotificationInterface* GetCompleteNotificationInterface();
96 RenderTaskList(const RenderTaskList&);
99 RenderTaskList& operator=(const RenderTaskList&);
103 CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
104 RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
105 CompleteStatusManager& mCompleteStatusManager; ///< The complete status tracker (render tasks need this)
109 // Messages for RenderTaskList
111 inline void AddTaskMessage( EventToUpdate& eventToUpdate, RenderTaskList& list, RenderTask& task )
113 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
115 // Reserve some memory inside the message queue
116 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
118 // Construct message in the message queue memory; note that delete should not be called on the return value
119 new (slot) LocalType( &list, &RenderTaskList::AddTask, &task );
122 inline void RemoveTaskMessage( EventToUpdate& eventToUpdate, RenderTaskList& list, const RenderTask& constTask )
124 // Scene graph thread can destroy this object.
125 RenderTask& task = const_cast< RenderTask& >( constTask );
127 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
129 // Reserve some memory inside the message queue
130 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
132 // Construct message in the message queue memory; note that delete should not be called on the return value
133 new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
136 } // namespace SceneGraph
138 } // namespace Internal
142 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__