1 #ifndef DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H
2 #define DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H
5 * Copyright (c) 2022 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/update/common/scene-graph-buffers.h>
32 class RenderController;
41 class SceneGraphBuffers;
47 * Used by UpdateManager to receive messages from the event-thread.
53 * Create a new UpdateMessageQueue.
54 * @param[in] renderController After messages are flushed, we request a render from the RenderController.
55 * @param[in] sceneGraphBuffers Used to keep track of which buffers are being written or read.
57 MessageQueue(Integration::RenderController& renderController,
58 const SceneGraph::SceneGraphBuffers& sceneGraphBuffers);
66 * Inform the queue that event processing has started
68 void EventProcessingStarted();
71 * Reserve space for a message
72 * @param[in] size the message size with respect to the size of type 'char'
73 * @param[in] updateScene If set to true, denotes that the message will cause the scene graph node tree to require an update
74 * @return A pointer to the first char allocated for the message
76 uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene);
79 * Flushes the message queue
80 * @return true if there are messages to process
84 // Exclusive to UpdateManager
87 * Called once per update; process the previously flushed messages.
88 * @param updateBufferIndex to use
89 * @return true if the scene graph node tree is updated
91 bool ProcessMessages(BufferIndex updateBufferIndex);
94 * Query whether the queue was empty this frame.
96 bool WasEmpty() const;
99 * Query whether the queue contains at least one message that requires that the scene-graph
100 * node tree be updated.
101 * @return A flag, true if the scene graph needs an update
103 bool IsSceneUpdateRequired() const;
106 * Query for the capacity of the current message queue
108 std::size_t GetCapacity() const;
112 * Helper to call Process and destructor on each queued message
113 * @param[in] minorQueue The queue to process.
115 void ProcessMinorQueue(char* minorQueue);
119 MessageQueue() = delete;
120 MessageQueue(const MessageQueue& rhs) = delete;
121 MessageQueue& operator=(const MessageQueue& rhs) = delete;
128 } // namespace Update
130 } // namespace Internal
134 #endif // DALI_INTERNAL_UPDATE_MESSAGE_QUEUE_H