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>
35 ThreadController::ThreadController( AdaptorInternalServices& adaptorInterfaces, const EnvironmentOptions& environmentOptions )
36 : mThreadControllerInterface( NULL )
38 switch( environmentOptions.GetThreadingMode() )
40 case ThreadingMode::SEPARATE_UPDATE_RENDER:
41 case ThreadingMode::COMBINED_UPDATE_RENDER:
42 case ThreadingMode::SINGLE_THREADED:
44 mThreadControllerInterface = new SeparateUpdateRenderController( adaptorInterfaces, environmentOptions );
49 ThreadController::~ThreadController()
51 delete mThreadControllerInterface;
54 void ThreadController::Initialize()
56 mThreadControllerInterface->Initialize();
59 void ThreadController::Start()
61 mThreadControllerInterface->Start();
64 void ThreadController::Pause()
66 mThreadControllerInterface->Pause();
69 void ThreadController::Resume()
71 mThreadControllerInterface->Resume();
74 void ThreadController::Stop()
76 mThreadControllerInterface->Stop();
79 void ThreadController::RequestUpdate()
81 mThreadControllerInterface->RequestUpdate();
84 void ThreadController::RequestUpdateOnce()
86 mThreadControllerInterface->RequestUpdateOnce();
89 void ThreadController::ReplaceSurface( RenderSurface* newSurface )
91 mThreadControllerInterface->ReplaceSurface( newSurface );
94 void ThreadController::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender )
96 mThreadControllerInterface->SetRenderRefreshRate( numberOfVSyncsPerRender );
99 } // namespace Adaptor
101 } // namespace Internal