4 * Copyright (File::*c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
37 #include "probeinfo.h"
38 #include "osp_probe.h"
42 using namespace Tizen::Base;
43 using namespace Tizen::Base::Collection;
45 #define LIFECYCLE_PROBE_BLOCK(FUNCNAME) \
46 setProbePoint(&probeInfo); \
48 APPEND_LOG_BASIC_NAME(LC_LIFECYCLE, FUNCNAME); \
49 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS); \
50 printLog(&log, MSG_LOG)
52 namespace Tizen { namespace App
57 // virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation) = 0;
62 static void OnTerminate(void* user_data);
63 static void OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data);
67 // : public Tizen::Base::Object
70 void OnBackground(void);
71 void OnForeground(void);
72 // virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation);
77 static void SetAppState(AppState appstate);
80 result UiApp::Execute(UiAppInstanceFactory pUiAppFactory,
81 const IList* pArguments)
83 typedef result (*methodType)(UiAppInstanceFactory pFactory, const IList* pArgs);
84 static methodType uiapp_executep;
85 DECLARE_COMMON_VARIABLE;
88 GET_REAL_FUNC_OSP(_ZN5Tizen3App5UiApp7ExecuteEPFPS1_vEPKNS_4Base10Collection5IListE,
89 LIBOSP_UIFW, uiapp_executep);
92 if(gTraceInfo.exec_map.map_start == NULL)
94 get_map_address(CALLER_ADDRESS, &(gTraceInfo.exec_map.map_start),
95 &(gTraceInfo.exec_map.map_end));
97 LIFECYCLE_PROBE_BLOCK("INITIALIZING");
100 ret = uiapp_executep(pUiAppFactory, pArguments);
103 PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, LC_LIFECYCLE,
104 "pp", pUiAppFactory, pArguments);
105 PACK_COMMON_END(ret, 0, 0);
111 void _AppImpl::OnTerminate(void* user_data)
113 typedef void (*methodType)(void*);
114 static methodType appimpl_onterminatep;
115 DECLARE_COMMON_VARIABLE;
117 GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppImpl11OnTerminateEPv, LIBOSP_APPFW, appimpl_onterminatep);
120 LIFECYCLE_PROBE_BLOCK("TERMINATING");
123 appimpl_onterminatep(user_data);
126 void _AppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data)
128 typedef void (*methodType)(app_device_orientation_e, void*);
129 static methodType appimpl_ondeviceorientationchangedp;
131 GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppImpl26OnDeviceOrientationChangedE24app_device_orientation_ePv,
132 LIBOSP_APPFW, appimpl_ondeviceorientationchangedp);
135 on_orientation_changed((int)orientation, false);
138 appimpl_ondeviceorientationchangedp(orientation, user_data);
141 void _AppInfo::SetAppState(AppState appState)
143 typedef void (*methodType)(AppState appstate);
144 static methodType appinfo_setappstatep;
145 DECLARE_COMMON_VARIABLE;
147 GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppInfo11SetAppStateENS0_8AppStateE, LIBOSP_APPFW, appinfo_setappstatep);
150 if(appState == RUNNING)
152 LIFECYCLE_PROBE_BLOCK("RUNNING");
156 appinfo_setappstatep(appState);
159 void _UiAppImpl::OnBackground(void)
161 typedef void (_UiAppImpl::*methodType)(void);
162 static methodType uiappimpl_onbackgroundp;
163 DECLARE_COMMON_VARIABLE;
165 GET_REAL_FUNC_OSP(_ZN5Tizen3App10_UiAppImpl12OnBackgroundEv, LIBOSP_UIFW, uiappimpl_onbackgroundp);
169 LIFECYCLE_PROBE_BLOCK("PAUSING");
172 (this->*uiappimpl_onbackgroundp)();
175 void _UiAppImpl::OnForeground(void)
177 typedef void (_UiAppImpl::*methodType)(void);
178 static methodType uiappimpl_onforegroundp;
179 DECLARE_COMMON_VARIABLE;
181 GET_REAL_FUNC_OSP(_ZN5Tizen3App10_UiAppImpl12OnForegroundEv, LIBOSP_UIFW, uiappimpl_onforegroundp);
184 LIFECYCLE_PROBE_BLOCK("RUNNING");
186 // SCREENSHOT_DONE();
189 (this->*uiappimpl_onforegroundp)();
193 void _UiAppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation)
195 typedef void (*methodType)(_UiAppImpl* th, app_device_orientation_e orientation);
196 static methodType uiappimpl_ondeviceorientationchangedp;
198 GET_REAL_FUNC_OSP(_ZThn4_N5Tizen3App10_UiAppImpl26OnDeviceOrientationChangedE24app_device_orientation_e,
199 LIBOSP_UIFW, uiappimpl_ondeviceorientationchangedp);
202 on_orientation_changed((int)orientation, false);
205 uiappimpl_ondeviceorientationchangedp(static_cast<_UiAppImpl*>(dynamic_cast<_IAppImpl*>(this)), orientation);
208 } } // end of namespace