1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__
5 * Copyright (c) 2018 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 count of RenderTasks.
75 uint32_t GetTaskCount();
78 * Retrieve the container of RenderTasks.
79 * @return The container.
81 RenderTaskContainer& GetTasks();
84 * Retrieve the container of RenderTasks.
85 * @return The container.
87 const RenderTaskContainer& GetTasks() const;
90 * Set the notification method to package in the NotifyFinishedMessage
91 * @param object to store in notification managers queue
93 void SetCompleteNotificationInterface( CompleteNotificationInterface* object );
96 * Get the Notification interface for when 1+ render tasks have finished
98 CompleteNotificationInterface* GetCompleteNotificationInterface();
103 RenderTaskList(const RenderTaskList&);
106 RenderTaskList& operator=(const RenderTaskList&);
110 CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
111 RenderMessageDispatcher& mRenderMessageDispatcher; ///< for sending messages to render thread
112 RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
116 // Messages for RenderTaskList
118 inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, OwnerPointer< RenderTask >& task )
120 // Message has ownership of the RenderTask while in transit from event -> update
121 typedef MessageValue1< RenderTaskList, OwnerPointer< RenderTask > > LocalType;
123 // Reserve some memory inside the message queue
124 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
126 // Construct message in the message queue memory; note that delete should not be called on the return value
127 new (slot) LocalType( &list, &RenderTaskList::AddTask, task );
130 inline void RemoveTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, const RenderTask& constTask )
132 // Scene graph thread can destroy this object.
133 RenderTask& task = const_cast< RenderTask& >( constTask );
135 typedef MessageValue1< RenderTaskList, RenderTask* > LocalType;
137 // Reserve some memory inside the message queue
138 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
140 // Construct message in the message queue memory; note that delete should not be called on the return value
141 new (slot) LocalType( &list, &RenderTaskList::RemoveTask, &task );
144 } // namespace SceneGraph
146 } // namespace Internal
150 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_H__