2 * Copyright (c) 2015 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 "thread-controller.h"
22 #include <base/environment-options.h>
23 #include <base/thread-controller-interface.h>
24 #include <base/separate-update-render/separate-update-render-controller.h>
25 #include <base/single-threaded/single-thread-controller.h>
36 ThreadController::ThreadController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions )
37 : mThreadControllerInterface( NULL )
39 switch( environmentOptions.GetThreadingMode() )
41 case ThreadingMode::SEPARATE_UPDATE_RENDER:
42 case ThreadingMode::COMBINED_UPDATE_RENDER:
44 mThreadControllerInterface = new SeparateUpdateRenderController( adaptorInterfaces, environmentOptions );
48 case ThreadingMode::SINGLE_THREADED:
50 mThreadControllerInterface = new SingleThreadController( adaptorInterfaces, environmentOptions );
56 ThreadController::~ThreadController()
58 delete mThreadControllerInterface;
61 void ThreadController::Initialize()
63 mThreadControllerInterface->Initialize();
66 void ThreadController::Start()
68 mThreadControllerInterface->Start();
71 void ThreadController::Pause()
73 mThreadControllerInterface->Pause();
76 void ThreadController::Resume()
78 mThreadControllerInterface->Resume();
81 void ThreadController::Stop()
83 mThreadControllerInterface->Stop();
86 void ThreadController::RequestUpdate()
88 mThreadControllerInterface->RequestUpdate();
91 void ThreadController::RequestUpdateOnce()
93 mThreadControllerInterface->RequestUpdateOnce();
96 void ThreadController::ReplaceSurface( RenderSurface* newSurface )
98 mThreadControllerInterface->ReplaceSurface( newSurface );
101 void ThreadController::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender )
103 mThreadControllerInterface->SetRenderRefreshRate( numberOfVSyncsPerRender );
106 } // namespace Adaptor
108 } // namespace Internal