[Tizen] Implement partial update
[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) 2019 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
26 namespace Internal
27 {
28
29 class CompleteNotificationInterface;
30 class MessageBase;
31
32 /**
33  * Provides notifications to the event-thread regarding the changes in previous update(s).
34  * For example after an animation finished, or after resources were loaded.
35  */
36 class NotificationManager
37 {
38 public:
39
40   /**
41    * Create an NotificationManager. Owned by Core in event thread side.
42    */
43   NotificationManager();
44
45   /**
46    * Virtual destructor.
47    */
48   virtual ~NotificationManager();
49
50 /// Update side interface, can only be called from Update-thread
51
52   /**
53    * Queue a scene message to an interface. This method is thread-safe.
54    * @param[in] instance to be notified about completion of the Update side event.
55    */
56   void QueueCompleteNotification( CompleteNotificationInterface* instance );
57
58   /**
59    * Queue a scene message. This method is thread-safe.
60    * @param[in] message A newly allocated message; NotificationManager takes ownership.
61    */
62   void QueueMessage( MessageBase* message );
63
64   /**
65    * Signal Notification Manager that update frame is completed so it can let event thread process the notifications
66    */
67   void UpdateCompleted();
68
69 /// Event side interface, can only be called from Update-thread
70
71   /**
72    * Query whether the NotificationManager has messages to process.
73    * @return True if there are messages to process.
74    */
75   bool MessagesToProcess();
76
77   /**
78    * This function is called by Core when events are processed.
79    */
80   void ProcessMessages();
81
82 private:
83
84   // Undefined
85   NotificationManager( const NotificationManager& notificationManager );
86
87   // Undefined
88   NotificationManager& operator=( const NotificationManager& notificationManager );
89
90 private:
91
92   struct Impl;
93   Impl* mImpl;
94
95 };
96
97 } // namespace Internal
98
99 } // namespace Dali
100
101 #endif // DALI_INTERNAL_NOTIFICATION_MANAGER_H
102