2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/system/common/thread-controller.h>
22 #include <dali/internal/system/common/environment-options.h>
23 #include <dali/internal/adaptor/common/thread-controller-interface.h>
24 #include <dali/internal/adaptor/common/combined-update-render-controller.h>
35 ThreadController::ThreadController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions )
36 : mThreadControllerInterface( NULL )
38 switch( environmentOptions.GetThreadingMode() )
40 case ThreadingMode::COMBINED_UPDATE_RENDER:
42 mThreadControllerInterface = new CombinedUpdateRenderController( adaptorInterfaces, environmentOptions );
48 ThreadController::~ThreadController()
50 delete mThreadControllerInterface;
53 void ThreadController::Initialize()
55 mThreadControllerInterface->Initialize();
58 void ThreadController::Start()
60 mThreadControllerInterface->Start();
63 void ThreadController::Pause()
65 mThreadControllerInterface->Pause();
68 void ThreadController::Resume()
70 mThreadControllerInterface->Resume();
73 void ThreadController::Stop()
75 mThreadControllerInterface->Stop();
78 void ThreadController::RequestUpdate()
80 mThreadControllerInterface->RequestUpdate();
83 void ThreadController::RequestUpdateOnce( UpdateMode updateMode )
85 mThreadControllerInterface->RequestUpdateOnce( updateMode );
88 void ThreadController::ReplaceSurface( Dali::RenderSurfaceInterface* newSurface )
90 mThreadControllerInterface->ReplaceSurface( newSurface );
93 void ThreadController::ResizeSurface()
95 mThreadControllerInterface->ResizeSurface();
98 void ThreadController::WaitForGraphicsInitialization()
100 mThreadControllerInterface->WaitForGraphicsInitialization();
103 void ThreadController::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender )
105 mThreadControllerInterface->SetRenderRefreshRate( numberOfVSyncsPerRender );
108 void ThreadController::SetPreRenderCallback( CallbackBase* callback )
110 mThreadControllerInterface->SetPreRenderCallback( callback );
113 void ThreadController::AddSurface( Dali::RenderSurfaceInterface* newSurface )
115 mThreadControllerInterface->AddSurface( newSurface );
118 bool ThreadController::IsRenderingWindows() const
120 return mThreadControllerInterface->IsRenderingWindows();
123 } // namespace Adaptor
125 } // namespace Internal