Merge "Enable atspi" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / thread-controller-interface.h
1 #ifndef DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H
2 #define DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_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 #include <dali/public-api/signals/callback.h>
22
23 namespace Dali
24 {
25 class RenderSurfaceInterface;
26
27 namespace Internal
28 {
29 namespace Adaptor
30 {
31 enum class UpdateMode
32 {
33   NORMAL,      ///< Update and render
34   SKIP_RENDER, ///< Update and resource upload but no rendering
35   FORCE_RENDER ///< Force update and render
36 };
37
38 enum class ThreadMode
39 {
40   NORMAL,          ///< The thread runs continuously
41   RUN_IF_REQUESTED ///< The threads runs when it is requested
42 };
43
44 /**
45  * Interface Class for all controlling threads.
46  */
47 class ThreadControllerInterface
48 {
49 public:
50   /**
51    * Virtual destructor. Not intended as base class.
52    */
53   virtual ~ThreadControllerInterface()
54   {
55   }
56
57   /**
58    * Initializes the thread controller
59    */
60   virtual void Initialize() = 0;
61
62   /**
63    * @copydoc Dali::Adaptor::Start()
64    */
65   virtual void Start() = 0;
66
67   /**
68    * @copydoc Dali::Adaptor::Pause()
69    */
70   virtual void Pause() = 0;
71
72   /**
73    * @copydoc Dali::Adaptor::Resume()
74    */
75   virtual void Resume() = 0;
76
77   /**
78    * @copydoc Dali::Adaptor::Stop()
79    */
80   virtual void Stop() = 0;
81
82   /**
83    * Called by the adaptor when core requires another update
84    */
85   virtual void RequestUpdate() = 0;
86
87   /**
88    * Called by the adaptor when core requires one update
89    * If Adaptor is paused, we do one update/render and return to pause
90    * @param updateMode The update mode (i.e. i.e. either update & render or skip rendering)
91    */
92   virtual void RequestUpdateOnce(UpdateMode updateMode) = 0;
93
94   /**
95    * Replaces the surface.
96    * @param surface new surface
97    */
98   virtual void ReplaceSurface(Dali::RenderSurfaceInterface* surface) = 0;
99
100   /**
101    * Deletes the surface.
102    * @param[in] surface The surface to be deleted
103    */
104   virtual void DeleteSurface(Dali::RenderSurfaceInterface* surface) = 0;
105
106   /**
107    * Resize the surface.
108    */
109   virtual void ResizeSurface() = 0;
110
111   /**
112    * Wait until the graphics is initialised.
113    */
114   virtual void WaitForGraphicsInitialization() = 0;
115
116   /**
117    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
118    */
119   virtual void SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender) = 0;
120
121   /**
122    * @copydoc Dali::Adaptor::SetPreRenderCallback()
123    */
124   virtual void SetPreRenderCallback(CallbackBase* callback) = 0;
125
126   /**
127    * @brief Adds the new surface.
128    * @param surface new surface
129    */
130   virtual void AddSurface(Dali::RenderSurfaceInterface* surface) = 0;
131
132 protected:
133   /**
134    * Constructor
135    */
136   ThreadControllerInterface()
137   {
138   }
139
140 private:
141   // Undefined copy constructor.
142   ThreadControllerInterface(const ThreadControllerInterface&);
143
144   // Undefined assignment operator.
145   ThreadControllerInterface& operator=(const ThreadControllerInterface&);
146 };
147
148 } // namespace Adaptor
149
150 } // namespace Internal
151
152 } // namespace Dali
153
154 #endif // DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H