84d4cf8c57de776fcdfcd15c3a41514a56503487
[platform/core/uifw/dali-adaptor.git] / adaptors / base / thread-controller.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include "thread-controller.h"
20
21 // INTERNAL INCLUDES
22 #include <base/environment-options.h>
23 #include <base/thread-controller-interface.h>
24 #include <base/combined-update-render/combined-update-render-controller.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 namespace Adaptor
33 {
34
35 ThreadController::ThreadController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions )
36 : mThreadControllerInterface( NULL )
37 {
38   switch( environmentOptions.GetThreadingMode() )
39   {
40     case ThreadingMode::COMBINED_UPDATE_RENDER:
41     {
42       mThreadControllerInterface = new CombinedUpdateRenderController( adaptorInterfaces, environmentOptions );
43       break;
44     }
45   }
46 }
47
48 ThreadController::~ThreadController()
49 {
50   delete mThreadControllerInterface;
51 }
52
53 void ThreadController::Initialize()
54 {
55   mThreadControllerInterface->Initialize();
56 }
57
58 void ThreadController::Start()
59 {
60   mThreadControllerInterface->Start();
61 }
62
63 void ThreadController::Pause()
64 {
65   mThreadControllerInterface->Pause();
66 }
67
68 void ThreadController::Resume()
69 {
70   mThreadControllerInterface->Resume();
71 }
72
73 void ThreadController::Stop()
74 {
75   mThreadControllerInterface->Stop();
76 }
77
78 void ThreadController::RequestUpdate()
79 {
80   mThreadControllerInterface->RequestUpdate();
81 }
82
83 void ThreadController::RequestUpdateOnce()
84 {
85   mThreadControllerInterface->RequestUpdateOnce();
86 }
87
88 void ThreadController::ReplaceSurface( RenderSurface* newSurface )
89 {
90   mThreadControllerInterface->ReplaceSurface( newSurface );
91 }
92
93 void ThreadController::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender )
94 {
95   mThreadControllerInterface->SetRenderRefreshRate( numberOfVSyncsPerRender );
96 }
97
98 } // namespace Adaptor
99
100 } // namespace Internal
101
102 } // namespace Dali