Move mItemsDirtyRects from Scene to SceneGraph::Scene
[platform/core/uifw/dali-core.git] / dali / internal / event / common / notification-manager.h
1 #ifndef DALI_INTERNAL_NOTIFICATION_MANAGER_H
2 #define DALI_INTERNAL_NOTIFICATION_MANAGER_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22
23 namespace Dali
24 {
25 namespace Internal
26 {
27 class CompleteNotificationInterface;
28 class MessageBase;
29
30 /**
31  * Provides notifications to the event-thread regarding the changes in previous update(s).
32  * For example after an animation finished, or after resources were loaded.
33  */
34 class NotificationManager
35 {
36 public:
37   /**
38    * Create an NotificationManager. Owned by Core in event thread side.
39    */
40   NotificationManager();
41
42   /**
43    * Virtual destructor.
44    */
45   virtual ~NotificationManager();
46
47   /// Update side interface, can only be called from Update-thread
48
49   /**
50    * Queue a scene message to an interface. This method is thread-safe.
51    * @param[in] instance to be notified about completion of the Update side event.
52    */
53   void QueueCompleteNotification(CompleteNotificationInterface* instance);
54
55   /**
56    * Queue a scene message. This method is thread-safe.
57    * @param[in] message A newly allocated message; NotificationManager takes ownership.
58    */
59   void QueueMessage(MessageBase* message);
60
61   /**
62    * Signal Notification Manager that update frame is completed so it can let event thread process the notifications
63    */
64   void UpdateCompleted();
65
66   /// Event side interface, can only be called from Update-thread
67
68   /**
69    * Query whether the NotificationManager has messages to process.
70    * @return True if there are messages to process.
71    */
72   bool MessagesToProcess();
73
74   /**
75    * This function is called by Core when events are processed.
76    */
77   void ProcessMessages();
78
79 private:
80   // Undefined
81   NotificationManager(const NotificationManager& notificationManager);
82
83   // Undefined
84   NotificationManager& operator=(const NotificationManager& notificationManager);
85
86 private:
87   struct Impl;
88   Impl* mImpl;
89 };
90
91 } // namespace Internal
92
93 } // namespace Dali
94
95 #endif // DALI_INTERNAL_NOTIFICATION_MANAGER_H