Added pre-render callback to Adaptor
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / thread-controller.h
1 #ifndef __DALI_INTERNAL_THREAD_CONTROLLER_H__
2 #define __DALI_INTERNAL_THREAD_CONTROLLER_H__
3
4 /*
5  * Copyright (c) 2018 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 #include <dali/public-api/signals/callback.h>
21
22 namespace Dali
23 {
24
25 class RenderSurface;
26
27 namespace Internal
28 {
29
30 namespace Adaptor
31 {
32
33 class AdaptorInternalServices;
34 class EnvironmentOptions;
35 class ThreadControllerInterface;
36
37 /**
38  * Class to control all the threads.
39  */
40 class ThreadController
41 {
42 public:
43
44   /**
45    * Constructor
46    */
47   ThreadController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions );
48
49   /**
50    * Non virtual destructor. Not intended as base class.
51    */
52   ~ThreadController();
53
54   /**
55    * @brief Initializes the thread controller
56    *
57    * Will do any required initialiszation, e.g. initialize EGL, create threads (if required), etc.
58    *
59    * @note When this function returns, the application Init signal should be emitted
60    */
61   void Initialize();
62
63   /**
64    * @brief Called AFTER the Init signal has been emitted.
65    *
66    * In other words, should be called AFTER the Init signal has been emitted and all messages for the first scene
67    * have been queued for update to process.
68    */
69   void Start();
70
71   /**
72    * @brief When called, update and rendering is paused.
73    */
74   void Pause();
75
76   /**
77    * @brief Resumes update/rendering after a previous pause.
78    */
79   void Resume();
80
81   /**
82    * @brief Stops update/rendering altogether.
83    *
84    * Will shutdown EGL, destroy threads (if required) etc.
85    */
86   void Stop();
87
88   /**
89    * @brief Called by the adaptor when core requires another update
90    */
91   void RequestUpdate();
92
93   /**
94    * @brief Called by the adaptor when core requires one update
95    *
96    * @note If Adaptor is paused, we do one update/render only
97    */
98   void RequestUpdateOnce();
99
100   /**
101    * @brief Replaces the surface.
102    *
103    * @param surface new surface
104    */
105   void ReplaceSurface( RenderSurface* surface );
106
107   /**
108    * Resize the surface.
109    */
110   void ResizeSurface();
111
112   /**
113    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
114    */
115   void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
116
117   /**
118    * @copydoc Dali::Adaptor::SetPreRenderCallback
119    */
120   void SetPreRenderCallback( CallbackBase* callback );
121
122 private:
123
124   // Undefined copy constructor.
125   ThreadController( const ThreadController& );
126
127   // Undefined assignment operator.
128   ThreadController& operator=( const ThreadController& );
129
130 private:
131
132   ThreadControllerInterface* mThreadControllerInterface;
133 };
134
135 } // namespace Adaptor
136
137 } // namespace Internal
138
139 } // namespace Dali
140
141 #endif // __DALI_INTERNAL_THREAD_CONTROLLER_H__