1 #ifndef __DALI_INTERNAL_UPDATE_THREAD_H__
2 #define __DALI_INTERNAL_UPDATE_THREAD_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
40 class UpdateRenderSynchronization;
41 class AdaptorInternalServices;
42 class EnvironmentOptions;
45 * The update-thread is responsible for calling Core::Update(), and
46 * for triggering the render-thread after each update.
53 * Create the update-thread; this will not do anything until Start() is called.
54 * @param[in] sync An object used to synchronize update & render threads.
55 * @param[in] adaptorInterfaces base adaptor interface
56 * @param[in] environmentOptions environment options
58 UpdateThread(UpdateRenderSynchronization& sync,
59 AdaptorInternalServices& adaptorInterfaces,
60 const EnvironmentOptions& environmentOptions );
63 * Non-virtual destructor; UpdateThread is not suitable as a base class.
68 * Starts the update-thread
73 * Stops the update-thread
80 * This method is used by the update-thread for calling Core::Update().
81 * @return true, if the thread finishes properly.
86 * When DALI_FPS_TRACKING is enabled, this method calculates the frame rates for the specified time period
88 void FPSTracking(float secondsFromLastFrame);
91 * Output the FPS information
92 * when the FSP tracking is enabled,
93 * it is called when the specified tracking period is elapsed or in the destructor when the process finished beforehand
95 void OutputFPSRecord();
98 * Optionally output the update thread status.
99 * @param[in] keepUpdatingStatus Whether the update-thread requested further updates.
100 * @param[in] renderNeedsUpdate Whether the render-thread requested another update.
102 void UpdateStatusLogging( unsigned int keepUpdatingStatus, bool renderNeedsUpdate );
106 UpdateRenderSynchronization& mUpdateRenderSync; ///< Used to synchronize the update & render threads
108 Dali::Integration::Core& mCore; ///< Dali core reference
110 float mFpsTrackingSeconds; ///< fps tracking time length in seconds
111 float mFrameCount; ///< how many frames occurred during tracking period
112 float mElapsedTime; ///< time elapsed from previous fps tracking output
114 unsigned int mStatusLogInterval; ///< Interval in frames between status debug prints
115 unsigned int mStatusLogCount; ///< Used to count frames between status debug prints
117 boost::thread* mThread; ///< The actual update-thread.
118 const EnvironmentOptions& mEnvironmentOptions; ///< environment options
119 }; // class UpdateThread
121 } // namespace Adaptor
123 } // namespace Internal
127 #endif // __DALI_INTERNAL_UPDATE_THREAD_H__