1 #ifndef __DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H__
2 #define __DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/internal/common/buffer-index.h>
22 #include <dali/internal/common/event-to-update.h>
23 #include <dali/internal/update/common/scene-graph-buffers.h>
30 class RenderController;
42 * Used by UpdateManager to receive messages from the event-thread.
43 * The event-thread uses the EventToUpdate interface to queue messages for the next update.
45 class MessageQueue: public EventToUpdate
50 * Create a new UpdateMessageQueue.
51 * @param[in] renderController After messages are flushed, we request a render from the RenderController.
52 * @param[in] sceneGraphBuffers Used to keep track of which buffers are being written or read.
54 MessageQueue( Integration::RenderController& renderController,
55 const SceneGraph::SceneGraphBuffers& sceneGraphBuffers );
60 virtual ~MessageQueue();
62 // From EventToUpdate interface
65 * @copydoc Dali::Internal::EventToUpdate::EventProcessingStarted()
67 virtual void EventProcessingStarted();
70 * @copydoc Dali::Internal::EventToUpdate::ReserveMessageSlot()
72 virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene );
75 * @copydoc Dali::Internal::EventToUpdate::GetEventBufferIndex()
77 virtual BufferIndex GetEventBufferIndex() const;
80 * @copydoc Dali::Internal::EventToUpdate::FlushQueue()
82 virtual bool FlushQueue();
84 // Exclusive to UpdateManager
87 * Called once per update; process the previously flushed messages.
89 void ProcessMessages();
92 * Query whether the queue was empty this frame.
94 bool WasEmpty() const;
97 * Query whether the queue contains at least one message that requires that the scene-graph
98 * node tree be updated.
99 * @return A flag, true if the scene graph needs an update
101 bool IsSceneUpdateRequired() const;
106 * Helper to call Process and destructor on each queued message
107 * @param[in] minorQueue The queue to process.
109 void ProcessMinorQueue( char* minorQueue );
117 } // namespace Update
119 } // namespace Internal
123 #endif // __DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H__