1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
5 * Copyright (c) 2017 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>
32 class CompleteNotificationInterface;
36 class RenderMessageDispatcher;
40 * An ordered list of render-tasks.
46 typedef OwnerContainer< RenderTask* > RenderTaskContainer;
50 * @param renderMessageDispatcher to send messages
52 RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher );
60 * Add a new RenderTask to the list.
61 * @param[in] newTask The RenderTaskList takes ownership of this task.
63 void AddTask( OwnerPointer< RenderTask >& newTask );
66 * Remove a RenderTask from the list.
67 * @param[in] task The RenderTaskList will destroy this task.
69 void RemoveTask( RenderTask* task );
72 * Retrieve the container of RenderTasks.
73 * @return The container.
75 RenderTaskContainer& GetTasks();
78 * Retrieve the container of RenderTasks.
79 * @return The container.
81 const RenderTaskContainer& GetTasks() const;
84 * Set the notification method to package in the NotifyFinishedMessage
85 * @param object to store in notification managers queue
87 void SetCompleteNotificationInterface( CompleteNotificationInterface* object );
90 * Get the Notification interface for when 1+ render tasks have finished
92 CompleteNotificationInterface* GetCompleteNotificationInterface();
97 RenderTaskList(const RenderTaskList&);
100 RenderTaskList& operator=(const RenderTaskList&);
104 CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
105 RenderMessageDispatcher& mRenderMessageDispatcher; ///< for sending messages to render thread
106 RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
110 // Messages for RenderTaskList
112 inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, OwnerPointer< RenderTask >& task )
114 // Message has ownership of the RenderTask while in transit from event -> update
115 typedef MessageValue1< RenderTaskList, OwnerPointer< RenderTask > > LocalType;
117 // Reserve some memory inside the message queue
118 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
120 // Construct message in the message queue memory; note that delete should not be called on the return value
121 new (slot) LocalType( &list, &RenderTaskList::AddTask, task );
124 inline void RemoveTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, const RenderTask& constTask )
126 // Scene graph thread can destroy this object.
127 RenderTask& task = const_cast< RenderTask& >( constTask );
129 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
131 // Reserve some memory inside the message queue
132 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
134 // Construct message in the message queue memory; note that delete should not be called on the return value
135 new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
138 } // namespace SceneGraph
140 } // namespace Internal
144 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__