1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
5 * Copyright (c) 2015 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/devel-api/common/owner-container.h>
23 #include <dali/internal/common/message.h>
24 #include <dali/internal/event/common/event-thread-services.h>
31 class ResourceManager;
32 class CompleteNotificationInterface;
36 class RenderMessageDispatcher;
40 * An ordered list of render-tasks.
46 typedef OwnerContainer< RenderTask* > RenderTaskContainer;
50 * @param renderMessageDispatcher to send messages
51 * @param resourceManager to pass to render tasks
53 RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher, ResourceManager& resourceManager );
61 * Add a new RenderTask to the list.
62 * @param[in] newTask The RenderTaskList takes ownership of this task.
64 void AddTask( RenderTask* newTask );
67 * Remove a RenderTask from the list.
68 * @param[in] task The RenderTaskList will destroy this task.
70 void RemoveTask( RenderTask* task );
73 * Retrieve the container of RenderTasks.
74 * @return The container.
76 RenderTaskContainer& GetTasks();
79 * Retrieve the container of RenderTasks.
80 * @return The container.
82 const RenderTaskContainer& GetTasks() const;
85 * Set the notification method to package in the NotifyFinishedMessage
86 * @param object to store in notification managers queue
88 void SetCompleteNotificationInterface( CompleteNotificationInterface* object );
91 * Get the Notification interface for when 1+ render tasks have finished
93 CompleteNotificationInterface* GetCompleteNotificationInterface();
98 RenderTaskList(const RenderTaskList&);
101 RenderTaskList& operator=(const RenderTaskList&);
105 CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
106 RenderMessageDispatcher& mRenderMessageDispatcher; ///< for sending messages to render thread
107 ResourceManager& mResourceManager; ///< The resource manager (render tasks need this)
108 RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
112 // Messages for RenderTaskList
114 inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, RenderTask& task )
116 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
118 // Reserve some memory inside the message queue
119 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
121 // Construct message in the message queue memory; note that delete should not be called on the return value
122 new (slot) LocalType( &list, &RenderTaskList::AddTask, &task );
125 inline void RemoveTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, const RenderTask& constTask )
127 // Scene graph thread can destroy this object.
128 RenderTask& task = const_cast< RenderTask& >( constTask );
130 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
132 // Reserve some memory inside the message queue
133 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
135 // Construct message in the message queue memory; note that delete should not be called on the return value
136 new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
139 } // namespace SceneGraph
141 } // namespace Internal
145 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__