Added network build option. Disabled by default.
[platform/core/uifw/dali-adaptor.git] / adaptors / base / thread-controller.h
1 #ifndef __DALI_INTERNAL_UPDATE_RENDER_CONTROLLER_H__
2 #define __DALI_INTERNAL_UPDATE_RENDER_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 namespace Dali
22 {
23
24 class RenderSurface;
25
26 namespace Internal
27 {
28
29 namespace Adaptor
30 {
31
32 class UpdateThread;
33 class RenderThread;
34 class VSyncNotifier;
35 class ThreadSynchronization;
36 class AdaptorInternalServices;
37 class EnvironmentOptions;
38
39 /**
40  * Class to control all the threads.
41  */
42 class ThreadController
43 {
44 public:
45
46   /**
47    * Constructor
48    */
49   ThreadController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions );
50
51   /**
52    * Non virtual destructor. Not intended as base class.
53    */
54   ~ThreadController();
55
56   /**
57    * Initializes the thread controller
58    */
59   void Initialize();
60
61   /**
62    * @copydoc Dali::Adaptor::Start()
63    */
64   void Start();
65
66   /**
67    * @copydoc Dali::Adaptor::Pause()
68    */
69   void Pause();
70
71   /**
72    * @copydoc Dali::Adaptor::Resume()
73    */
74   void Resume();
75
76   /**
77    * @copydoc Dali::Adaptor::Stop()
78    */
79   void Stop();
80
81   /**
82    * Called by the adaptor when core requires another update
83    */
84   void RequestUpdate();
85
86   /**
87    * Called by the adaptor when core requires one update
88    * If Adaptor is paused, we do one update and return to pause
89    */
90   void RequestUpdateOnce();
91
92   /**
93    * Replaces the surface.
94    * @param surface new surface
95    */
96   void ReplaceSurface( RenderSurface* surface );
97
98   /**
99    * @copydoc Dali::Adaptor::SetRenderRefreshRate()
100    */
101   void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
102
103 private:
104
105   // Undefined copy constructor.
106   ThreadController( const ThreadController& );
107
108   // Undefined assignment operator.
109   ThreadController& operator=( const ThreadController& );
110
111   AdaptorInternalServices&     mAdaptorInterfaces;
112
113   UpdateThread*                mUpdateThread;     ///< The update-thread owned by ThreadController
114   RenderThread*                mRenderThread;     ///< The render-thread owned by ThreadController
115   VSyncNotifier*               mVSyncNotifier;    ///< The vsync-thread owned by ThreadController
116   ThreadSynchronization*       mThreadSync;       ///< Used to synchronize all the threads; owned by ThreadController
117   unsigned int                 mNumberOfVSyncsPerRender; ///< Frame skipping count
118 };
119
120 } // namespace Adaptor
121
122 } // namespace Internal
123
124 } // namespace Dali
125
126 #endif // __DALI_INTERNAL_UPDATE_RENDER_CONTROLLER_H__