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 PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, LC_LIFECYCLE, "p", user_data);
124 PACK_COMMON_END(0, 0, 0);
129 appimpl_onterminatep(user_data);
132 void _AppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data)
134 typedef void (*methodType)(app_device_orientation_e, void*);
135 static methodType appimpl_ondeviceorientationchangedp;
137 GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppImpl26OnDeviceOrientationChangedE24app_device_orientation_ePv,
138 LIBOSP_APPFW, appimpl_ondeviceorientationchangedp);
141 on_orientation_changed((int)orientation, false);
144 appimpl_ondeviceorientationchangedp(orientation, user_data);
147 void _AppInfo::SetAppState(AppState appState)
149 typedef void (*methodType)(AppState appstate);
150 static methodType appinfo_setappstatep;
151 DECLARE_COMMON_VARIABLE;
153 GET_REAL_FUNC_OSP(_ZN5Tizen3App8_AppInfo11SetAppStateENS0_8AppStateE, LIBOSP_APPFW, appinfo_setappstatep);
156 if(appState == RUNNING)
158 LIFECYCLE_PROBE_BLOCK("RUNNING");
161 PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, LC_LIFECYCLE, "p", appState);
162 PACK_COMMON_END(0, 0, 0);
167 appinfo_setappstatep(appState);
170 void _UiAppImpl::OnBackground(void)
172 typedef void (_UiAppImpl::*methodType)(void);
173 static methodType uiappimpl_onbackgroundp;
174 DECLARE_COMMON_VARIABLE;
176 GET_REAL_FUNC_OSP(_ZN5Tizen3App10_UiAppImpl12OnBackgroundEv, LIBOSP_UIFW, uiappimpl_onbackgroundp);
180 LIFECYCLE_PROBE_BLOCK("PAUSING");
183 PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, LC_LIFECYCLE, "", 0);
184 PACK_COMMON_END(0, 0, 0);
189 (this->*uiappimpl_onbackgroundp)();
192 void _UiAppImpl::OnForeground(void)
194 typedef void (_UiAppImpl::*methodType)(void);
195 static methodType uiappimpl_onforegroundp;
196 DECLARE_COMMON_VARIABLE;
198 GET_REAL_FUNC_OSP(_ZN5Tizen3App10_UiAppImpl12OnForegroundEv, LIBOSP_UIFW, uiappimpl_onforegroundp);
201 LIFECYCLE_PROBE_BLOCK("RUNNING");
204 PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, LC_LIFECYCLE, "", 0);
205 PACK_COMMON_END(0, 0, 0);
209 // SCREENSHOT_DONE();
212 (this->*uiappimpl_onforegroundp)();
216 void _UiAppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation)
218 typedef void (*methodType)(_UiAppImpl* th, app_device_orientation_e orientation);
219 static methodType uiappimpl_ondeviceorientationchangedp;
221 GET_REAL_FUNC_OSP(_ZThn4_N5Tizen3App10_UiAppImpl26OnDeviceOrientationChangedE24app_device_orientation_e,
222 LIBOSP_UIFW, uiappimpl_ondeviceorientationchangedp);
225 on_orientation_changed((int)orientation, false);
228 uiappimpl_ondeviceorientationchangedp(static_cast<_UiAppImpl*>(dynamic_cast<_IAppImpl*>(this)), orientation);
231 } } // end of namespace