Added APIs to support Launchpad and set window transparency
[platform/core/uifw/dali-adaptor.git] / adaptors / base / separate-update-render / separate-update-render-controller.h
1 #ifndef __DALI_INTERNAL_MULTI_THREAD_CONTROLLER_H__
2 #define __DALI_INTERNAL_MULTI_THREAD_CONTROLLER_H__
3
4 /*
5  * Copyright (c) 2015 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 #include <base/thread-controller-interface.h>
23
24 namespace Dali
25 {
26
27 class RenderSurface;
28
29 namespace Internal
30 {
31
32 namespace Adaptor
33 {
34
35 class UpdateThread;
36 class RenderThread;
37 class VSyncNotifier;
38 class ThreadSynchronization;
39 class AdaptorInternalServices;
40 class EnvironmentOptions;
41
42 /**
43  * Class to control multiple threads:
44  *  - Main Event Thread
45  *  - VSync Thread
46  *  - Update Thread
47  *  - Render Thread
48  */
49 class SeparateUpdateRenderController : public ThreadControllerInterface
50 {
51 public:
52
53   /**
54    * Constructor
55    */
56   SeparateUpdateRenderController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions );
57
58   /**
59    * Non virtual destructor. Not intended as base class.
60    */
61   ~SeparateUpdateRenderController();
62
63   /**
64    * @copydoc ThreadControllerInterface::Initialize()
65    */
66   void Initialize();
67
68   /**
69    * @copydoc ThreadControllerInterface::Start()
70    */
71   void Start();
72
73   /**
74    * @copydoc ThreadControllerInterface::Pause()
75    */
76   void Pause();
77
78   /**
79    * @copydoc ThreadControllerInterface::Resume()
80    */
81   void Resume();
82
83   /**
84    * @copydoc ThreadControllerInterface::Stop()
85    */
86   void Stop();
87
88   /**
89    * @copydoc ThreadControllerInterface::RequestUpdate()
90    */
91   void RequestUpdate();
92
93   /**
94    * @copydoc ThreadControllerInterface::RequestUpdateOnce()
95    */
96   void RequestUpdateOnce();
97
98   /**
99    * @copydoc ThreadControllerInterface::ReplaceSurface()
100    */
101   void ReplaceSurface( RenderSurface* surface );
102
103   /**
104    * @copydoc ThreadControllerInterface::SetRenderRefreshRate()
105    */
106   void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
107
108 private:
109
110   // Undefined copy constructor.
111   SeparateUpdateRenderController( const SeparateUpdateRenderController& );
112
113   // Undefined assignment operator.
114   SeparateUpdateRenderController& operator=( const SeparateUpdateRenderController& );
115
116   AdaptorInternalServices&     mAdaptorInterfaces;
117
118   UpdateThread*                mUpdateThread;     ///< The update-thread owned by SeparateUpdateRenderController
119   RenderThread*                mRenderThread;     ///< The render-thread owned by SeparateUpdateRenderController
120   VSyncNotifier*               mVSyncNotifier;    ///< The vsync-thread owned by SeparateUpdateRenderController
121   ThreadSynchronization*       mThreadSync;       ///< Used to synchronize all the threads; owned by SeparateUpdateRenderController
122   unsigned int                 mNumberOfVSyncsPerRender; ///< Frame skipping count
123 };
124
125 } // namespace Adaptor
126
127 } // namespace Internal
128
129 } // namespace Dali
130
131 #endif // __DALI_INTERNAL_MULTI_THREAD_CONTROLLER_H__