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 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/buffer-index.h>
23 #include <dali/internal/common/event-to-update.h>
24 #include <dali/internal/update/common/scene-graph-buffers.h>
31 class RenderController;
43 * Used by UpdateManager to receive messages from the event-thread.
44 * The event-thread uses the EventToUpdate interface to queue messages for the next update.
46 class MessageQueue: public EventToUpdate
51 * Create a new UpdateMessageQueue.
52 * @param[in] renderController After messages are flushed, we request a render from the RenderController.
53 * @param[in] sceneGraphBuffers Used to keep track of which buffers are being written or read.
55 MessageQueue( Integration::RenderController& renderController,
56 const SceneGraph::SceneGraphBuffers& sceneGraphBuffers );
61 virtual ~MessageQueue();
63 // From EventToUpdate interface
66 * @copydoc Dali::Internal::EventToUpdate::EventProcessingStarted()
68 virtual void EventProcessingStarted();
71 * @copydoc Dali::Internal::EventToUpdate::ReserveMessageSlot()
73 virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene );
76 * @copydoc Dali::Internal::EventToUpdate::GetEventBufferIndex()
78 virtual BufferIndex GetEventBufferIndex() const;
81 * @copydoc Dali::Internal::EventToUpdate::FlushQueue()
83 virtual bool FlushQueue();
85 // Exclusive to UpdateManager
88 * Called once per update; process the previously flushed messages.
90 void ProcessMessages();
93 * Query whether the queue was empty this frame.
95 bool WasEmpty() const;
98 * Query whether the queue contains at least one message that requires that the scene-graph
99 * node tree be updated.
100 * @return A flag, true if the scene graph needs an update
102 bool IsSceneUpdateRequired() const;
107 * Helper to call Process and destructor on each queued message
108 * @param[in] minorQueue The queue to process.
110 void ProcessMinorQueue( char* minorQueue );
118 } // namespace Update
120 } // namespace Internal
124 #endif // __DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H__